#39708 [Opn->WFx]: Confusing error message for empty(func())
| From: | tony2001@php.net | Date: | Fri, 01 Dec 2006 18:51:34 +0000 |
| Subject: | #39708 [Opn->WFx]: Confusing error message for empty(func()) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-105778@lists.php.net to get a copy of this message | ||
ID: 39708
Updated by: tony2001@php.net
Reported By: zizka at seznam dot cz
-Status: Open
+Status: Wont fix
-Bug Type: Documentation problem
+Bug Type: Unknown/Other Function
Operating System: All
-PHP Version: Irrelevant
+PHP Version: 6.0.0
New Comment:
The error message is clear enough and is used in all cases when you're
trying to change function's return value, like this:
<?php function foo () { return 1; } foo() = 1; ?>
Previous Comments:
------------------------------------------------------------------------
[2006-12-01 18:37:57] zizka at seznam dot cz
Description:
------------
When calling empty() with a return value from function, it says:
Can't use method return value in write context
It would be definitely less confusing if it said something like:
empty() accepts only variables as a parameter.
Reproduce code:
---------------
<?php
empty(trim(""));
?>
Expected result:
----------------
Fatal error: empty() accepts only variables as a parameter in ... on
line 2
Actual result:
--------------
Fatal error: Can't use method return value in write context in ... on
line 2
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39708&edit=1