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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: bbatchel at stetson dot edu
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2020 The PHP Group
All rights reserved.
Last updated: Sat Sep 26 06:01:23 2020 UTC