allow_call_time_pass_reference

From: Date: Thu, 08 May 2008 19:28:43 +0000
Subject: allow_call_time_pass_reference
Groups: php.internals 
Request: Send a blank email to internals+get-37546@lists.php.net to get a copy of this message
Hi all, Following a long and fairly embarrassing exchange of views with one of my php|architect authors, I finally discovered that allow_call_time_pass_reference is still on by default in PHP_5_3 (d'oh). This makes no sense to me because: - it throws an E_DEPRECATED warning, which nobody will see during development because - it's a PHP_INI_SYSTEM|PHP_INI_PERDIR setting that is switched on by default and - on production sites, where it should be switched off, E_DEPRECATED is fairly likely to go unreported - we've been advising people to switch it off for over 8 years Does anyone have a good reason for keeping it switched on by default in PHP 5.3? Like, would switching it off by default break a lot of existing code, given that most users are a bit beyond PHP 3 now? If not, there's a trivial patch attached for main.c and both php.ini-* files. As an aside, by-ref is actually faster than by-value under Windows in my tests, for small amounts of data. That was what you might call an unexpected result - it definitely isn't the case under *nix, or with very large arrays. - Steph

Index: php.ini-dist =================================================================== RCS file: /repository/php-src/php.ini-dist,v retrieving revision 1.231.2.10.2.22.2.6 diff -u -r1.231.2.10.2.22.2.6 php.ini-dist --- php.ini-dist 7 Apr 2008 21:24:04 -0000 1.231.2.10.2.22.2.6 +++ php.ini-dist 8 May 2008 18:45:44 -0000 @@ -164,12 +164,12 @@ ; at function call time. This method is deprecated and is likely to be ; unsupported in future versions of PHP/Zend. The encouraged method of ; specifying which arguments should be passed by reference is in the function -; declaration. You're encouraged to try and turn this option Off and make +; declaration. You're encouraged to try and keep this option Off and make ; sure your scripts work properly with it in order to ensure they will work ; with future versions of the language (you will receive a warning each time ; you use this feature, and the argument will be passed by value instead of by ; reference). -allow_call_time_pass_reference = On +allow_call_time_pass_reference = Off ; ; Safe Mode Index: php.ini-recommended =================================================================== RCS file: /repository/php-src/php.ini-recommended,v retrieving revision 1.179.2.11.2.23.2.6 diff -u -r1.179.2.11.2.23.2.6 php.ini-recommended --- php.ini-recommended 7 Apr 2008 21:24:04 -0000 1.179.2.11.2.23.2.6 +++ php.ini-recommended 8 May 2008 18:46:09 -0000 @@ -104,10 +104,6 @@ ; are emitted for non-critical errors, but that could be a symptom of a bigger ; problem. Most notably, this will cause error messages about the use ; of uninitialized variables to be displayed. -; - allow_call_time_pass_reference = Off [Code cleanliness] -; It's not possible to decide to force a variable to be passed by reference -; when calling a function. The PHP 4 style to do this is by making the -; function require the relevant argument by reference. ; - short_open_tag = Off [Portability] ; Using short tags is discouraged when developing code meant for redistribution ; since short tags may not be supported on the target server. @@ -213,7 +209,7 @@ ; at function call time. This method is deprecated and is likely to be ; unsupported in future versions of PHP/Zend. The encouraged method of ; specifying which arguments should be passed by reference is in the function -; declaration. You're encouraged to try and turn this option Off and make +; declaration. You're encouraged to try and keep this option Off and make ; sure your scripts work properly with it in order to ensure they will work ; with future versions of the language (you will receive a warning each time ; you use this feature, and the argument will be passed by value instead of by Index: main/main.c =================================================================== RCS file: /repository/php-src/main/main.c,v retrieving revision 1.640.2.23.2.57.2.21 diff -u -r1.640.2.23.2.57.2.21 main.c --- main/main.c 22 Mar 2008 12:56:16 -0000 1.640.2.23.2.57.2.21 +++ main/main.c 8 May 2008 18:46:21 -0000 @@ -370,7 +370,7 @@ PHP_INI_ENTRY_EX("highlight.keyword", HL_KEYWORD_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) PHP_INI_ENTRY_EX("highlight.string", HL_STRING_COLOR, PHP_INI_ALL, NULL, php_ini_color_displayer_cb) - STD_PHP_INI_BOOLEAN("allow_call_time_pass_reference", "1", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, allow_call_time_pass_reference, zend_compiler_globals, compiler_globals) + STD_PHP_INI_BOOLEAN("allow_call_time_pass_reference", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, allow_call_time_pass_reference, zend_compiler_globals, compiler_globals) STD_PHP_INI_BOOLEAN("asp_tags", "0", PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateBool, asp_tags, zend_compiler_globals, compiler_globals) STD_PHP_INI_ENTRY_EX("display_errors", "1", PHP_INI_ALL, OnUpdateDisplayErrors, display_errors, php_core_globals, core_globals, display_errors_mode) STD_PHP_INI_BOOLEAN("display_startup_errors", "0", PHP_INI_ALL, OnUpdateBool, display_startup_errors, php_core_globals, core_globals)
« previous php.internals (#37546) next »