Re: print_r unaware of object's read_property handler

From: Date: Thu, 15 Feb 2007 13:52:35 +0000
Subject: Re: print_r unaware of object's read_property handler
References: 1 2 3 4 5 6 7 8 9  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-4526@lists.php.net to get a copy of this message
On 02/15/2007 04:34 PM, Piotr Pokora wrote:
Could you elaborate on this and explain what you mean by "fails"?
"Register" object's properties in constructor ( using add_property_xxxx )
                        case G_TYPE_STRING:
                                add_property_string(zobject,
                                                (gchar*)props[i]->name, "", 1);
                                break;
                        case G_TYPE_UINT:
                        case G_TYPE_INT:
                                add_property_long(zobject,
                                                (gchar*)props[i]->name, 0);
"Registering" properties in constructor? What a strange idea.. Constructor usually constructs fully functional object, properties are declared along with the class itself.
and so on. I do not assign values to properties at this point
That's wrong.
So "fails" means that property's value is not returned by print_r, though read_property hook seems to be ok as <?php echo $object->propA; ?> works fine.
Sure, you didn't add the properties to the hash. -- Wbr, Antony Dovgal

« previous php.pecl.dev (#4526) next »