ID:               46761
 Updated by:       [EMAIL PROTECTED]
 Reported By:      phpbug dot classvars at sub dot noloop dot net
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Linux
 PHP Version:      5.2.7
 New Comment:

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

Yes, now it's consistent. When your use get_class_vars() in that
context, the properties are available to it. No bug here.


Previous Comments:
------------------------------------------------------------------------

[2008-12-05 13:46:03] phpbug dot classvars at sub dot noloop dot net

Description:
------------
PHP 5.2.7 seems to have introduced a regression in get_class_vars();
depending on the calling context protected variables may be included in
the result. 

This looks very similar to bug 45862 (which was closed in August with a
comment saying fix committed to CVS 5.2, 5.3 and HEAD).

This build (built from source from today's release) produces "actual
result":
PHP 5.2.7 (cli) (built: Dec  5 2008 12:39:40) 
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

This build (built from source from 5.2.6 release) produces "expected
result":
PHP 5.2.6 (cli) (built: May 22 2008 10:18:33) 
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies


Reproduce code:
---------------
<?php
  abstract class Absclass {
    protected $v_protected;
    private $v_private;
    protected static function testIt($className) {
      var_dump(get_class_vars($className));
    }
  }

  class Testclass extends Absclass {
    public $v_public_sub;
    public static function init() {
      self::testIt('Testclass');
    }
  }

  $a = new Testclass();
  Testclass::init();
  var_dump(get_class_vars('Testclass'));


Expected result:
----------------
array(1) {
  ["v_public_sub"]=>
  NULL
}
array(1) {
  ["v_public_sub"]=>
  NULL
}


Actual result:
--------------
array(2) {
  ["v_public_sub"]=>
  NULL
  ["v_protected"]=>
  NULL
}
array(1) {
  ["v_public_sub"]=>
  NULL
}



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


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

Reply via email to