From:             
Operating system: 
PHP version:      Irrelevant
Package:          Unknown/Other Function
Bug Type:         Bug
Bug description:Strings variable parsing - complex syntax

Description:
------------
Strings variables parsing, as documented on
http://ca2.php.net/manual/en/language.types.string.php#language.types.string.parsing

is partly broken, or incorrectly documented.

The documentation says:



In fact, any value in the namespace can be included in a string with this
syntax. Simply write the expression the same way as it would appear outside
the string, and then wrap it in { and }.



But this seems to only work with pre-computed values accessible through
variables (using the dollar sign). This works neither for return values of
functions in the namespace, nor for constants.



BTW, in the examples, there is an extra backslash for the method example:

This is the value of the var named by the return value of
\$object->getName():

Test script:
---------------
<?php

namespace test;



$working = "works";

const MAYBENOT = "doesnt";

function surelynot() {

        return "neither";

}



$str = <<< DOC

A {$working} B {MAYBENOT} C {surelynot()} D

DOC;

echo $str;



Expected result:
----------------
A works B doesnt C neither D

Actual result:
--------------
A works B {MAYBENOT} C {surelynot()} D

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52897&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52897&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52897&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52897&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52897&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52897&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52897&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52897&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52897&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52897&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52897&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52897&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52897&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52897&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52897&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52897&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52897&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52897&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52897&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52897&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52897&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52897&r=mysqlcfg

Reply via email to