#39708 [WFx]: Confusing error message for empty(func())
| From: | zizka at seznam dot cz | Date: | Wed, 20 Dec 2006 14:54:41 +0000 |
| Subject: | #39708 [WFx]: Confusing error message for empty(func()) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-106651@lists.php.net to get a copy of this message | ||
ID: 39708
User updated by: zizka at seznam dot cz
Reported By: zizka at seznam dot cz
Status: Wont fix
Bug Type: Unknown/Other Function
Operating System: All
PHP Version: 6.0.0
New Comment:
But this is not the case: I am not trying to change function's return
value; empty() is not supposed to write anything, it just examines the
variables. So here is the confusion.
Previous Comments:
------------------------------------------------------------------------
[2006-12-01 18:51:33] tony2001@php.net
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; ?>
------------------------------------------------------------------------
[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