php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28874 Parse error in "if (!empty($this->MyFunction())) echo 'Some one';"
Submitted: 2004-06-21 21:01 UTC Modified: 2004-06-29 18:02 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: leadaxe at yandex dot ru Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.3.7 OS: Win XP
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: leadaxe at yandex dot ru
New email:
PHP Version: OS:

 

 [2004-06-21 21:01 UTC] 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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-29 18:02 UTC] iliaa@php.net
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. 
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 12:01:36 2025 UTC