php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4661 Class variable corruption
Submitted: 2000-05-29 12:50 UTC Modified: 2000-05-29 13:08 UTC
From: Jim dot Moores at quickstone dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.0 Release OS: Redhat 6.1
Private report: No CVE-ID: None
 [2000-05-29 12:50 UTC] Jim dot Moores at quickstone dot com
Hi guys,

I think I've found a nasty bug, at first I thought it was bug #2467, but you claimed to have fixed that last october. I tried upgrading from RC1 to 4.0.0 but it didn't help (and I am sure the upgrade worked becuase phpinfo() reports the new version).  I enclose a short script to demonstrate the problem.  The script should output the same value twice, but when another variable is written to in bewteen echo's, it corrupts the value.  We have had a problem with our compiler, egcs 2.91.66 needing to be run repeatedly on the php-4.0.0 release sources, but I don't think its related..?

Anyway, here it is - it should print "1 1", but instead it prints "1 2".  It also acts differently if you change the name of the constructor function (so it's no longer the constructor), you get a different value, I think).

<?  
  class ProductList {

    var $grp_index;         
    var $name_index;
        	
    /* Constructor */
    function ProductList() {
      $this->$grp_index = 1;  # Yuck!!!
    }
	
    function nextEntry() {
      echo $this->$grp_index;
      echo "<br>";
      $this->$name_index = 2;
      echo $this->$grp_index;
    }
  }
  $pl = new ProductList;
  $pl->nextEntry();
?>

Anything you could do would be greatly appreciated, I'm having real trouble developping with this bug!

Thanks

Jim Moores, Quickstone Systems, UK.

PS. our configuration is just the same as in the quick install guide.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-05-29 13:08 UTC] Jim dot Moores at quickstone dot com
Stupid mistake.  Bug in my code.  Apologies to all.

Jim
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 09:01:28 2024 UTC