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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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: Fri Apr 26 04:01:30 2024 UTC