ID: 40477
User updated by: piotrek dot pokora at gmail dot com
Reported By: piotrek dot pokora at gmail dot com
Status: Bogus
Bug Type: Variables related
Operating System: debian/linux
PHP Version: 5.2.1
New Comment:
>> Is this a list for reporting ZEND bugs?>No, this is a list when I'm ready to explain any question regarding
Zend
>Engine sources to a person who haven't ever heard of respect.
Please, forgive me. But don't you think that documentation privided by
ZEND clearly states:
"read_property - returns zval *, containing the value of the
property. Is used when value of the property should be retrieved for
reading."
It doesn't tell about any exceptions.
I will be more than glad to ask you about such exceptions at pecl-dev
list but unfortunatelly I didn't get any confirmation after using ( few
times ) submit form at http://pecl.php.net/support.php#lists.
If I can not subscribe to this list with this form , please subscribe
me using my mail.
I am looking forward for detailed clarification.
Previous Comments:
------------------------------------------------------------------------
[2007-02-15 09:48:33] tony2001@php.net
>> pecl-dev@lists.php.net> Is this a list for reporting ZEND bugs?
No, this is a list when I'm ready to explain any question regarding
Zend Engine sources to a person who haven't ever heard of respect.
------------------------------------------------------------------------
[2007-02-15 09:36:25] mike@php.net
Stop ranting and grasp the facts.
------------------------------------------------------------------------
[2007-02-15 09:32:19] piotrek dot pokora at gmail dot com
> pecl-dev@lists.php.net
Is this a list for reporting ZEND bugs?
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend.c?revision=1.393&view=markup
function: static void print_hash(HashTable *ht, int indent, zend_bool
is_object TSRMLS_DC)
printing value:
ZEND_PUTS("] => ");
zend_print_zval_r(*tmp, indent+PRINT_ZVAL_INDENT TSRMLS_CC);
ZEND_PUTS("\n");
tmp pointer is not a pointer for a zval returned by ANY
read_property. Neither standard nor user defined one.
If you are going to keep this bug with bogus status, I am going to
submit another one.
Logic and consistency is broken here. And this is absolutely a bug.
Behaviour of this function's part is unchanged since ZEND1 engine.
------------------------------------------------------------------------
[2007-02-15 09:03:05] tony2001@php.net
pecl-dev@lists.php.net
------------------------------------------------------------------------
[2007-02-14 20:51:42] piotrek dot pokora at gmail dot com
OK, let's talk code.
Sources.
GObject and GValue wrappers for a case we talk about:
http://midgard.tigris.org/source/browse/midgard/src/apis/php4/php_midgard_gobject_generic.c?rev=1.5&view=log
midgard_config class constructor and methods:
http://midgard.tigris.org/source/browse/midgard/src/apis/php4/php_midgard_config.c?rev=1.4&view=markup
PAY SPECIAL ATTENTION! There's no get_properties hook function.
PHP code:
$a = new midgard_config();
/* $a has underlying GObject object so properties for this object are
already assigned */
$a->read_file("my_config", TRUE);
print_r($a);
echo $a->dbtype;
Output:
midgard_config Object
(
[__res] => Resource id #8
[dbtype] =>
[database] =>
[dbuser] =>
[dbpass] =>
[host] =>
[blobdir] =>
[logfilename] =>
[schema] =>
[defaultlang] =>
[loglevel] =>
[tablecreate] =>
[tableupdate] =>
[testunit] =>
[midgardusername] =>
[midgardpassword] =>
[authtype] => 0
[pamfile] =>
)
MySQL
Do you see 'MySQL' value in print_r output?
Why then echo $a->dbtype; outputs MySQL? Even if I use standard ( not
defined by me ) get_properties handler??
Because language respect my read_property hook, isn't it.
Do you want similiar code for derived class?
Or maybe you can look at zend_print_zval_r_ex and notice that
print_hash is used for IS_ARRAY and IS_OBJECT value type?
DO YOU SEE read_property hook invoked by print_hash function??
Maybe I misunderstood something here but this is not the fact that
IS_ARRAY != IS_OBJECT and zend_print_zval_r_ex
ignores completely user's read_property hook.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/40477--
Edit this bug report at http://bugs.php.net/?id=40477&edit=1