|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-02-04 10:43 UTC] nikic@php.net
-Status: Open
+Status: Not a bug
-Package: PHP Language Specification
+Package: Scripting Engine problem
[2020-02-04 10:43 UTC] nikic@php.net
[2020-02-04 13:19 UTC] skullnobrains at gmail dot com
[2020-02-04 13:25 UTC] nikic@php.net
[2020-02-04 13:28 UTC] skullnobrains at gmail dot com
[2020-02-04 20:42 UTC] a at b dot c dot de
[2020-02-05 11:43 UTC] skullnobrains at gmail dot com
[2020-02-05 11:45 UTC] skullnobrains at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 23:00:01 2025 UTC |
Description: ------------ creating a variable on the fly and passing it by reference produces a run-time notice which is inconsistent with the actual behavior, since it does work and the notice is not a deprecation. passing a value produces a compile-time fatal error both messages are hardly distinguishable i picked the php version at random but all php7 versions and possibly 6 are concerned Test script: --------------- $sock=stream_socket_client('tcp://www.php.net:80') or die(); $num=stream_select($R=array(),$W=array($sock),$O=array(),1) or die("selected : ".var_export($num,true)); var_dump($W); ------ $sock=stream_socket_client('tcp://www.php.net:80') or die(); $W=array($sock); $num=stream_select(null,$W,null,1) or die("selected : ".var_export($num,true)); var_dump($W); Expected result: ---------------- first script should just work : i am passing variables, not values. second script : i'd rather it worked ( preferably with the previous explicit, convenient, and backwards compatible '&$whatever' syntax ) but unfortunately can't file the behavior as a bug. Actual result: -------------- PHP Notice: Only variables should be passed by reference in /home/alex/bugreport.php on line 4 PHP Notice: Only variables should be passed by reference in /home/alex/bugreport.php on line 4 PHP Notice: Only variables should be passed by reference in /home/alex/bugreport.php on line 4 array(1) { [0]=> resource(5) of type (stream) } ------------------ PHP Fatal error: Only variables can be passed by reference in /home/alex/bugreport.php on line 7