#26724 [Opn]: get_class() and __CLASS__ causing crashes and erratic behaviour

From: Date: Tue, 30 Dec 2003 03:36:03 +0000
Subject: #26724 [Opn]: get_class() and __CLASS__ causing crashes and erratic behaviour
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-52594@lists.php.net to get a copy of this message
ID: 26724 User updated by: thought at phenomind dot com Reported By: thought at phenomind dot com Status: Open Bug Type: Class/Object related Operating System: Windows XP PHP Version: 5CVS-2003-12-26 (dev) New Comment: Okay. I think I may have some snippets of code to demonstrate this: I have defined a two dimensional array like this: $this->composite_object_names[0] = "piece"; $this->composite_object_names[1] = "pod_log"; Yet when I do a print_r on the object, I am getting this: [composite_object_names:public] => Array ( [0] => Diece [1] => Dod_log ) I have numerous instances of get_class() and __CLASS__ scattered throughout my code. I know that if I remove this, the object will be fine. I am also suspicious of the get_object_vars() function but that it is almost impossible for me to quantify which one of these functions is at the root of the problem. There is a bug here Previous Comments: ------------------------------------------------------------------------ [2003-12-26 23:48:51] thought at phenomind dot com Sorry, I cannot but I just removed 500+ instances of get_class() and __CLASS__ from many libraries of code and the problem has disappeared. I'll give you an example of the object where the primary_key property was corrupted. It is fine in this instance because I have already done the abovementioned alterations: user_session Object ( [y_resolution] => [x_resolution] => [flash_version] => [session_identifier] => [timestamp_difference] => [cookies_enabled] => [ip_address] => [browser] => [nominated_transport_agent_key] => [nominated_shipper_key] => [nominated_project_key] => [live_key] => 73 [new_on_load] => [table_name] => user_sessions [composite_object_name] => [composite_key] => [primary_key] => user_session_key [database] => mysql_db Object ( [engine] => mysql [username] => **** [password] => ********* [service_name] => [live_table] => [commit_query] => 0 [tns_admin] => [vars] => vars Object ( [username] => ****** [btn_login] => Login [password] => **** [encoded_php_self] => ) [database_name] => BKCARGO [host] => localhost [port] => 3306 [host_port] => localhost:3306 [database_handle] => Resource id #80 [query] => UPDATE user_sessions SET user_key = '1', transport_agent_key = '', shipper_key = '', project_key = '', y_resolution = '', x_resolution = '', flash_version = '', session_identifier = '', timestamp_difference = '', cookies_enabled = '', ip_address = '', browser = '', live_user_key = '1' WHERE user_session_key='73' [result_handle] => 1 ) [vars] => vars Object ( [username] => ******** [btn_login] => Login [password] => ******* [encoded_php_self] => ***** ) [user_key] => 1 [user_session_key] => 73 [live_user_key] => 1 ) ------------------------------------------------------------------------ [2003-12-26 23:41:25] gschlossnagle@php.net Can you post an example that actually reproduces? A simple class used with your code runs fine on OS X. ------------------------------------------------------------------------ [2003-12-26 23:08:41] thought at phenomind dot com Problems also with get_object_vars() If my script has this function anywhere, PHP5 produces erratic results. ------------------------------------------------------------------------ [2003-12-26 22:34:17] thought at phenomind dot com Description: ------------ Apologise for not being able to describe this better or give example code. get_class() and __CLASS__ cause PHP5 to behave erratically. Sometimes changes the data within the [argument] object and often causes Apache to crash. Problems experienced on Windows XP. Same problem also caused a Dual Processor Mac OS-X box to soak up CPU time 1 processor. Script calls get_class() many, many times or complex, composite objects. The erratic behaviour is very hard to pin down but the source is definitely get_class(). PHP5 objects are not very happy with this function. Reproduce code: --------------- I can say: print_r($object); print get_class($object); print_r($object); Expected result: ---------------- 1) object dump 2) Name of object 3) same object dump Actual result: -------------- 1) object dump 2) Name of object 3) object dump with probably one property changed No other code in the middle to cause this behaviour. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26724&edit=1

« previous php.bugs (#52594) next »