php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7330 variable resolution in double quoted strings doesn't like a hierarchy of object
Submitted: 2000-10-19 03:23 UTC Modified: 2000-10-19 06:55 UTC
From: bbatchel at stetson dot edu Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.2 OS: Linux
Private report: No CVE-ID: None
 [2000-10-19 03:23 UTC] bbatchel at stetson dot edu
I am writing a database wrapper for a project I am working on.  The gist of this system is based on a hirearchy of objects - such as:

     Object1:
        Object2:
           Data (say a string containing 'monkey')
        Object3:
           Data
        Object4:
           Data

When I do this:

     echo($Ibject1->Object2->Data);

I get:  monkey

When I do this:

     echo("<br>$Object1->Object2->Data<br>");

I would expect to get:

     <br>monkey<br>

But instead I get:

     <br>Object->Data<br>

I assume that the parser is resolving $Object1->Object2 as the word object, and then concatinating that to '->Data' as a string - instead of going down the line to the rest of the variable.

Not a big deal, per se, but still a bug in my opinion.

For the mean time, I just assign the complex variable to a temporary variable and use that in the string substitution.

Thanks,
--Bryan

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-10-19 06:55 UTC] stas@php.net
Use "<br>{$Object1->Object2->Data}<br>" for this.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC