php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5405 copying objects
Submitted: 2000-07-06 16:01 UTC Modified: 2000-07-08 01:04 UTC
From: zork at clan dot pl Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.1pl2 OS: Linux (Slackware 7.0)
Private report: No CVE-ID: None
 [2000-07-06 16:01 UTC] zork at clan dot pl
Sample program:
<?
class Cvisit {
  var $status;
};

class Cdaydesc {
  var $visits = array();
  var $checked = 0;

  function setvisittime() {
    for($i = 0; $i < count($this -> visits); $i++) {
      if ($this -> visits[$i] -> status == 6) {
        $this -> visits[$i] -> status = 3;
      };
    };
  }

  function addvisit($visit) {
      $this -> visits[] = $visit;
  }
};


$visit = new Cvisit();
$visit -> status = 6;

$newday = new Cdaydesc();
$newday -> addvisit($visit);

$t = $newday;

$t -> setvisittime();
echo $newday -> visits[0] -> status;

exit();
?>

It shows '3' instead of expected '6'.

I think it is a bug.

--
?ukasz Michalski
zork@clan.pl

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-07 19:46 UTC] stas at cvs dot php dot net
Seems to be a bug in Zend. It'll be fixed sometime soon.
 [2000-07-08 01:04 UTC] andi at cvs dot php dot net
Wow, that was a hard one to fix.
Please try the latest CVS if you can.
I have commited a fix but we'll need to evaluate its stability over the next few days.
Thanks!
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sun Oct 11 03:00:02 2026 UTC