Req #62449 [Opn->NoF]: Allow comma separated statements with (brace omitted) if statements

From: Date: Fri, 29 Jun 2012 14:08:20 +0000
Subject: Req #62449 [Opn->NoF]: Allow comma separated statements with (brace omitted) if statements
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-171628@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62449&edit=1 ID: 62449 Updated by: johannes@php.net Reported by: andrew at phantom dot uk dot net Summary: Allow comma separated statements with (brace omitted) if statements -Status: Open +Status: No Feedback Type: Feature/Change Request Package: *General Issues PHP Version: 5.4.4 Block user comment: N Private report: N New Comment: This leads to too many conflicts. For instance what should this code do: if (condition()) echo foo(), bar(); right now it prints the returned values from foo() and bar(). This can't be easily distinguished from your syntax. There are other similar cases. Such special case syntax also makes the language more complex with more special cases to mind. Previous Comments: ------------------------------------------------------------------------ [2012-06-29 13:38:26] andrew at phantom dot uk dot net Description: ------------ Allow statements to be separated by commas in single line if statements (when omitting the braces) Test script: --------------- if ( isset($_GET['take_me_there']) ) header('location: /you_are_here.php'), exit; Expected result: ---------------- The client would be redirected to www.yoursite.com/you_are_here.php and the script would terminate execution. Actual result: -------------- Parse error: syntax error, unexpected ',' in /opt/lampp/htdocs/test.php on line 2 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62449&edit=1

« previous php.bugs (#171628) next »