ID:               32495
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mike at cocoweb dot co dot uk
-Status:           Open
+Status:           Bogus
 Bug Type:         Strings related
 Operating System: Windows XP
 PHP Version:      5.0.3
 New Comment:

I would be very worried if the output wasn't what you got.
(you're using single quotes..are you sure you've pasted the right code
here? :)



Previous Comments:
------------------------------------------------------------------------

[2005-03-30 04:49:20] mike at cocoweb dot co dot uk

Description:
------------
Unexpected output with echo statement.


Reproduce code:
---------------
<?php

// Expression 1
echo 'echo "<bob ".func()."></bob>";';

// Newline for "view source"
echo "\n";

// Expression 2
echo 'echo "<bob value=".func()."></bob>";';

// Newline for "view source"
echo "\n";

// Expression 3
echo 'echo "bob ".func()."></bob>";';

?>


Expected result:
----------------
echo "<bob ".func()."></bob>";

echo "<bob value=".func()."></bob>";

echo "bob ".func()."></bob>";


// Note extra newlines for ease of reading.

Actual result:
--------------
echo "<bob .func().></bob>";
echo "<bob value=".func()."></bob>";
echo "bob ".func()."></bob>";

Line 2 and 3 are expected.  Line 1 is just plain weird!

Note that the '=' after 'value' makes the output work correctly. 
Bizarre.  I have looked in PHP books, the web and asked a couple of
experts all to no avail.

You can reduce the original code down to:
echo 'echo "<bob =".func()."></bob>";';

and it will give expected result!  But remove the equals sign and the
bug will occur.


Also note removing the first < (i.e. before bob) will work too.  (see
expression 3).

I'm possibly having a REALLY bad coding day and making a REALLY simple
error...



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=32495&edit=1

Reply via email to