php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #52763 There is a problem in concatenation with strings and functions
Submitted: 2010-09-01 20:14 UTC Modified: 2010-09-01 20:22 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: amaury dot carrade at free dot fr Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.3.3 OS: Linux Kubuntu 10.04
Private report: No CVE-ID: None
 [2010-09-01 20:14 UTC] amaury dot carrade at free dot fr
Description:
------------
There is a problem in concatenation.
When I write : 
<?php
    echo '<pre>' . var_dump($var) . '</pre>';
?>

PHP show the same result as :
<?php
    echo var_dump($var) . '<pre></pre>';
?>

There is a solution (show below), but it is not practical
<?php
    echo '<pre>';
    echo var_dump($var) . '</pre>';
?>


Test script:
---------------
<?php
    echo '<pre>' . var_dump($var) . '</pre>';
?>


Expected result:
----------------
<pre>The result of the function var_dump()</pre>

Actual result:
--------------
The result of the function var_dump()<pre></pre>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-09-01 20:17 UTC] rasmus@php.net
-Status: Open +Status: Bogus
 [2010-09-01 20:17 UTC] rasmus@php.net
var_dump() can't be used inline like that.  Use print_r() or var_export() with the 
return parameter set.
 [2010-09-01 20:19 UTC] amaury dot carrade at free dot fr
-Summary: There is a problem in concatenation +Summary: There is a problem in concatenation with strings and functions -Status: Bogus +Status: Open
 [2010-09-01 20:19 UTC] amaury dot carrade at free dot fr
NOTE : I found this bug only, for the time being, whith var_dump function and a personnal function dump() (same processing as var dump plus '<pre>' and '</pre>')
 [2010-09-01 20:22 UTC] rasmus@php.net
-Status: Open +Status: Bogus
 [2010-09-01 20:22 UTC] rasmus@php.net
It's not a bug.  Anything that outputs directly instead of returning the result is 
going to display out of order when inlined into an expression like that.
 [2010-09-01 20:23 UTC] amaury dot carrade at free dot fr
Sorry for this pseudo-bug. 
I have not read very well the documentation...
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Fri Dec 12 07:00:01 2025 UTC