Re: print_r unaware of object's read_property handler

From: Date: Thu, 15 Feb 2007 14:02:19 +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-4528@lists.php.net to get a copy of this message
On 02/15/2007 04:54 PM, Piotr Pokora wrote:
HashTable *get_properties(zval *this_ptr TSRMLS_DC) { char *key; HashTable *ht; ALLOC_HASHTABLE(ht); //leaks, search archives FOREACH_KEY(&Z_OBJCE_P(this_ptr)->default_properties, key) { zval *prop = read_property(this_ptr, zval_with_key, 0 TSRMLS_CC); ZVAL_ADDREF(prop); zend_hash_update(ht, key, &prop);
That's a point. I do not update hash because read_property doesn't use &prop.
It doesn't matter what you use in read_property() because you can use the same AND update the properties hash.
It uses only key here. Is it mandatory to call zend_hash_update? It will solve print_r problem but in such case I do not need read_property hook as I ca use standard one which should return value from hash. Piotras
-- Wbr, Antony Dovgal

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