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.

-----------------------
<?php



 class X {
         var $query_row;
         
         function X() {
                   $this->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}<br>";
  echo "classvars:<br>";
  var_dump($classvars);
  echo "<br>query_row_class_vars<br>";
  var_dump($query_row_class_vars);
  
  echo "<br><br>HOW IS THIS POSSIBLE? SEE BELOW!!!!!!!!!";
  echo "<br>user->query_row:<br>";
  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

Reply via email to