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:
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.
Previous Comments:
------------------------------------------------------------------------
[2007-02-14 17:20:07] tony2001@php.net
>A feature?
A total misunderstanding on your side.
>Why function which prints object's properties doesn't use>its read_property hook handler?
Yes. Just re-read your question.
"Why a function which prints ALL the properties does not use
read_property()?"
read_property() requires "property_name" argument.
Care to imagine where it should be taken from? Out of your mind?
That's why get_properties() exist - it returns the hashtable with ALL
object properties.
>Again , for clarification.>What is read_property handler hook for?
To read a property specifed by the GIVEN NAME.
>For me it's obvious that it's a bug when implementation >uses user's hook _almost_ always instead of always.
For me it's obvious that you misunderstand the whole concept.
Please STOP using this bug tracking system as a forum for your
questions, use the mailing list instead.
------------------------------------------------------------------------
[2007-02-14 17:06:41] piotrek dot pokora at gmail dot com
> There is not bug
A feature?
>and I asked you to discuss issues rising in custom PHP
extensions in pecl-dev@lists.php.net.
What should I ask for at pecl-dev@lists.php.net?
Why function which prints object's properties doesn't use its
read_property hook handler?
Again , for clarification.
What is read_property handler hook for?
I think you should :
Close this bug and I will open another one.
or
Clarify why it's not a bug.
For me it's obvious that it's a bug when implementation uses user's
hook _almost_ always instead of always.
Or object is no longer an object when passed to print_r or var_dump?
Do you want to tell me that Zend provides possibility to register own
hooks but it's OK when sometimes it's not used for user defined code?
------------------------------------------------------------------------
[2007-02-14 16:38:32] tony2001@php.net
There is not bug and I asked you to discuss issues rising in custom PHP
extensions in pecl-dev@lists.php.net.
Please subscribe to this list and lets discuss it there.
------------------------------------------------------------------------
[2007-02-14 16:10:18] piotrek dot pokora at gmail dot com
Sorry, changed summary by accident.
------------------------------------------------------------------------
[2007-02-14 16:08:03] piotrek dot pokora at gmail dot com
> Again, please use pecl-dev, this is not a forum.http://pecl.php.net/bugs/ points directly to bugs.php.net.
So I think I am at correct bugtracker.
------------------------------------------------------------------------
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