From:             
Operating system: Windows XP
PHP version:      5.3.10
Package:          *General Issues
Bug Type:         Bug
Bug description:referencing class during static access using variable doesn't 
work properly

Description:
------------
Documentation says: "As of PHP 5.3.0, it's possible to reference the class
using a variable. The variable's value can not be a keyword (e.g. self,
parent and static)."

It does not say that class variables cannot be used, but trying to do so
will result in the completely nonsensical error for non-hebrew speakers.

referencing the variable that references the class name does work, but it
is a useless line in my code, i don't like it.
        public function foo() {
                $tmp =& $this->bar;
                echo $tmp::$my_static;
        }

Test script:
---------------
<?php 
class Foo {
        public static $my_static = 'foo';
}

class Bar {
        protected $bar; 
        public function __construct() {
                $this->bar = 'Foo';
        }
        public function foo() {
                echo $this->bar::$my_static;
        }
}

$bar = new Bar();
$bar->foo();

Expected result:
----------------
foo

Actual result:
--------------
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM, expecting ','
or ';' in C:\ ... \test.php on line 12

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

Reply via email to