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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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 12:01:31 2024 UTC