#21604 [NEW]: variables can be dynamically added to a class, without it being defined.
From: [EMAIL PROTECTED] Operating system: Windows 2000 Server PHP version: 4.2.3 PHP Bug Type: Zend Engine 2 problem Bug description: variables can be dynamically added to a class, without it being defined. If you run the following script and check the output, you will see the that variable JUNK has been dynamically defined in the class X_Row() by using the statement: $user->query_row->JUNK = "stuff"; This behaviour certainly wasn't what I would expect. --- query_row = new X_Row(); return; } } class X_Row { var $USERNAME; var $PASSWORD; var $CHECKING; function X_Row() { $this->USERNAME = NULL; $this->PASSWORD = NULL; $this->CHECKING = NULL; return; } //end function X_Row } //X_Row $user = new X(); //$user->query_row is of class X_Row //Therefore, the next statement should be valid, //USERNAME has been declared in X_Row $user->query_row->USERNAME = 'mtl'; //But the next statement shouldn't be //because the variable JUNK has not //been declared in the class $user->query_row->JUNK = 'stuff'; $classname = get_class($user->query_row); $classvars = get_class_vars($classname); $query_row_class_vars = array_keys($classvars); echo "classname:{$classname}"; echo "classvars:"; var_dump($classvars); echo "query_row_class_vars"; var_dump($query_row_class_vars); echo "HOW IS THIS POSSIBLE? SEE BELOW!"; echo "user->query_row:"; var_dump($user->query_row); ?> -- Edit bug report at http://bugs.php.net/?id=21604&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=21604&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=21604&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=21604&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=21604&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=21604&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=21604&r=support Expected behavior: http://bugs.php.net/fix.php?id=21604&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=21604&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=21604&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=21604&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21604&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=21604&r=dst IIS Stability: http://bugs.php.net/fix.php?id=21604&r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=21604&r=gnused
#21604 [Opn]: variables can be dynamically added to a class, without it being defined.
ID: 21604 User updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Zend Engine 2 problem Operating System: Windows 2000 Server PHP Version: 4.2.3 New Comment: Can someone from an authority standpoint look into this? If it is a feature, then it is potentially quite dangerous, both from a security standpoint as well as from on operational standpoint. Why bother having class variables at all if that is the case? Previous Comments: [2003-01-15 11:50:06] [EMAIL PROTECTED] This is a "feature", not a bug. I can see good uses for this, my DataObject class uses this feature for dynamically adding instance variables from database records. [2003-01-12 22:46:08] [EMAIL PROTECTED] If you run the following script and check the output, you will see the that variable JUNK has been dynamically defined in the class X_Row() by using the statement: $user->query_row->JUNK = "stuff"; This behaviour certainly wasn't what I would expect. --- query_row = new X_Row(); return; } } class X_Row { var $USERNAME; var $PASSWORD; var $CHECKING; function X_Row() { $this->USERNAME = NULL; $this->PASSWORD = NULL; $this->CHECKING = NULL; return; } //end function X_Row } //X_Row $user = new X(); //$user->query_row is of class X_Row //Therefore, the next statement should be valid, //USERNAME has been declared in X_Row $user->query_row->USERNAME = 'mtl'; //But the next statement shouldn't be //because the variable JUNK has not //been declared in the class $user->query_row->JUNK = 'stuff'; $classname = get_class($user->query_row); $classvars = get_class_vars($classname); $query_row_class_vars = array_keys($classvars); echo "classname:{$classname}"; echo "classvars:"; var_dump($classvars); echo "query_row_class_vars"; var_dump($query_row_class_vars); echo "HOW IS THIS POSSIBLE? SEE BELOW!"; echo "user->query_row:"; var_dump($user->query_row); ?> -- Edit this bug report at http://bugs.php.net/?id=21604&edit=1
#20496 [NEW]: 4.3.0RC1 Windows Binaries doesn't come with Pear
From: [EMAIL PROTECTED] Operating system: WIN 2000 PHP version: 4.3.0RC1 PHP Bug Type: *Compile Issues Bug description: 4.3.0RC1 Windows Binaries doesn't come with Pear I noticed that Pear is in the Windows Tar file, but when I downloaded the 4.3.0RC1 Windows Binaries, Pear doesn't seem to be included. Please resolve so the world doesn't have to re-compile. Thanks. -- Edit bug report at http://bugs.php.net/?id=20496&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=20496&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=20496&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=20496&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=20496&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=20496&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=20496&r=support Expected behavior: http://bugs.php.net/fix.php?id=20496&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=20496&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=20496&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=20496&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20496&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=20496&r=dst IIS Stability: http://bugs.php.net/fix.php?id=20496&r=isapi
#20525 [NEW]: variable references not working correctly
From: [EMAIL PROTECTED] Operating system: Windows 2000 PHP version: 4.2.3 PHP Bug Type: Variables related Bug description: variable references not working correctly The variable reference is not working as I would understand it should. The example that follows is long, but just cut and paste then read the output. Years of "C" programming says this should work. Try example first then, look for the following lines in the code: //*NOTEJUST DELETE THE & symbol TO MAKE WORK and remove the & symbol to see the correct output. CODE STARTS HERE ** "; print_r($call); if ( is_array($call)) { reset($call); } echo ""; } function test() { //new instantiated array in memory $local_c_list = array(); //array indicies for $i = 0; $j = 0; //array indicies for $x (see below) $k = 0; $x = array(0 => array(0 => "A_First", 1 => "B_First", 2 => 1), 1 => array(0 => "A_First", 1 => "B_Second", 2 => 2), 2 => array(0 => "A_First", 1 => "B_Third",2 => 3), 3 => array(0 => "A_Second",1 => "B_First",2 => 1), 4 => array(0 => "A_Second",1 => "B_Second",2 => 2), 5 => array(0 => "A_Second",1 => "B_Third",2 => 3) ); //loop through in array of x, e.g. x[0][$l] for ($k = 0; $k < 6; $k = $k + 1) { $b_name = $x[$k][0]; $a_name = $x[$k][1]; $a_order = $x[$k][2]; if ((!isset($b)) || (!isset($b->name)) || ($b_name != $b->name)) { //attach the A record to the main list // starting on the second A record found if (isset($b->name)) { //set the local_list to the reference of b //this avoids memory copies //*NOTEJUST DELETE THE & symbol TO MAKE WORK $local_c_list[$i] = &$b; $i = $i + 1; $j = 0; } $b = new B(); $b->name = $b_name; $b->list_array = array(); $this->print_test($b,"An element"); } //end if no B exists or we are beginning another B name //Create new A record $a = new A(); $a->name = $a_name; $a->order = $a_order; $this->print_test($a,"An item"); //Set $b->list_array[$a->order] = &$a -- the reference of $a //*NOTEJUST DELETE THE & symbol TO MAKE WORK $b->list_array[$j] = &$a; $j = $j + 1; $this->print_test($b,"A list"); } //end for k loops $this->c_list = $local_c_list; return; } //end test } //end class $the_list = new C_LIST(); $the_list->test(); $the_list->print_test($the_list,"Test"); ?> -- Edit bug report at http://bugs.php.net/?id=20525&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=20525&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=20525&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=20525&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=20525&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=20525&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=20525&r=support Expected behavior: http://bugs.php.net/fix.php?id=20525&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=20525&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=20525&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=20525&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=20525&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=20525&r=dst IIS Stability: http://bugs.php.net/fix.php?id=20525&r=isapi
#20525 [Com]: variable references not working correctly
ID: 20525 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Feedback Bug Type: Variables related Operating System: Windows 2000 PHP Version: 4.2.3 New Comment: Script was already included. Just cut and paste the PHP code into a text editor and save. Then run. The script will cycle through and array, building objects out of the array. It dumps the values of the objects at certain steps. You will see the difference if you follow the instructions below. Run Script once and look at output. You will notice that the dump of the B class will contain repeat elements (actually, it seems to contain only the last element of the array that was visited). Edit Script, deleting the & symbol where I have placed a comment (***NOTE). Run Script and look at output. You will see the output is as you would expect. Thanks. If you need more info, you can go to my website www.goldparrot.com and get my contact information to call me. Thanks again. Previous Comments: [2002-11-21 02:40:36] [EMAIL PROTECTED] can you please submit a short script along with some explaination what it does, what not and what it should do in your opinion. Also make sure you have read http://www.php.net/manual/en/language.references.php and notice that the & works slightly different than in C. [2002-11-20 17:55:08] [EMAIL PROTECTED] The variable reference is not working as I would understand it should. The example that follows is long, but just cut and paste then read the output. Years of "C" programming says this should work. Try example first then, look for the following lines in the code: //*NOTEJUST DELETE THE & symbol TO MAKE WORK and remove the & symbol to see the correct output. CODE STARTS HERE ** "; print_r($call); if ( is_array($call)) { reset($call); } echo ""; } function test() { //new instantiated array in memory $local_c_list = array(); //array indicies for $i = 0; $j = 0; //array indicies for $x (see below) $k = 0; $x = array(0 => array(0 => "A_First", 1 => "B_First", 2 => 1), 1 => array(0 => "A_First", 1 => "B_Second", 2 => 2), 2 => array(0 => "A_First", 1 => "B_Third",2 => 3), 3 => array(0 => "A_Second",1 => "B_First",2 => 1), 4 => array(0 => "A_Second",1 => "B_Second",2 => 2), 5 => array(0 => "A_Second",1 => "B_Third",2 => 3) ); //loop through in array of x, e.g. x[0][$l] for ($k = 0; $k < 6; $k = $k + 1) { $b_name = $x[$k][0]; $a_name = $x[$k][1]; $a_order = $x[$k][2]; if ((!isset($b)) || (!isset($b->name)) || ($b_name != $b->name)) { //attach the A record to the main list // starting on the second A record found if (isset($b->name)) { //set the local_list to the reference of b //this avoids memory copies //*NOTEJUST DELETE THE & symbol TO MAKE WORK $local_c_list[$i] = &$b; $i = $i + 1; $j = 0; } $b = new B(); $b->name = $b_name; $b->list_array = array(); $this->print_test($b,"An element"); } //end if no B exists or we are beginning another B name //Create new A record $a = new A(); $a->name = $a_name; $a->order = $a_order; $this->print_test($a,"An item"); //Set $b->list_array[$a->order] = &$a -- the reference of $a //*NOTEJUST DELETE THE & symbol TO MAKE WORK $b->list_array[$j] = &$a; $j = $j + 1; $this->print_test($b,"A list"); } //end for k loops $this->c_list = $local_c_list; return; } //end test } //end class $the_list = new C_LIST(); $the_list->test(); $the_list->print_test($the_list,"Test"); ?> -- Edit this bug report at http://bugs.php.net/?id=20525&edit=1
#20525 [Com]: variable references not working correctly
ID: 20525 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Feedback Bug Type: Variables related Operating System: Windows 2000 PHP Version: 4.2.3 New Comment: I don't want to sound rude, but just run the script as is and you will see the problem. This is about as short as I want to get the script so that you see the problem in depth. It will take you no amount of time to cut and paste the section into a new doc and run it. The difference in output will be self explanatory. So if you would,.just run the script provided. Previous Comments: [2002-11-21 09:59:11] [EMAIL PROTECTED] Hey, I should have emphesized on 'short', currently I just don't have the passion to go through that code in depth without you showing that you have read the docs. And please come up with a short, self-contained, easy to read and unterstand script, thanks a lot for your interest in PHP! -- Jan [2002-11-21 09:46:28] [EMAIL PROTECTED] Script was already included. Just cut and paste the PHP code into a text editor and save. Then run. The script will cycle through and array, building objects out of the array. It dumps the values of the objects at certain steps. You will see the difference if you follow the instructions below. Run Script once and look at output. You will notice that the dump of the B class will contain repeat elements (actually, it seems to contain only the last element of the array that was visited). Edit Script, deleting the & symbol where I have placed a comment (***NOTE). Run Script and look at output. You will see the output is as you would expect. Thanks. If you need more info, you can go to my website www.goldparrot.com and get my contact information to call me. Thanks again. [2002-11-21 02:40:36] [EMAIL PROTECTED] can you please submit a short script along with some explaination what it does, what not and what it should do in your opinion. Also make sure you have read http://www.php.net/manual/en/language.references.php and notice that the & works slightly different than in C. [2002-11-20 17:55:08] [EMAIL PROTECTED] The variable reference is not working as I would understand it should. The example that follows is long, but just cut and paste then read the output. Years of "C" programming says this should work. Try example first then, look for the following lines in the code: //*NOTEJUST DELETE THE & symbol TO MAKE WORK and remove the & symbol to see the correct output. CODE STARTS HERE ** "; print_r($call); if ( is_array($call)) { reset($call); } echo ""; } function test() { //new instantiated array in memory $local_c_list = array(); //array indicies for $i = 0; $j = 0; //array indicies for $x (see below) $k = 0; $x = array(0 => array(0 => "A_First", 1 => "B_First", 2 => 1), 1 => array(0 => "A_First", 1 => "B_Second", 2 => 2), 2 => array(0 => "A_First", 1 => "B_Third",2 => 3), 3 => array(0 => "A_Second",1 => "B_First",2 => 1), 4 => array(0 => "A_Second",1 => "B_Second",2 => 2), 5 => array(0 => "A_Second",1 => "B_Third",2 => 3) ); //loop through in array of x, e.g. x[0][$l] for ($k = 0; $k < 6; $k = $k + 1) { $b_name = $x[$k][0]; $a_name = $x[$k][1]; $a_order = $x[$k][2]; if ((!isset($b)) || (!isset($b->name)) || ($b_name != $b->name)) { //attach the A record to the main list // starting on the second A record found if (isset($b->name)) { //set the local_list to the reference of b //this avoids memory copies //*NOTEJUST DELETE THE & symbol TO MAKE WORK $local_c_list[$i] = &$b; $i = $i + 1; $j = 0; } $b = new B(); $b->name = $b_name; $b->list_array = array(); $this->print_test($b,"An element"); } //end if no B exists or we are beginning another B name //Create new A reco
#20525 [Com]: variable references not working correctly
ID: 20525 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Feedback Bug Type: Variables related Operating System: Windows 2000 PHP Version: 4.2.3 New Comment: Also, please look at output from bottom up. This will make it easier to understand what is happening. If you want less output, just comment out the "print_test" functions. I am included the last set of lines from the output and have noted the differences between runs with You will notice that in the proper code, the B_FIRST, B_SECOND and B_THIRD objects are stored properly. In the code using the & reference symbol, only the B_THIRD object is stored. It is stored three seperate times. The proper result should be : Test: c_list Object ( [c_list] => Array ( [0] => b Object ( [name] => A_First [list_array] => Array ( [0] => a Object ( [name] => B_First [order] => 1 ) [1] => a Object ( [name] => B_Second [order] => 2 ) [2] => a Object ( [name] => B_Third [order] => 3 ) Output from BAD calls using the & reference symbol will look like this: c_list Object ( [c_list] => Array ( [0] => b Object ( [name] => A_Second [list_array] => Array ( [0] => a Object ( [name] => B_Third [order] => 3 ) [1] => a Object ( [name] => B_Third [order] => 3 ) [2] => a Object ( [name] => B_Third [order] => 3 ) Hope this discussion is alieviates some of your time crunch. Thanks for those of us who depend on PHP for our businesses. Previous Comments: [2002-11-22 10:31:43] [EMAIL PROTECTED] I don't want to sound rude, but just run the script as is and you will see the problem. This is about as short as I want to get the script so that you see the problem in depth. It will take you no amount of time to cut and paste the section into a new doc and run it. The difference in output will be self explanatory. So if you would,.just run the script provided. [2002-11-21 09:59:11] [EMAIL PROTECTED] Hey, I should have emphesized on 'short', currently I just don't have the passion to go through that code in depth without you showing that you have read the docs. And please come up with a short, self-contained, easy to read and unterstand script, thanks a lot for your interest in PHP! -- Jan [2002-11-21 09:46:28] [EMAIL PROTECTED] Script was already included. Just cut and paste the PHP code into a text editor and save. Then run. The script will cycle through and array, building objects out of the array. It dumps the values of the objects at certain steps. You will see the difference if you follow the instructions below. Run Script once and look at output. You will notice that the dump of the B class will contain repeat elements (actually, it seems to contain only the last element of the array that was visited). Edit Script, deleting the & symbol where I have placed a comment (***NOTE). Run Script and look at output. You will see the output is as you would expect. Thanks. If you need more info, you can go to my website www.goldparrot.com and get my contact information to call me. Thanks again. [2002-11-21 02:40:36] [EMAIL PROTECTED] can you please submit a short script along with some explaination what it does, what not and what it should do in your opinion. Also make sure you have read http://www.php.net/manual/en/language.references.php and notice that the & works slightl
#21418 [NEW]: Changing PEAR::DB
From: [EMAIL PROTECTED] Operating system: PHP version: 4.2.3 PHP Bug Type: Feature/Change Request Bug description: Changing PEAR::DB I am justing getting into working with the PEAR::DB and DB_DataObjects code. I have some changes that I am making to PEAR::DB and would like to know who to talk to or how I should submit those changes. The following is what I am changing: In PEAR::DB common.php file: Added an new option to the $options array: 'setPrefetch' => 1 For advanced Oracle queries, you use the OCI8setPrefetch limit to > 1. Other databases might find this useful for processing large queries if supported by the database type. Secondly, in PEAR::DB DB.php I am adding a fetchStatement routine to DB_result class that supports limiting and the rownum feature. This then calls the appropriate $this->dbh->fetchStatement() routine. There are others as well, adding a static variable to numCols and numRows so that fetchStatement can load these variables, while fetchInto and fetchRow stills functions as expected. In DB_oci8, changed constructor to use OCI8setPrefetch based upon the $this->option["setPrefetch"] Created an OCI8setPrefetch function so that it can be called specifically/dynamically when the option changes. Currently the change only is reflected in new DB objects after setOptions is called. As mentioned, changed numRows/numCols also in DB_oci8. Adding DB_AUTOQUERY_DELETE to buildManipSQL. Other changes, I am adding. Get number of rows for table in tableInfo for oci8. Can use statistics from the table or use COUNT(*) - I will be doing this shortly. I am doing a very large project with PEAR::DB and DB_DataObjects using Oracle to start, with versions running on mysql, mssql, potentially access, db2, Sybase, etc. In doing so, I have created an offshoot of DB_Dataobjects that will fully sustain many Databases in the same fashion as PEAR::DB. Alan and I have already talked about it. But I am just informing the community. How can I submit the changes to the PEAR::DB code. -- Edit bug report at http://bugs.php.net/?id=21418&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=21418&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=21418&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=21418&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=21418&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=21418&r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=21418&r=support Expected behavior: http://bugs.php.net/fix.php?id=21418&r=notwrong Not enough info:http://bugs.php.net/fix.php?id=21418&r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=21418&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=21418&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21418&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=21418&r=dst IIS Stability: http://bugs.php.net/fix.php?id=21418&r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=21418&r=gnused