Package: php5
Version: 5.2.0-8+etch10
Severity: important

According to a friend, the code below works correctly on PHP 5.2.3 but in the 
current Debian stable distribuion it fails to produce the right result. Note 
that the 
myRuntimeProperty is absent from the second var_dump at the end.

<?php

class Test
{
    public $myDeclaredProperty = 1;

    public function __construct()
    {
        $this->myRuntimeProperty = 2;
    }

    public function getPublicProperties()
    {
        $r = new ReflectionObject($this);
        $properties = $r->getProperties();
        $publicProperties = array();
        foreach ($properties as $property) {
            if ($property->isPublic()) {
                $publicProperties[$property->getName()] = 
$property->getValue($this);
            }
        }
        return $publicProperties;
    }
}
echo 'Running ' . phpversion() . "\n";
$obj = new Test();
echo "Dumping object:\n";
var_dump($obj);
echo "Dumping public properties according to Reflection object\n";
var_dump($obj->getPublicProperties());


My output:

Running 5.2.0-8+etch10
Dumping object:
object(Test)#1 (2) {
  ["myDeclaredProperty"]=>
  int(1)
  ["myRuntimeProperty"]=>
  int(2)
}
Dumping public properties according to Reflection object
array(1) {
  ["myDeclaredProperty"]=>
  int(1)
}


-- System Information:
Debian Release: 4.0
  APT prefers stable
  APT policy: (1001, 'stable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.18-5-amd64
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)

Versions of packages php5 depends on:
ii  libapache2-mod-php5       5.2.0-8+etch10 server-side, HTML-embedded scripti
ii  php5-common               5.2.0-8+etch10 Common files for packages built fr

php5 recommends no packages.

-- no debconf information




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to