Commit Graph
6027 Commits
Author SHA1 Message Date
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 e232da026b - Replaced 'zend_hash_find' to 'zend_hash_quick_find' on zend_hash_compare() function 2010-05-03 16:36:04 +00:00
Pierre Joye b3b6cfea2a - update bison version (mike) 2010-05-03 09:05:54 +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
Felipe Pena 84c1643644 - Fixed bug #51719 (typo in function prototype) 2010-05-01 18:54:49 +00:00
Antony Dovgal c23d902e0b fix tests 2010-04-29 12:48:06 +00:00
Antony Dovgal eacfa022b1 fix skipif section 2010-04-29 12:43:18 +00:00
Pierre Joye de555d3970 - fix build (void is evil) 2010-04-28 20:47:13 +00:00
Johannes Schlüter eb7e848f34 spread some more const 2010-04-28 10:11:50 +00:00
Dmitry Stogov 4ff3000850 ws 2010-04-27 12:23:29 +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
Dmitry Stogov 3c179430ec Fixed crash in Zend/tests/unset_cv09.phpt 2010-04-26 13:51:46 +00:00
Felipe Pena 7ab8fd9c0a - Fix test 2010-04-26 13:41:00 +00:00
Felipe Pena c4630c0da2 - Remove empty tests 2010-04-26 00:21:18 +00:00
Felipe Pena 0a6bcd44a7 - Removed allow_call_time_pass_reference (Pierrick) 2010-04-26 00:13:34 +00:00
Antony Dovgal 7211284ac7 fix ~450 tests and 25 segfaults
make test, anyone?
2010-04-25 19:17:16 +00:00
David Soria Parra ebd12eba95 Remove unused variable 2010-04-25 18:34:36 +00:00
David Soria Parra 08b9fdc8a3 Add DTrace probes 2010-04-24 13:32:30 +00:00
Antony Dovgal a9a55f77c0 fix WS 2010-04-23 09:11:44 +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
Stefan Marr 05a9649043 Changed the exclusion keyword from 'instead' to 'insteadof'. [TRAITS]
#That was suggested several times already, but am still not sure whether that really reads better.
#Especially since only the trait is mentioned, since the method name would be duplicated anyway.
2010-04-22 21:56:55 +00:00
Dmitry Stogov 0d1398457f Removed unused function 2010-04-22 15:51:03 +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
Felipe Pena ac181e07ef - Removed unused variables 2010-04-22 13:28:53 +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
Kalle Sommer Nielsen 9d395a4a2b Removed import_request_variables(), this is not needed anymore without register_globals 2010-04-21 22:23:55 +00:00
Felipe Pena 5e2cba90c9 - Dropped unused HL_BG_COLOR (Kalle) 2010-04-21 22:06:18 +00:00
Kalle Sommer Nielsen 9a38f301d6 Remove highlight.bg, it was removed in the old trunk and its not referenced in zend_highlight.c, meaning its not even implemented correctly in 5.3. 2010-04-21 21:56:24 +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
Kalle Sommer Nielsen febee11285 Removed register_globals 2010-04-21 01:27:22 +00:00
Stanislav Malyshev 10a9f48eee add test for self:: and static:: 2010-04-20 19:46:30 +00:00
Johannes Schlüter 5ec6f1e9a1 WS 2010-04-20 15:29:03 +00:00
Antony Dovgal 9aa82f22f2 fix ZTS build 2010-04-20 12:53:43 +00:00
Dmitry Stogov b6ae8a964b Fixed bug #48781 (Cyclical garbage collector memory leak) 2010-04-20 12:30:35 +00:00
Dmitry Stogov 7f18561bdc Updated version numbers 2010-04-20 11:17:25 +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 0bba0bfdc8 regenerated files 2010-04-20 11:14:07 +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