Commit Graph

977 Commits

Author SHA1 Message Date
Felipe Pena
70cacfd3a8 - Changed zend_resolve_class_name() prototype
# No needed to pass fetch_type as pointer here
2011-07-09 17:27:59 +00:00
Felipe Pena
644b5fdec0 - WS 2011-07-09 14:35:37 +00:00
Felipe Pena
32a4d68013 - Minor optimization and clean up 2011-07-09 12:06:11 +00:00
Felipe Pena
32f47f5c41 - CS and WS 2011-07-08 19:52:21 +00:00
Felipe Pena
09842e83ba - Fixed bug #55156 (ReflectionClass::getDocComment() returns comment even though the class has none) 2011-07-07 23:07:14 +00:00
Felipe Pena
8953916314 - Fixed bug #55137 (Changing trait static method visibility) 2011-07-06 00:33:38 +00:00
Felipe Pena
d8e8e68f07 - Fixed bug #55086 (Namespace alias does not work inside trait's use block)
patch by: Pierrick
2011-07-02 17:12:20 +00:00
Felipe Pena
b3a063643b - Optimize property finding by zend_hash_quick_find 2011-06-20 02:04:13 +00:00
Felipe Pena
8a956399fe - Simplify function code 2011-06-20 01:36:23 +00:00
Felipe Pena
864caa2de1 - Avoid re-hash here too 2011-06-20 01:21:47 +00:00
Felipe Pena
d6f5f3782b - Minor optimization (avoid to re-hash already computed var name hash) 2011-06-19 21:56:09 +00:00
Felipe Pena
335cf2fc23 - Removed unnecessary TSRMLS_FETCH 2011-06-19 20:16:08 +00:00
Felipe Pena
a96426874a - Fix build on Windows 2011-06-13 17:52:23 +00:00
Felipe Pena
5670174b66 - Fixed bug #54624 (class_alias and type hint) 2011-06-12 21:10:31 +00:00
Felipe Pena
80d432ca62 - Avoid zend_do_ticks() call for each statement in parsing 2011-06-12 01:43:10 +00:00
Stanislav Malyshev
e18618905c scalar types cleanup 2011-06-03 01:09:32 +00:00
Felipe Pena
1101293b3f - Fixed bug #54804 (__halt_compiler and imported namespaces) (Pierrick) 2011-05-19 23:20:47 +00:00
Pierre Joye
e6368659a7 - WS 2011-05-17 10:39:18 +00:00
Stefan Marr
8ba00176f1 Fixed a inconsitent condition for aliasing traits.
- missed a failing Traits test, but is now fixed, and the bug covered by a dedicated test
# Should always comment conditions that go over more than two lines :-/
2011-05-13 20:28:34 +00:00
Moriyoshi Koizumi
cdb9ee0d1a Fix zend.multibyte oddities. Hope this will address all the known problems. 2011-03-06 07:00:30 +00:00
Felipe Pena
f6a3cd6f57 - Fixed bug #53748 (Using traits lead to a segmentation fault) 2011-01-28 21:19:09 +00:00
Pierre Joye
9885f30873 - fix warning about undefined zend_multibyte_set_filter and zend_multibyte_yyinput_again, why are they not in zend_multibyte.h btw? 2011-01-19 21:40:15 +00:00
Pierre Joye
a27baa7161 - WS 2011-01-19 17:17:52 +00:00
Pierre Joye
3584bbee3b - avoid local redeclaration 2011-01-19 17:06:50 +00:00
Felipe Pena
0203cc3d44 - Year++ 2011-01-01 02:17:06 +00:00
Stefan Marr
d6ac811e5d Removed dead code.
# should not have been commited in the first place.
2010-12-20 08:49:59 +00:00
Felipe Pena
3e3d7c52f0 - Fix build 2010-12-20 01:42:25 +00:00
Stefan Marr
7357867bac Added strict handling of properties in traits.
# This is the first attempt to implement the properties as discussed on the mailinglist.
# RFC is not updated to reflect this changes, yet.
2010-12-20 00:52:40 +00:00
Moriyoshi Koizumi
bbf3d43c1e * Refactor zend_multibyte facility.
Now mbstring.script_encoding is superseded by zend.script_encoding.
2010-12-19 16:36:37 +00:00
Stefan Marr
d7c3c627e8 Changed E_ERROR to E_COMPILE_ERROR for Trait compilation errors.
#Thanks for catching this Kalle.
2010-12-12 17:12:29 +00:00
Stefan Marr
1d2a63da5f Changed collision warning for Traits to fatal error.
#This change is made to have all possible cases of collisions consistently handled as fatal errors.
#The reason to have it fatal is that most likely something changed unexpectedly and needs urgent attention by the developer, since it will fail eventually anyway for instance because the expected method is missing in the class.
#Discussed in this thread: http://marc.info/?l=php-internals&m=129155790226876
2010-12-12 16:48:02 +00:00
Dmitry Stogov
755c2cd0d8 Removed compile time dependency from ext/mbstring 2010-12-08 11:27:34 +00:00
Pierre Joye
e72e27eecc - fix ts build 2010-12-01 16:48:53 +00:00
Dmitry Stogov
a45631d966 Allowed indirect $this access (Scott) 2010-12-01 13:33:49 +00:00
Dmitry Stogov
7628da98c4 Removed support for break/continue $var syntax 2010-11-24 12:19:56 +00:00
Dmitry Stogov
ab93d8c621 Added multibyte suppport by default. Previosly php had to be compiled with --enable-zend-multibyte. Now it can be enabled or disabled throug zend.multibyte directive in php.ini 2010-11-24 05:41:23 +00:00
Felipe Pena
7c541356f3 - Fixed compile warnings 2010-11-23 21:49:18 +00:00
Dmitry Stogov
d72ac0771d Fixed bug #35547 (Segfault accessing static method) 2010-11-23 10:22:34 +00:00
Stefan Marr
4cc45507da Fixed problem reported by Patrick ALLAERT. Trait method was not applied properly when fully qualified. 2010-11-18 17:59:04 +00:00
Etienne Kneuss
105db96e78 Fixed covariance of return-by-ref constraints 2010-11-03 15:40:24 +00:00
Dmitry Stogov
fa3f0bb63f Fixed bug #51008 (Zend/tests/bug45877.phpt fails) 2010-10-05 11:28:56 +00:00
Dmitry Stogov
f2df6a4a3e - Improved memory usage
. zend_function.pass_rest_by_reference is replaced by
    ZEND_ACC_PASS_REST_BY_REFERENCE in zend_function.fn_flags
  . zend_function.return_reference is replaced by ZEND_ACC_RETURN_REFERENCE
    in zend_function.fn_flags
  . zend_arg_info.required_num_args removed. it was needed only for internal
    functions. Now the first arg_info for internal function (which has special
    meaning) is represented by zend_internal_function_info structure.
  . zend_op_array.size, size_var, size_literal, current_brk_cont,
    backpatch_count moved into CG(context), because they are used only during
    compilation.
  . zend_op_array.start_op is moved into EG(start_op), because it's used
    only for 'interactive' execution of single top-level op-array.
  . zend_op_array.done_pass_two is replaced by ZEND_ACC_DONE_PASS_TWO in
    zend_op_array.fn_flags.
  . op_array.vars array is trimmed (reallocated) during pass_two.
  . zend_class_entry.constants_updated is replaced by
     ZEND_ACC_CONSTANTS_UPDATED in zend_class_entry.ce_flags
  . the size of zend_class_entry is reduced by sharing the same memory space
    by different information for internal and user classes.
    See zend_class_inttry.info union.
2010-09-15 07:38:52 +00:00
Dmitry Stogov
2188f26c45 Fixed bug #52614 (Memory leak when writing on uninitialized variable returned from method call) 2010-08-25 09:14:36 +00:00
Felipe Pena
f3028b9226 - Improved fix for bug #52573 2010-08-18 01:59:37 +00:00
Dmitry Stogov
931c2d104d In ZTS mode default properties and constants of internal classes can't be modified in place and have to be separated 2010-08-11 09:38:41 +00:00
Dmitry Stogov
3cf5ab9e56 Use interned strings for class names 2010-08-05 13:10:15 +00:00
Dmitry Stogov
6443445f25 ZEND_UNSET_* don't have results 2010-07-29 09:46:59 +00:00
Dmitry Stogov
ca4de03eed ZEND_FETCH_*_R operations simplified and can't be used with EXT_TYPE_UNUSED flag any more. Thit is very rare and useless case. ZEND_FREE might be required after them instead. 2010-07-16 13:38:09 +00:00
Felipe Pena
b458b1a4c1 - Fix ZTS build 2010-07-08 15:22:11 +00:00
Dmitry Stogov
f0c8366a9e - use interned strings for auto globals
- $GLOBALS became a JIT autoglobal, so it's initialized only if used (this may affect opcode caches)
2010-07-08 14:05:11 +00:00
Dmitry Stogov
1a1178a685 eliminated unnecessary iterations during request startup/shutdown 2010-07-06 11:40:17 +00:00
Felipe Pena
cb6bf19bfa - Fixed bug #51421 (Abstract __construct constructor argument list not enforced) 2010-06-26 22:05:13 +00:00
Felipe Pena
d98de7d248 - Fixed bug #52160 (Invalid E_STRICT redefined constructor error) 2010-06-26 19:19:16 +00:00
Felipe Pena
dc3940bd1c - Fix ZTS build 2010-06-08 18:02:10 +00:00
Stefan Marr
e6bd5368ad Fixed issue with statics in traits.
#Please review this change, I moved the routine which copies statics from the closure code to zend_variables.c
#Please also have a look to check whether the TSRMLS_DC is correct, and whether it fits with the rest in zend_variables, because there you are using some macro magic and I am not exactly sure what the reason is for that.
2010-06-08 15:56:36 +00:00
Johannes Schlüter
0262fdf3e9 - A method called like a trait is no constructor 2010-05-29 20:01:08 +00:00
Dmitry Stogov
f7ce69585c - Interned string related callbacks moved turned from compiler_globals into real globals
- Updated API version number
2010-05-25 09:00:20 +00:00
Ilia Alshanetsky
33fae4caa0 Added support for numeric & scalar type hint as defined within
http://wiki.php.net/rfc/typecheckingstrictandweak RFC
2010-05-24 18:32:59 +00:00
Dmitry Stogov
f23e857676 Fixed ZTS build 2010-05-24 17:07:52 +00:00
Dmitry Stogov
c5237d82bf Added caches to eliminate repeatable run-time bindings of functions, classes, constants, methods and properties 2010-05-24 14:11:39 +00:00
Derick Rethans
1bc9247651 - Added scalar typehinting. 2010-05-20 19:18:35 +00:00
Felipe Pena
a7c129af16 - Fix typo (take 3! thanks Chris and Tony) 2010-05-07 17:57:09 +00:00
Felipe Pena
91c46fd26e - Fix error message wording (Kalle) 2010-05-07 17:18:49 +00:00
Felipe Pena
c95b4ace40 - Fixed ZEND_VERIFY_ABSTRACT_CLASS order when using traits
# It's the last one now, thus the traits can be used to implement interfaces
2010-05-07 16:29:15 +00:00
Felipe Pena
74fe9dd89e - Fixed magic method and constructor copy for traits 2010-05-07 13:55:27 +00:00
Felipe Pena
5d701938a3 - Added check for constant creation on Traits
- Simplified trait flag check
- Test++ :)
2010-05-07 11:09:35 +00:00
Felipe Pena
ca3656dfe0 - Added check for 'static' on trait visibility modifier 2010-05-06 19:20:12 +00:00
Felipe Pena
363d6e45be - Fix typos 2010-05-06 18:28:45 +00:00
Felipe Pena
241ceed37e - Fix error messages & WS 2010-05-06 18:20:38 +00:00
Dmitry Stogov
d5800f881c Optimized access to static properties using executor specialization. A constant class name may be used as a direct operand of ZEND_FETCH_* instruction without previous ZEND_FETCH_CLASS. 2010-05-06 10:27:35 +00:00
Felipe Pena
a888d2cd16 - Added check for trait when trying to extend it 2010-05-04 18:45:01 +00:00
Felipe Pena
45a536fc7c - Added check for abstract class
abstract class foo { }
  class T { use foo; } // T cannot use foo - it is not a trait

- Added check for trait on NEW 

  trait a { }
  new a; // Cannot instantiate trait a

# Tests for errors comming soon :)
2010-05-04 18:21:00 +00:00
Stefan Marr
331b052994 Changed naming of traits-related helper functions (suggested by Derick), added missing static qualifiers. 2010-05-03 22:08:09 +00:00
Felipe Pena
155bdc8a72 - WS 2010-05-02 18:47:27 +00:00
Felipe Pena
9568c8e398 - Changed zend_hash func calls to use the quick ones 2010-05-02 17:39:24 +00:00
Stefan Marr
fe4988241d Refactored part of the Traits implementation.
# - renamed php_runkit_function_copy_ctor to _duplicate_function
#   REM: runkit does not compile with trunk at the moment, fixing it would introduce even more version #ifs, don't know what the best way is to fix it
# - extracted traits related stuff from destroy_zend_class into _destroy_zend_class_traits_info
#   - need to investigate implementation/handling of internal classes further before enabling internal traits
2010-05-02 16:32:25 +00:00
Pierre Joye
de555d3970 - fix build (void is evil) 2010-04-28 20:47:13 +00:00
Dmitry Stogov
d8a7f892ee - ws
- removed unused variables
2010-04-27 12:17:32 +00:00
Dmitry Stogov
c58b131e29 - Reimplemented ZEND_INIT_FCALL_BY_NAME and ZEND_INIT_NS_FCALL_BY_NAME to use literals instead of additional operands
- Optimized access to global constants
2010-04-27 12:09:13 +00:00
Felipe Pena
0a6bcd44a7 - Removed allow_call_time_pass_reference (Pierrick) 2010-04-26 00:13:34 +00:00
Dmitry Stogov
f06d839e59 Use fast class fetch function 2010-04-23 08:56:03 +00:00
Felipe Pena
246a15e95f - Fix memory issue 2010-04-23 02:57:49 +00:00
Felipe Pena
c7bf006c4d - Fix Windows build (Kalle) 2010-04-23 01:56:03 +00:00
Felipe Pena
5a8632a144 - Fix function signature 2010-04-23 01:43:27 +00:00
Felipe Pena
28263bf8a4 - Fix ZTS code and CS 2010-04-23 00:54:51 +00:00
Felipe Pena
cdf71efc5c - Fix zend_hash_apply_with_arguments() calls on ZTS 2010-04-22 23:25:05 +00:00
Felipe Pena
c05e38e401 - Fixed ZTS build & comment-style 2010-04-22 23:16:15 +00:00
Stefan Marr
cd6415f1a9 Implemented Traits for PHP as proposed in the RFC [TRAITS]
# RFC http://wiki.php.net/rfc/horizontalreuse#traits_-_reuse_of_behavior
# Ok, here we go, I guess that will result in more discussion, which is fine
# by me. But now, the patch is here, and properly archived.
# 
# See below a list of notes to the patch, it also includes a list of
# points which should be fixed
# 
# Internals of the Traits Patch
# -----------------------------
# 
# Open TODOs
# """"""""""
# 
# - Reflection API
# - support for traits for internal classes
#   - currently destroy_zend_class does not handle that case 
# 
# Introduced Structures
# """""""""""""""""""""
# 
# Data structures to encode the composition information specified in the
# source:
#  - zend_trait_method_reference
#  - zend_trait_precedence
#  - zend_trait_alias
# 
# Changes
# """""""
# 
# zend_class_entry
#  - uses NULL terminated lists of pointers for
#    - trait_aliases
#    - trait_precedences
#    - do you prefer an explicit counter?
#    - the information is only necessary during class composition
#      but might be interesting for reflection
#    - did not want to blow up class further with not really necessary length counters
# 
# added keywords
#   - trait
#   - insteadof
# 
# Added opcodes
#  ZEND_ADD_TRAIT
#    - similar to ZEND_ADD_INTERFACE
#    - adds the trait to the list of traits of a class, no actual composition done
#  ZEND_BIND_TRAITS
#    - emitted in zend_do_end_class_declaration
#    - concludes the class definition and will initiate the trait composition
#      when the class definition is encountered during runtime
# 
# Added Flags
#   ZEND_ACC_TRAIT = 0x120
#   ZEND_ACC_IMPLEMENT_TRAITS = 0x400000
#   ZEND_FETCH_CLASS_TRAIT = 14
# 
# zend_vm_execute.h
#  - not sure whether the handler initialization (ZEND_ADD_TRAIT_SPEC_HANDLER,
#    ZEND_BIND_TRAITS_SPEC_HANDLER) is correct, maybe it should be more selective
# 
# zend_compile.c
#  - refactored do_inherit_method_check
#    split into do_inherit_method_check and do_inheritance_check_on_method
#  - added helper functions use a '_' as prefix and are not mentioned in the
#    headers
#  - _copy_functions
#    prepare hash-maps of functions which should be merged into a class
#    here the aliases are handled
#  - _merge_functions
#    builds a hash-table of the methods which need to be added to a class
#    does the conflict detection
#  - reused php_runkit_function_copy_ctor
#    - it is not identical with the original code anymore, needed to update it
#      think I fixed some bugs, not sure whether all have been reported back to runkit
#    - has to be renamed, left the name for the moment, to make its origin obvious
#    - here might be optimization potential
#    - not sure whether everything needs to be copied
#      - copying the literals might be broken
#        - added it since the literals array is freed by efree and gave problems
#          with doubled frees
#      - all immutable parts of the zend_op array should not be copied
#        - am not sure which parts are immutable
#        - and not sure how to avoid doubled frees on the same arrays on shutdown
#  - _merge_functions_to_class
#    does the final merging with the target class to handle inherited
#    and overridden methods
#  - small helper for NULL terminated lists
#    zend_init_list, zend_add_to_list
# 
# zend_language_parser.y
#  - reused class definition for traits
#    - there should be something with regard to properties
#      - if they get explicitly defined, it might be worthwhile to
#        check that there are no collisions with other traits in a composition
#        (however, I would not introduce elaborate language features to control that
#         but a notice for such conflicts might be nice to the developers)
2010-04-22 22:05:56 +00:00
Dmitry Stogov
e87d72002b Optimized access to global constants using values with pre-calculated hash_values from litersls table 2010-04-22 15:03:17 +00:00
Dmitry Stogov
fb9d95e5a4 ZEND_RETURN is splitted into two new instructions ZEND_RETURN and ZEND_RETURN_BY_REF 2010-04-22 11:56:45 +00:00
Felipe Pena
9f700c417b - Fix ZTS build 2010-04-21 15:08:10 +00:00
Dmitry Stogov
7a2fd62c39 Eliminated unnecessary compile-time hash_value recalculation for interned strings 2010-04-21 14:58:33 +00:00
Dmitry Stogov
453b49ed20 Added a number of small performance tweaks and optimizations
. ZEND_RECV now always has IS_CV as its result
  . ZEND_CATCH now has to be used only with constant class names
  . ZEND_FETCH_DIM_? may fetch array and dimension operans in a different order
2010-04-20 11:16:39 +00:00
Dmitry Stogov
dd5c478be6 Added concept of interned strings. All strings constants known at compile time are allocated in a single copy and never changed. 2010-04-20 11:05:54 +00:00
Dmitry Stogov
94dd83722b Changed the structure of op_array.opcodes. The constant values are moved from opcode operands into a separate literal table 2010-04-20 10:57:45 +00:00
Stanislav Malyshev
c93a4f192b restore $this support for closures to its former glory 2010-04-19 19:45:03 +00:00
Stanislav Malyshev
5f6a39d531 change namespaced ctors - only __construct would work 2010-04-04 23:28:20 +00:00
Sebastian Bergmann
d2281d1dff sed -i "s#1998-2009#1998-2010#g" **/*.c **/*.h **/*.php 2010-01-05 20:46:53 +00:00
Felipe Pena
81ad353ec2 - Fixed bug #50464 (declare encoding doesn't work with)
# The bug (BC) only happens in this branch.
2009-12-13 15:18:58 +00:00
Felipe Pena
7914d298b4 - Fixed bug #49472 (Constants defined in Interfaces can be overridden) 2009-12-03 12:34:50 +00:00