Commit Graph

488 Commits

Author SHA1 Message Date
Xinchen Hui
ff63c09e6f Revert -r319102 and -r322922 in 5.4 branch since they introduce #60978
Fixed #60978 in trunk without reverting previous fix
#see http://news.php.net/php.internals/57789
2012-02-08 03:03:05 +00:00
Derick Rethans
2c1285a573 - Reinstated correct return values after David's fix for #60218. 2012-01-29 15:25:40 +00:00
Dmitry Stogov
032d140fd6 Improved traits implementation. Now to support __CLASS__ constant in traits php doesn't have to copy the complete compiled method, but can reuse the same code. The resolution of __CLASS__ constants in methods defined in traits are delayed till run-time. This approach also made possible to use __CLASS__ constant as default value for traits properties and method arguments. 2012-01-17 08:09:13 +00:00
Felipe Pena
8775a37559 - Year++ 2012-01-01 13:15:04 +00:00
David Soria Parra
ce06b4397c Fix #60218 (instantiating unknown class leads to memory leak in cli) 2011-11-12 17:05:08 +00:00
Arnaud Le Blanc
ea5a61e39b Improved ternary operator performance when returning arrays 2011-10-18 19:42:42 +00:00
Dmitry Stogov
e43ff1359e Fixed ZE specific compile warnings (Bug #55629) 2011-09-13 13:29:35 +00:00
Pierre Joye
d566f0c88e - fix build when no zend signal support 2011-09-08 09:17:21 +00:00
Rasmus Lerdorf
ca2234d18c Make timeouts work again for shutdown functions.
Fixes the faling lang/045 test
2011-09-07 18:48:17 +00:00
Rasmus Lerdorf
c44c0490d5 Since we have fci_cache = &fci_cache_local inside that block
and fci_cache is then later used outside the block, fci_cache_local
can't be block-scoped here
2011-08-07 00:50:46 +00:00
Ilia Alshanetsky
939875133a Zend Signal Handling (see RFC: https://wiki.php.net/rfc/zendsignals)
This needs to go into 5.4 as well, but will wait for Pierre to review win32 situation

# Patch by Lucas Nealan, Arnaud Le Blanc, Brian Shire & Ilia Alshanetsky
2011-06-02 21:16:50 +00:00
Dmitry Stogov
50ce16deff Fixed bug #54268 (Double free when destroy_zend_class fails) 2011-04-15 12:43:20 +00:00
Felipe Pena
0203cc3d44 - Year++ 2011-01-01 02:17:06 +00:00
Dmitry Stogov
f4173a8ece Fixed bug #52939 (zend_call_function does not respect ZEND_SEND_PREFER_REF) 2010-10-13 08:51:39 +00:00
Dmitry Stogov
d3b6fbe39b Fixed bug #52940 (call_user_func_array still allows call-time pass-by-reference). (cataphract@php.net) 2010-10-01 11:53:04 +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
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
79d2aaf0f1 - Fixed bug #51905 (ReflectionParameter fails if default value is an array with an access to self::) 2010-05-26 00:00:58 +00:00
Dmitry Stogov
3c179430ec Fixed crash in Zend/tests/unset_cv09.phpt 2010-04-26 13:51:46 +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
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
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
cf4ea31bff fix #51394 - try harder to find script lineno when exception happens 2010-04-01 19:36:56 +00:00
Felipe Pena
c302509726 - Fixed bug #50731 (Inconsistent namespaces sent to functions registered with spl_autoload_register) 2010-03-03 00:15:34 +00:00
Pierre Joye
5eb4db5e8f - Ensure that stderr output are not buffered, portability for tests 2010-01-25 14:47:19 +00:00
Sebastian Bergmann
d2281d1dff sed -i "s#1998-2009#1998-2010#g" **/*.c **/*.h **/*.php 2010-01-05 20:46:53 +00:00
Stanislav Malyshev
fc1e17ee76 fix regression bug #50394: Reference argument converted to value in __call 2009-12-18 19:12:11 +00:00
Dmitry Stogov
10b30b51bc Fixed unnecessary invokation of setitimer when timeouts have been disabled (Arvind Srinivasan) 2009-11-05 09:33:19 +00:00
Moriyoshi Koizumi
b91e3db105 - WS fix (spaces to tabs) 2009-09-15 00:09:13 +00:00
Stanislav Malyshev
d6ba6c69fb fix crash when unexpectedly passed by-ref parameter is modified 2009-08-18 20:51:49 +00:00
Stanislav Malyshev
9fd8469e94 fix for bug #49000 2009-07-30 05:01:53 +00:00
Matt Wilmas
d55300298e MFH: Added zend_eval_stringl and made create_function(), etc. binary-safe 2009-06-05 18:50:32 +00:00
Matt Wilmas
b907aa4331 MFH:
Restored double->long conversion behavior to that of PHP 5.2 (on most platforms) and prior:
 * Out-of-range numbers overflow/preserve least significant bits (no LONG_MAX/MIN limit)
 * See bug #42868 (presumably-rare platform with different results in 5.2)
 * On 32-bit platforms with 64-bit long type, a zend_long64 cast has been added,
    otherwise it's the same as 5.2
 * Use this conversion method everywhere instead of some plain (long) casts

Added 'L' parameter parsing specifier to ensure a LONG_MAX/MIN limit:
 * Essentially what 5.3's new conversion was doing in most cases
 * Functions with "limit" or "length" type params could be updated to use this,
    and prevent confusing overflow behavior with huge numbers (*also* in 5.2)
  - See bug #47854, for example; or even #42868 again

# Test updates coming
2009-06-04 18:20:45 +00:00
Dmitry Stogov
c8e5bc5988 Calculate hash value once 2009-04-08 13:17:58 +00:00
Matt Wilmas
021e5d168f MFH: Removed extra space from eval string 2009-03-19 18:34:16 +00:00
Dmitry Stogov
c6e55db534 Forgotten include 2009-03-18 10:41:39 +00:00
Dmitry Stogov
31c0af245e Fixed floating point mathematic speed degradation (Christian) 2009-03-18 10:18:10 +00:00
Felipe Pena
2bc612bc0c - Fixed typo 2009-03-05 16:49:47 +00:00
Felipe Pena
c43b935b65 - MFH: Fixed bug #47572 (zval_update_constant_ex: Segmentation fault) 2009-03-05 16:25:43 +00:00
Dmitry Stogov
c277ebc6c8 Fixed bug #47320 ($php_errormsg out of scope in functions) 2009-02-09 09:20:35 +00:00
Marcus Boerger
2aba368462 - MFH Catch exceptions in cli -a 2009-01-02 13:14:49 +00:00
Sebastian Bergmann
08659c2dcd MFH: Bump copyright year, 3 of 3. 2008-12-31 11:15:49 +00:00
Dmitry Stogov
7d4fd3fd38 Fixed bug #46409 (__invoke method called outside of object context when using array_map) 2008-11-27 19:01:23 +00:00
Felipe Pena
8f32490ca3 - Fixed bug #46665 (Triggering autoload with a variable classname causes truncated autoload param) 2008-11-25 21:14:23 +00:00
Etienne Kneuss
3919b16f04 MFH: Fix #46241 (stacked error_handlers, error_handling in general) 2008-11-19 02:00:53 +00:00
Antony Dovgal
512b812761 make sure the slash is actually thre before reading past it 2008-11-12 09:05:48 +00:00