From: [EMAIL PROTECTED]
Operating system: Linux 2.4.
PHP version: 4.2.1
PHP Bug Type: Class/Object related
Bug description: get_class_vars works unexpected
The documentation says that the get_class_vars() method should return an
array only with the properties wich had DEFAULT values already at class
definition. That worked fine with PHP 4.1.2 but it's behavior changed with
PHP 4.2.[0 or 1] because it displays also those properties which has no
default values at definition. I don't really think that this is a bug, but
it seems that there was a change in the function behavior and neither the
changelog nor the documentation mentions a word about this change.
Example - the following script from the docs:
<?php
class myclass {
var $var1; // this has no default value...
var $var2 = "xyz";
var $var3 = 100;
// constructor
function myclass() {
return(true);
}
}
$my_class = new myclass();
$class_vars = get_class_vars(get_class($my_class));
echo "<pre>";
foreach ($class_vars as $name => $value) {
echo "$name : $value\n";
}
echo "</pre>";
?>
should outuput something like this:
var2 : xyz
var3 : 100
but the result in PHP 4.2.1 is:
var1 :
var2 : xyz
var3 : 100
--
Edit bug report at http://bugs.php.net/?id=17537&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=17537&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=17537&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=17537&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=17537&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=17537&r=support
Expected behavior: http://bugs.php.net/fix.php?id=17537&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=17537&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=17537&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=17537&r=globals