php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #2826 $a->b[$i]->c does not work
Submitted: 1999-11-25 07:05 UTC Modified: 1999-11-25 13:35 UTC
From: svassili at midway dot uchicago dot edu Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0.11 OS: Windows NT Server 4.0
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: svassili at midway dot uchicago dot edu
New email:
PHP Version: OS:

 

 [1999-11-25 07:05 UTC] svassili at midway dot uchicago dot edu
The following script gives parser error on the last line:
___________________________________________________________

class Sample{
   var $b;
   function Sample(){
      $b[] = new Crash;    
   }
}

class Crash{
   var $c; 
}

$a = new Sample;
$a->b[0]->c=1999;
___________________________________________________________

As I understand there is only one way to modify the content of property $a->b[0]->c:
  $temp=$a->b[0];
  $temp->c=1999;
  $a->b[0]=$temp;
But it is too awkward.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-11-25 13:35 UTC] rasmus at cvs dot php dot net
Yes, it is a limitation of the parser in PHP 3.  Fixed in PHP 4.  Your workaround is the solution.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC