From:             stas at zend dot com
Operating system: *
PHP version:      5CVS-2007-06-08 (CVS)
PHP Bug Type:     Class/Object related
Bug description:  get_class_vars produces error on class constants

Description:
------------
When class variables refers to a constant of the class using self::,
get_class_vars produces a fatal error. 

Note that the code works if I access the class previously (uncomment
commented lines in reproduction)

Reproduce code:
---------------
<?php
class foo {
        const FOO = 1;
        public $x = self::FOO;
}

//$b = new foo();
//var_dump($b);
var_dump(get_class_vars("foo"));


Expected result:
----------------
array(1) {
  ["x"]=>
  int(1)
}


Actual result:
--------------
Fatal error: Cannot access self:: when no class scope is active in
/root/const2.php on line 9



-- 
Edit bug report at http://bugs.php.net/?id=41640&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=41640&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=41640&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=41640&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=41640&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=41640&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=41640&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=41640&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=41640&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=41640&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=41640&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=41640&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=41640&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=41640&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=41640&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=41640&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=41640&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=41640&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=41640&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=41640&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=41640&r=mysqlcfg

Reply via email to