#28874 [Opn->Bgs]: Parse error in "if (!empty($this->MyFunction())) echo 'Some one';"
| From: | iliaa@php.net | Date: | Tue, 29 Jun 2004 16:02:49 +0000 |
| Subject: | #28874 [Opn->Bgs]: Parse error in "if (!empty($this->MyFunction())) echo 'Some one';" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61502@lists.php.net to get a copy of this message | ||
ID: 28874
Updated by: iliaa@php.net
Reported By: leadaxe at yandex dot ru
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Win XP
PHP Version: 4.3.7
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
isset and empty are language constructs that can only work
with variables and cannot work with return values of
functions or methods.
Previous Comments:
------------------------------------------------------------------------
[2004-06-21 21:01:14] leadaxe at yandex dot ru
Description:
------------
sorry, that this is repeat.
It is as #18274, #8702 bags and we wont solution this problem.
We wont use this construction becouse this have common sense.
We wont use result as argument if it possible.
I create same object and use in metod this code, but it create error.
class MyClass {
function Some_One_Function() {
if (!empty($this->MyFunction())) echo 'Some one';
//this error?
}
function MyFunction() { return true;}
}
But in all changes I very like PHP. Thank you for all.
Reproduce code:
---------------
class MyClass {
function Some_One_Function() {
if (!empty($this->MyFunction())) echo 'Some one';
//this error?
}
function MyFunction() { return true;}
}
Expected result:
----------------
Parse error: parse error, unexpected '(', expecting ')' in ...
And I now use:
class MyClass {
function Some_One_Function() {
$em=empty($this->MyFunction();
if (!$em)) echo 'Some one';
}
function MyFunction() { return true;}
}
But it isn't logic!
Actual result:
--------------
I think, that if it worked, it would be very convenient.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28874&edit=1