Bug #55222 [Ver]: Fatal Error disappears when using paranthesis
Edit report at https://bugs.php.net/bug.php?id=55222edit=1 ID: 55222 User updated by:hanskrentel at yahoo dot de Reported by:hanskrentel at yahoo dot de Summary:Fatal Error disappears when using paranthesis Status: Verified Type: Bug Package:Scripting Engine problem Operating System: Linux PHP Version:5.3.6 Block user comment: N Private report: N New Comment: I assume you want to say that the linked answer explicitly explains the problem. Should we make use of this feature when programming PHP or not? Previous Comments: [2011-07-29 09:56:38] cataphr...@php.net See http://stackoverflow.com/questions/6726589/parentheses-altering-semantics-of-function-call-result/6732876#6732876 [2011-07-27 16:34:24] hanskrentel at yahoo dot de I can only remind again that the first comment from php.net obviously misread this report. I am _missing_ the fatal error. [2011-07-19 08:10:56] hanskrentel at yahoo dot de Actually I'm concerned that reset( (get_array()) ); does _not_ give a fatal error. This contradicts the last comment There's really no way to get around that [getting a fatal error]. Why does it not give a fatal error? There is no variable. [2011-07-18 22:21:36] ahar...@php.net reset() requires a variable that can be passed by reference. There's really no way to get around that, hence the fatal error. [2011-07-17 16:52:26] hanskrentel at yahoo dot de within = without in the description. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55222 -- Edit this bug report at https://bugs.php.net/bug.php?id=55222edit=1
Bug #55222 [Ver]: Fatal Error disappears when using paranthesis
Edit report at https://bugs.php.net/bug.php?id=55222edit=1 ID: 55222 Updated by: cataphr...@php.net Reported by:hanskrentel at yahoo dot de Summary:Fatal Error disappears when using paranthesis Status: Verified Type: Bug Package:Scripting Engine problem Operating System: Linux PHP Version:5.3.6 Block user comment: N Private report: N New Comment: See http://stackoverflow.com/questions/6726589/parentheses-altering-semantics-of-function-call-result/6732876#6732876 Previous Comments: [2011-07-27 16:34:24] hanskrentel at yahoo dot de I can only remind again that the first comment from php.net obviously misread this report. I am _missing_ the fatal error. [2011-07-19 08:10:56] hanskrentel at yahoo dot de Actually I'm concerned that reset( (get_array()) ); does _not_ give a fatal error. This contradicts the last comment There's really no way to get around that [getting a fatal error]. Why does it not give a fatal error? There is no variable. [2011-07-18 22:21:36] ahar...@php.net reset() requires a variable that can be passed by reference. There's really no way to get around that, hence the fatal error. [2011-07-17 16:52:26] hanskrentel at yahoo dot de within = without in the description. [2011-07-17 16:51:34] hanskrentel at yahoo dot de Description: PHP 5.3 is giving me nice, sound FATAL ERRORS when using functions like reset() within a variable. However it looks like that it's not always taken care of that consequentially. I don't even get a strict standards warning even. Test script: --- ?php error_reporting(~0); function get_array() { return Array(1); } function foo() { // return reset( (get_array()?:null) ); // ^Fatal error: Only variables can be passed by reference return reset( (get_array()) ); // ^Only? This one works OK } foo(); Expected result: Fatat error. Actual result: -- All fine. -- Edit this bug report at https://bugs.php.net/bug.php?id=55222edit=1