Re: Re: Found a bug in 4.2.3 re: <TD> and echo vs. <?php?>
| From: | Leif K-Brooks | Date: | Sat, 05 Apr 2003 04:59:58 +0000 |
| Subject: | Re: Re: Found a bug in 4.2.3 re: <TD> and echo vs. <?php?> | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142482@lists.php.net to get a copy of this message | ||
Neither works. You're doing something like this in your other code:
function foo(){
echo "foo";
}
echo foo();
The foo() doesn't return the (non-existant) value from echo, it simply echo()s and returns nothing, and there's nothing wrong with echo()ing nothing. It would fail if you were using
function foo(){
return echo "foo";
}
echo foo();
Daevid Vincent wrote:
Mmm. I'm still not following and not completely convinced. Changing "echo alarmLightYMD();" to simply "alarmLightYMD();" in the bottom function doesn't print anything in the table cell at all (for the first test case). While your idea at first makes sense and does seem like a newbie mistake (and you are correct, I do have nested "echo" statements come to think of it). What I don't get is why it's not consistent. "Expanding" the relevant lines, it should be like this: echo "<TD>".(echo "<IMG SRC='images/light_red.gif'>")."</TD>"; Which fails, and the other line would be (which works): <TD><?php echo (echo "<IMG SRC='images/light_red.gif'>"); ?></TD> In my book, they're both double echoing the output if you will... Are you with me on that? So again, why does the second one work and the first one doesn't?-- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law.-----Original Message----- From: Philip Hallstrom [mailto:philip@adhesivemedia.com] Sent: Friday, April 04, 2003 5:20 PM To: Daevid Vincent Cc: php-general@lists.php.net Subject: [PHP] Re: Found a bug in 4.2.3 re: <TD> and echo vs. <?php?> It's a coding error... at least I think so. change alarmLightMySQL just return the results not "echo" them... echoing them doesn't make much sense inside another echo statement... On Fri, 4 Apr 2003, Daevid Vincent wrote:Here, try this bullshit... I can't upgrade to a more recent version as I'm not incontrol of theserver, but I've tried it with both 4.1.2 and 4.2.3 onlinux with a RHinstall. Can anyone confirm or dispute this bug exists inlater versions?How does a parsing error like this go un-noticed for so long? Obviously I took out all the interesting stuff in the pageand so that can'tbe blamed. This is about as bare skeleton test case as you can get. *sigh* ------------snip---------------- <?php function alarmLightYMD() { return "<IMG SRC='images/light_red.gif'>"; } function alarmLightMySQL() { echo alarmLightYMD(); } ?> <html> <head> <title>FUCKED UP PHP Bug #1234170238741023</title> </head> <body> PHP Version 4.1.2<BR> PHP Version 4.2.3<BR> <BR> Why the FUCK doesn't this work!!!! <P> <TABLE BORDER="1"> <?php for ($i = 0; $i < 10; $i++ ) { echo "<TR>"; echo "<TD>".alarmLightMySQL()."</TD>"; echo "<TD>this fails!</TD>"; echo "</TR>"; } ?> </TABLE> <HR> YET THIS DOES! <P> <TABLE BORDER="1"> <?php for ($i = 0; $i < 10; $i++ ) { ?> <TR> <TD><?php echo alarmLightMySQL(); ?></TD> <TD>this works</TD> </TR> <?php } ?> </TABLE> </body> </html> ------------snip---------------- "Ezekiel 25:17. The path of the righteous man is beset onall sides by theinequities of the selfish and the tyranny of evil men.Blessed is he who inthe name of charity and goodwill shepherds the weak throughthe valley ofdarkness, for he is TRULY his brother's keeper and thefinder of lostchildren. And I will strike down upon thee with GREAT vengeance and FU-U-U-URIOUS anger, those who attempt to poison, anddestroy my brothers!And you will KNOW my name is the Lord, when I lay myvengeance upon thee!"-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php