From:             reeze dot xia at gmail dot com
Operating system: 
PHP version:      master-Git-2012-09-02 (Git)
Package:          Scripting Engine problem
Bug Type:         Feature/Change Request
Bug description:Disallow some magic methods been generators

Description:
------------
magic method are called in a special way, if those methods
was defined as generator, most of them will not work as expected.

We could disallow them when compiling.


Test script:
---------------
class A {
     public function __construct(array $data) {
           $this->initData = $data;
           // maybe more initialization...

           var_dump($this->initData);
           foreach$(this->initData as $v) {
               yield $v;
           }
     }
}

$a = new A(array(1, 2)); //  constructor didn't get called.

so does the that magic methods:
http://www.php.net/manual/en/language.oop5.magic.php

most of them are meanning less if they are generators.
*some of them* maybe useful if they return value but not void.


Those could be allowed: __call(), __callStatic(), __get(), __invoke()

but those seems meaningless to be generators
__construct(), __destruct(), __set(), __isset(), __unset(), __sleep(),
__wakeup(), __toString(), __set_state() and __clone(), 



-- 
Edit bug report at https://bugs.php.net/bug.php?id=62994&edit=1
-- 
Try a snapshot (PHP 5.4):            
https://bugs.php.net/fix.php?id=62994&r=trysnapshot54
Try a snapshot (PHP 5.3):            
https://bugs.php.net/fix.php?id=62994&r=trysnapshot53
Try a snapshot (trunk):              
https://bugs.php.net/fix.php?id=62994&r=trysnapshottrunk
Fixed in SVN:                        
https://bugs.php.net/fix.php?id=62994&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=62994&r=needdocs
Fixed in release:                    
https://bugs.php.net/fix.php?id=62994&r=alreadyfixed
Need backtrace:                      
https://bugs.php.net/fix.php?id=62994&r=needtrace
Need Reproduce Script:               
https://bugs.php.net/fix.php?id=62994&r=needscript
Try newer version:                   
https://bugs.php.net/fix.php?id=62994&r=oldversion
Not developer issue:                 
https://bugs.php.net/fix.php?id=62994&r=support
Expected behavior:                   
https://bugs.php.net/fix.php?id=62994&r=notwrong
Not enough info:                     
https://bugs.php.net/fix.php?id=62994&r=notenoughinfo
Submitted twice:                     
https://bugs.php.net/fix.php?id=62994&r=submittedtwice
register_globals:                    
https://bugs.php.net/fix.php?id=62994&r=globals
PHP 4 support discontinued:          
https://bugs.php.net/fix.php?id=62994&r=php4
Daylight Savings:                    https://bugs.php.net/fix.php?id=62994&r=dst
IIS Stability:                       
https://bugs.php.net/fix.php?id=62994&r=isapi
Install GNU Sed:                     
https://bugs.php.net/fix.php?id=62994&r=gnused
Floating point limitations:          
https://bugs.php.net/fix.php?id=62994&r=float
No Zend Extensions:                  
https://bugs.php.net/fix.php?id=62994&r=nozend
MySQL Configuration Error:           
https://bugs.php.net/fix.php?id=62994&r=mysqlcfg

Reply via email to