Edit report at http://bugs.php.net/bug.php?id=54186&edit=1

 ID:                 54186
 User updated by:    james at jamesreno dot com
 Reported by:        james at jamesreno dot com
 Summary:            Scope Resolution / Closure Class Issues
 Status:             Bogus
 Type:               Bug
 Package:            Class/Object related
 Operating System:   Linux-2.6
 PHP Version:        5.3.5
 Block user comment: N
 Private report:     N

 New Comment:

"the other is a mere grammatical issue."  Would you care to explain?



To me these features seem half implemented which mean they are bugs --
not 

feature requests. The language already supports said items just not in
"certain 

contexts" (To which should be noted in documentation, at very least). 
At least 

change this to a documentation bug - do not close it as "bogus" the bug
is 

clearly NOT bogus as it indeed is real and does affect the language and
usage 

there-of -- "WONT FIX" is more like it.



Anyone can close bugs as bogus and put some b.s. response. I spent the
time to 

detail out the issue and document it clearly it would be nice if you
could at 

least spend the same effort responding to it.


Previous Comments:
------------------------------------------------------------------------
[2011-03-09 11:10:43] [email protected]

$a->callback(); not working a problem of executing callbacks in fields
not being supported (there's a RFC proposing that), the other is a mere
grammatical issue.



Closing; if anything this would be a feature request, but in that case
the two issues ought to be filled separately, as they're unrelated.

------------------------------------------------------------------------
[2011-03-07 20:59:11] james at jamesreno dot com

Description:
------------
closure objects which are members of another object can not be executed
without 

temp intermediary variables and constants of objects can not be accessed
when 

they are members of another object.



I can not find any documentation to support why these two items throw
syntax 

errors rather than executing as expected. At very least case this is a 

documentation issue and should be noted.

Test script:
---------------
<?



class apples {

 const test = "This is a test";

}



class test {

 public $callback = FALSE;

 public $test = FALSE;



 function __construct($callback) {

        $this->callback = $callback;

        $this->test = new apples();

 }

}





$a = new test(function(){

        echo "test\n";

});



/*

 * Broken Closure Class Example

 */



// BROKEN:

$a->callback();



// Works

$tmp = $a->callback;

$tmp();



/*

 * Broken constant scope resolution

 */



// BROKEN:

$a->test::test;



// Works

$tmp = $a->test;

echo $tmp::test;



?>

Expected result:
----------------
Would expect:



$a->callback() to execute the anonymous function.



would expect:

echo $a->test::test to echo "This is a test"

Actual result:
--------------
Both references cause syntax errors.


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=54186&edit=1

Reply via email to