reopen 647641
retitle 647641 call-time pass-by-reference notice/error is generated at compile time
tags 647641 + upstream fixed-upstream
close 647641 5.4.0~rc7-1
thanks

Hi Ondřej,

On -28163-01--10 14:59, Ondřej Surý wrote:
Version: 5.3.8-2

This is not a bug. You set the error_reporting = E_ALL after this
message would be printed.

The call is on line 10, after the error_reporting() call on line 6.

ondrej@howl:~$ php -v
PHP 5.3.3-7+squeeze7 with Suhosin-Patch (cli) (built: Feb  2 2012 17:32:55)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies

$ php -c /usr/share/doc/php5-common/examples/php.ini-development
/tmp/callTimeRefNoticeTest.php
PHP Deprecated:  Call-time pass-by-reference has been deprecated; If
you would like to pass it by reference, modify the declaration of
foo().  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 in
/tmp/callTimeRefNoticeTest.php on line 10

Deprecated: Call-time pass-by-reference has been deprecated; If you
would like to pass it by reference, modify the declaration of foo().
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 in
/tmp/callTimeRefNoticeTest.php on line 10
PHP Deprecated:  Function split() is deprecated in
/tmp/callTimeRefNoticeTest.php on line 11

Deprecated: Function split() is deprecated in
/tmp/callTimeRefNoticeTest.php on line 11
DONE

O.


Thanks for that. I re-tested and was able to reproduce your result. I figured out that the bug is not what I thought. The problem is that this is actually a compile-time notice. Therefore, the error_reporting() call has no effect. I am attaching a new version of the script that shows this more clearly. The script does 3 calls, the first at the default error reporting level, one with error reporting disabled and one with error reporting enabled. But as you can see, the notice will actually show 0 or 3 times:

$ php -n callTimeRefNoticeTest.php ;php -n --define 'error_reporting=E_ALL|E_STRICT' --define allow_call_time_pass_reference=Off callTimeRefNoticeTest.php
display_errors = 1
error_reporting =
allow_call_time_pass_reference = 1
Array
(
[type] => 8192
[message] => Function split() is deprecated
[file] => /var/www/callTimeRefNoticeTest.php
[line] => 22
)

Deprecated: Function split() is deprecated in /var/www/callTimeRefNoticeTest.php on line 28

DONE

Deprecated: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of foo(). 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 in /var/www/callTimeRefNoticeTest.php on line 16

Deprecated: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of foo(). 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 in /var/www/callTimeRefNoticeTest.php on line 21

Deprecated: Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of foo(). 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 in /var/www/callTimeRefNoticeTest.php on line 26
Array
(
[type] => 8192
[message] => Call-time pass-by-reference has been deprecated; If you would like to pass it by reference, modify the declaration of foo(). 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
[file] => /var/www/callTimeRefNoticeTest.php
[line] => 26
)
display_errors = 1
error_reporting = 32767
allow_call_time_pass_reference =

Deprecated: Function split() is deprecated in /var/www/callTimeRefNoticeTest.php on line 17
Array
(
[type] => 8192
[message] => Function split() is deprecated
[file] => /var/www/callTimeRefNoticeTest.php
[line] => 22
)

Deprecated: Function split() is deprecated in /var/www/callTimeRefNoticeTest.php on line 28

DONE
chealer@vinci:/var/www$

8192 is E_DEPRECATED: http://ca2.php.net/manual/en/errorfunc.constants.php

As explained in http://www.php.net/manual/en/ini.core.php#ini.allow-call-time-pass-reference E_DEPRECATED is what should happen on PHP 5.3.

I reproduced this on PHP 5.3.8 on Windows, so this is clearly an upstream issue. However, PHP 5.4 should be released very soon, and this problem disappears with it, as call-time passes by reference are now illegal:

Fatal error: Call-time pass-by-reference has been removed; If you would like to 
pass argument by reference, modify the declaration of foo(). in 
/var/www/callTimeRefNoticeTest.php on line 16

Therefore, I am not going to bother forwarding this and am simply marking this as fixed in PHP 5.4.

<<attachment: callTimeRefNoticeTest.php>>

Reply via email to