From: Felipe Pena Date: Mon, 26 Apr 2010 00:13:34 +0000 (+0000) Subject: - Removed allow_call_time_pass_reference (Pierrick) X-Git-Tag: php-5.4.0alpha1~191^2~1660 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0a6bcd44a72197bc8fb5658ce9fe4b46019ab9b3;p=php - Removed allow_call_time_pass_reference (Pierrick) --- diff --git a/NEWS b/NEWS index 12fe6f7ae9..fae2f6d121 100644 --- a/NEWS +++ b/NEWS @@ -34,17 +34,18 @@ - Changed session.entropy_file to default to /dev/urandom or /dev/arandom if either is present at compile time. (Rasmus) -- Removed legacy features: (Kalle) - . define_syslog_variables ini option and its associated function. - . highlight.bg ini option. - . import_request_variables(). - . register_globals. - . register_long_arrays ini option. +- Removed legacy features: + . define_syslog_variables ini option and its associated function. (Kalle) + . highlight.bg ini option. (Kalle) + . import_request_variables(). (Kalle) + . register_globals. (Kalle) + . allow_call_time_pass_reference. (Pierrick) + . register_long_arrays ini option. (Kalle) . Session bug compatibility mode (session.bug_compat42 and - session.bug_compat_warn ini options). + session.bug_compat_warn ini options). (Kalle) . session_is_registered(), session_register() and session_unregister() - functions. - . y2k_compliance ini option. + functions. (Kalle) + . y2k_compliance ini option. (Kalle) ?? ??? 20??, PHP 5.3.3 - Upgraded bundled PCRE to version 8.01. (Ilia) diff --git a/Zend/tests/magic_by_ref_010.phpt b/Zend/tests/magic_by_ref_010.phpt index 0a45fb9113..e69de29bb2 100644 --- a/Zend/tests/magic_by_ref_010.phpt +++ b/Zend/tests/magic_by_ref_010.phpt @@ -1,30 +0,0 @@ ---TEST-- -passing arguments by ref to a method handled by __call() ---INI-- -allow_call_time_pass_reference=1 ---FILE-- -test(&$v); - -var_dump($v); - -echo "Done\n"; -?> ---EXPECTF-- -str -5 -int(5) -Done diff --git a/Zend/zend.c b/Zend/zend.c index bd48e52223..0fbe847d80 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -442,12 +442,10 @@ static FILE *zend_fopen_wrapper(const char *filename, char **opened_path TSRMLS_ #ifdef ZTS static zend_bool asp_tags_default = 0; static zend_bool short_tags_default = 1; -static zend_bool ct_pass_ref_default = 1; static zend_uint compiler_options_default = ZEND_COMPILE_DEFAULT; #else # define asp_tags_default 0 # define short_tags_default 1 -# define ct_pass_ref_default 1 # define compiler_options_default ZEND_COMPILE_DEFAULT #endif @@ -456,7 +454,6 @@ static void zend_set_default_compile_time_values(TSRMLS_D) /* {{{ */ /* default compile-time values */ CG(asp_tags) = asp_tags_default; CG(short_tags) = short_tags_default; - CG(allow_call_time_pass_reference) = ct_pass_ref_default; CG(compiler_options) = compiler_options_default; } /* }}} */ @@ -744,7 +741,6 @@ void zend_post_startup(TSRMLS_D) /* {{{ */ asp_tags_default = CG(asp_tags); short_tags_default = CG(short_tags); - ct_pass_ref_default = CG(allow_call_time_pass_reference); compiler_options_default = CG(compiler_options); zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC); diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 4ee458e5cc..9ba45f36ed 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -2335,21 +2335,21 @@ void zend_do_pass_param(znode *param, zend_uchar op, int offset TSRMLS_DC) /* {{ zend_stack_top(&CG(function_call_stack), (void **) &function_ptr_ptr); function_ptr = *function_ptr_ptr; - if (original_op == ZEND_SEND_REF && !CG(allow_call_time_pass_reference)) { + if (original_op == ZEND_SEND_REF) { if (function_ptr && function_ptr->common.function_name && function_ptr->common.type == ZEND_USER_FUNCTION && !ARG_SHOULD_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) { - zend_error(E_DEPRECATED, - "Call-time pass-by-reference has been deprecated; " - "If you would like to pass it by reference, modify the declaration of %s(). " - "If you would like to enable call-time pass-by-reference, you can set " - "allow_call_time_pass_reference to true in your INI file", function_ptr->common.function_name); + zend_error(E_COMPILE_ERROR, + "Call-time pass-by-reference has been removed; " + "If you would like to pass argument by reference, modify the declaration of %s().", + function_ptr->common.function_name); } else { - zend_error(E_DEPRECATED, "Call-time pass-by-reference has been deprecated"); + zend_error(E_COMPILE_ERROR, "Call-time pass-by-reference has been removed"); } - } - + return; + } + if (function_ptr) { if (ARG_MAY_BE_SENT_BY_REF(function_ptr, (zend_uint) offset)) { if (param->op_type & (IS_VAR|IS_CV)) { diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 19be67d1de..010a0db8e5 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -104,7 +104,6 @@ struct _zend_compiler_globals { zend_bool in_compilation; zend_bool short_tags; zend_bool asp_tags; - zend_bool allow_call_time_pass_reference; zend_declarables declarables; diff --git a/ext/spl/tests/array_004.phpt b/ext/spl/tests/array_004.phpt index dd07f29820..0b80e5c89f 100755 --- a/ext/spl/tests/array_004.phpt +++ b/ext/spl/tests/array_004.phpt @@ -1,12 +1,8 @@ --TEST-- SPL: ArrayIterator ---INI-- -allow_call_time_pass_reference=1 --FILE-- 0, 1=>1, 2=>2); $obj = new ArrayObject($arr); @@ -19,66 +15,9 @@ foreach($obj as $ak=>$av) { } } -echo "==UseRef==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==0 && $bk==0) { - $arr[0] = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "==Modify==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==0 && $bk==0) { - $arr[0] = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "==Delete==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==1 && $bk==1) { - unset($arr[1]); - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - -echo "==Change==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>$av) { - foreach($obj as $bk=>$bv) { - if ($ak==1 && $bk==1) { - $arr = NULL; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - echo "Done\n"; ?> --EXPECTF-- -==Normal== 0=>0 - 0=>0 0=>0 - 1=>1 0=>0 - 2=>2 @@ -88,54 +27,4 @@ echo "Done\n"; 2=>2 - 0=>0 2=>2 - 1=>1 2=>2 - 2=>2 -==UseRef== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>modify -1=>1 - 1=>1 -1=>1 - 2=>2 -2=>2 - 0=>modify -2=>2 - 1=>1 -2=>2 - 2=>2 -==Modify== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>modify -1=>1 - 1=>1 -1=>1 - 2=>2 -2=>2 - 0=>modify -2=>2 - 1=>1 -2=>2 - 2=>2 -==Delete== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>0 -1=>1 - 1=>1 - -Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_004.php on line %d -1=>1 - 0=>0 -1=>1 - 2=>2 - -Notice: main(): ArrayIterator::next(): Array was modified outside object and internal position is no longer valid in %sarray_004.php on line %d -0=>0 - 0=>0 -0=>0 - 2=>2 -2=>2 - 0=>0 -2=>2 - 2=>2 -==Change== -0=>0 - 0=>0 -0=>0 - 1=>1 -0=>0 - 2=>2 -1=>1 - 0=>0 -1=>1 - 1=>1 - -Notice: main(): ArrayIterator::current(): Array was modified outside object and is no longer an array in %sarray_004.php on line %d - -Notice: main(): ArrayIterator::valid(): Array was modified outside object and is no longer an array in %sarray_004.php on line %d - -Notice: main(): ArrayIterator::current(): Array was modified outside object and is no longer an array in %sarray_004.php on line %d - -Notice: main(): ArrayIterator::valid(): Array was modified outside object and is no longer an array in %sarray_004.php on line %d Done diff --git a/ext/spl/tests/array_008.phpt b/ext/spl/tests/array_008.phpt index 61c7abd7c6..e7a618dda5 100755 --- a/ext/spl/tests/array_008.phpt +++ b/ext/spl/tests/array_008.phpt @@ -1,12 +1,8 @@ --TEST-- SPL: ArrayIterator and foreach reference ---INI-- -allow_call_time_pass_reference=1 --FILE-- 0, 1=>1, 2=>2); $obj = new ArrayObject($arr); @@ -19,35 +15,10 @@ foreach($obj as $ak=>&$av) { } } -echo "==UseRef==\n"; - -$arr = array(0=>0, 1=>1, 2=>2); -$obj = new ArrayObject(&$arr); - -foreach($obj as $ak=>&$av) { - foreach($obj as $bk=>&$bv) { - if ($ak==0 && $bk==0) { - $bv = "modify"; - } - echo "$ak=>$av - $bk=>$bv\n"; - } -} - ?> ===DONE=== --EXPECTF-- -==Normal== -0=>modify - 0=>modify -0=>modify - 1=>1 -0=>modify - 2=>2 -1=>1 - 0=>modify -1=>1 - 1=>1 -1=>1 - 2=>2 -2=>2 - 0=>modify -2=>2 - 1=>1 -2=>2 - 2=>2 -==UseRef== 0=>modify - 0=>modify 0=>modify - 1=>1 0=>modify - 2=>2 diff --git a/ext/spl/tests/dllist_001.phpt b/ext/spl/tests/dllist_001.phpt index 2a21561883..e27f23ca44 100644 --- a/ext/spl/tests/dllist_001.phpt +++ b/ext/spl/tests/dllist_001.phpt @@ -1,7 +1,5 @@ --TEST-- SPL: DoublyLinkedList: std operations ---INI-- -allow_call_time_pass_reference=1 --FILE-- push($a); -$a = 3; -$dll->push(&$a); -$a = 4; -echo $dll->pop()."\n"; echo $dll->pop()."\n"; $a = 2; $dll->unshift($a); -$a = 3; -$dll->unshift(&$a); -$a = 4; -echo $dll->shift()."\n"; echo $dll->shift()."\n"; // peakable @@ -61,9 +51,7 @@ echo count($dll)."\n"; --EXPECTF-- Exception: Can't pop from an empty datastructure Exception: Can't shift from an empty datastructure -3 2 -3 2 2 1 diff --git a/ext/spl/tests/dllist_004.phpt b/ext/spl/tests/dllist_004.phpt index 0b20f6eb6a..44d9611fca 100644 --- a/ext/spl/tests/dllist_004.phpt +++ b/ext/spl/tests/dllist_004.phpt @@ -1,7 +1,5 @@ --TEST-- SPL: DoublyLinkedList: Stacks ---INI-- -allow_call_time_pass_reference=1 --FILE-- push($a); -$a = 3; -$stack->push(&$a); -$a = 4; -echo $stack->pop()."\n"; echo $stack->pop()."\n"; // peakable @@ -55,7 +49,6 @@ echo count($stack)."\n"; --EXPECTF-- Exception: Can't pop from an empty datastructure Exception: Can't shift from an empty datastructure -3 2 2 [2] diff --git a/ext/spl/tests/dllist_005.phpt b/ext/spl/tests/dllist_005.phpt index f95cedd1fa..33161ba17d 100644 --- a/ext/spl/tests/dllist_005.phpt +++ b/ext/spl/tests/dllist_005.phpt @@ -1,7 +1,5 @@ --TEST-- SPL: DoublyLinkedList: Queues ---INI-- -allow_call_time_pass_reference=1 --FILE-- enqueue($a); -$a = 3; -$queue->enqueue(&$a); -$a = 4; -echo $queue->dequeue()."\n"; echo $queue->dequeue()."\n"; // peakable @@ -56,7 +50,6 @@ echo count($queue)."\n"; Exception: Can't shift from an empty datastructure Exception: Can't shift from an empty datastructure 2 -3 2 [1] [2] diff --git a/ext/spl/tests/fixedarray_001.phpt b/ext/spl/tests/fixedarray_001.phpt index 39e1bc9f6c..8276333e10 100644 --- a/ext/spl/tests/fixedarray_001.phpt +++ b/ext/spl/tests/fixedarray_001.phpt @@ -1,7 +1,5 @@ --TEST-- SPL: FixedArray: std operations ---INI-- -allow_call_time_pass_reference=1 --FILE-- @@ -68,25 +60,5 @@ array(3) { ["ABC"]=> string(3) "xyz" } - --- $input is an array passed by reference -- -Result: -array(3) { - ["ONE"]=> - int(1) - ["TWO"]=> - int(2) - ["ABC"]=> - string(3) "xyz" -} -Original: -array(3) { - ["one"]=> - int(1) - ["two"]=> - int(2) - ["ABC"]=> - string(3) "xyz" -} Done diff --git a/ext/standard/tests/array/array_key_exists_variation4.phpt b/ext/standard/tests/array/array_key_exists_variation4.phpt index edc39269a5..84dfeb9373 100644 --- a/ext/standard/tests/array/array_key_exists_variation4.phpt +++ b/ext/standard/tests/array/array_key_exists_variation4.phpt @@ -1,7 +1,5 @@ --TEST-- Test array_key_exists() function : usage variations - referenced variables ---INI-- -allow_call_time_pass_reference=on --FILE-- @@ -37,10 +28,4 @@ echo "Done"; -- $search is a reference to $array -- bool(true) - --- $key is a referenced variable -- -bool(true) - --- Both arguments are referenced variables -- -bool(true) Done diff --git a/ext/standard/tests/array/array_merge_variation9.phpt b/ext/standard/tests/array/array_merge_variation9.phpt index e42e292827..69e0401a0e 100644 --- a/ext/standard/tests/array/array_merge_variation9.phpt +++ b/ext/standard/tests/array/array_merge_variation9.phpt @@ -1,7 +1,5 @@ --TEST-- Test array_merge() function : usage variations - referenced variables ---INI-- -allow_call_time_pass_reference=on --FILE-- @@ -101,14 +96,4 @@ array(6) { [2]=> &string(3) "baz" } - --- Merge an array and a reference to the first array -- -array(3) { - ["key1"]=> - string(4) "val1" - ["key2"]=> - string(4) "val2" - ["key3"]=> - string(4) "val3" -} Done diff --git a/ext/standard/tests/array/array_push_variation4.phpt b/ext/standard/tests/array/array_push_variation4.phpt index f8f89042aa..e69de29bb2 100644 --- a/ext/standard/tests/array/array_push_variation4.phpt +++ b/ext/standard/tests/array/array_push_variation4.phpt @@ -1,110 +0,0 @@ ---TEST-- -Test array_push() function : usage variations - referenced variables ---INI-- -allow_call_time_pass_reference=on ---FILE-- - ---EXPECTF-- -*** Testing array_push() : usage variations *** - --- Pass array_push referenced varialbes as $var arguments -- -int(9) -array(9) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - [3]=> - &string(1) "a" - [4]=> - &string(1) "b" - [5]=> - &string(1) "c" - [6]=> - &string(1) "x" - [7]=> - &string(1) "y" - [8]=> - &string(1) "z" -} - --- Pass $var argument which is a reference to $stack argument -- -int(10) -array(10) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - [3]=> - &string(1) "a" - [4]=> - &string(1) "b" - [5]=> - &string(1) "c" - [6]=> - &string(1) "x" - [7]=> - &string(1) "y" - [8]=> - &string(1) "z" - [9]=> - &array(10) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) - [3]=> - &string(1) "a" - [4]=> - &string(1) "b" - [5]=> - &string(1) "c" - [6]=> - &string(1) "x" - [7]=> - &string(1) "y" - [8]=> - &string(1) "z" - [9]=> - *RECURSION* - } -} -Done diff --git a/ext/standard/tests/array/array_slice_variation9.phpt b/ext/standard/tests/array/array_slice_variation9.phpt index 030d4bd73a..7ae9238d47 100644 --- a/ext/standard/tests/array/array_slice_variation9.phpt +++ b/ext/standard/tests/array/array_slice_variation9.phpt @@ -1,7 +1,5 @@ --TEST-- Test array_slice() function : usage variations - referenced variables ---INI-- -allow_call_time_pass_reference=on --FILE-- @@ -55,21 +47,4 @@ array(2) { [1]=> &string(5) "three" } - --- Pass array by reference -- -array(2) { - [0]=> - int(2) - [1]=> - int(3) -} --- Check passed array: -- -array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) -} Done diff --git a/ext/standard/tests/array/array_values_variation6.phpt b/ext/standard/tests/array/array_values_variation6.phpt index e565150760..8c4479ca6f 100644 --- a/ext/standard/tests/array/array_values_variation6.phpt +++ b/ext/standard/tests/array/array_values_variation6.phpt @@ -1,7 +1,5 @@ --TEST-- Test array_values() function : usage variations - Referenced variables ---INI-- -allow_call_time_pass_reference=on --FILE-- @@ -57,14 +51,4 @@ array(3) { [2]=> &string(5) "three" } - --- Pass $input argument by reference -- -array(3) { - [0]=> - int(1) - [1]=> - int(2) - [2]=> - int(3) -} Done diff --git a/ext/standard/tests/array/bug33940.phpt b/ext/standard/tests/array/bug33940.phpt index a6d1ff8358..e69de29bb2 100755 --- a/ext/standard/tests/array/bug33940.phpt +++ b/ext/standard/tests/array/bug33940.phpt @@ -1,63 +0,0 @@ ---TEST-- -Bug #33940 (array_map() fails to pass by reference when called recursively) ---INI-- -allow_call_time_pass_reference=1 -error_reporting=4095 ---FILE-- - ---EXPECTF-- -Array: Array -( - [0] => Array - ( - [0] => 0 - ) - - [1] => 0 -) -Return: Array -( - [0] => Array - ( - [0] => 2 - ) - - [1] => 2 -) -Array: Array -( - [0] => Array - ( - [0] => 1 - ) - - [1] => 1 -) -Return: Array -( - [0] => Array - ( - [0] => 2 - ) - - [1] => 2 -) diff --git a/ext/standard/tests/array/each_variation4.phpt b/ext/standard/tests/array/each_variation4.phpt index 6ac57a736e..535ae297d1 100644 --- a/ext/standard/tests/array/each_variation4.phpt +++ b/ext/standard/tests/array/each_variation4.phpt @@ -1,7 +1,5 @@ --TEST-- Test each() function : usage variations - Referenced variables ---INI-- -allow_call_time_pass_reference=on --FILE-- @@ -66,25 +56,4 @@ array(4) { int(0) } bool(false) - --- Pass an array by reference to each(): -- -array(4) { - [1]=> - string(4) "zero" - ["value"]=> - string(4) "zero" - [0]=> - int(0) - ["key"]=> - int(0) -} --- Check original array: -- -array(3) { - [0]=> - string(4) "zero" - [1]=> - string(3) "one" - [2]=> - string(3) "two" -} Done diff --git a/ext/standard/tests/array/rsort_variation4.phpt b/ext/standard/tests/array/rsort_variation4.phpt index 4cab1a9334..226284d329 100644 --- a/ext/standard/tests/array/rsort_variation4.phpt +++ b/ext/standard/tests/array/rsort_variation4.phpt @@ -1,7 +1,5 @@ --TEST-- Test rsort() function : usage variations - referenced variables ---INI-- -allow_call_time_pass_reference=on --FILE-- --EXPECTF-- @@ -66,15 +59,4 @@ array(3) { [2]=> &int(33) } - --- 'flag' = SORT_NUMERIC -- -bool(true) -array(3) { - [0]=> - &int(555) - [1]=> - &int(100) - [2]=> - &int(33) -} Done diff --git a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt index a01e592628..82ee2a63d5 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_v.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_v.phpt @@ -1,7 +1,5 @@ --TEST-- Test debug_zval_dump() function : usage variations ---INI-- -allow_call_time_pass_reference=1 --FILE--