Bug #52643 [Opn->Bgs]: No error/warning for data after missing semicolon after break statement

From: Date: Fri, 20 Aug 2010 05:22:12 +0000
Subject: Bug #52643 [Opn->Bgs]: No error/warning for data after missing semicolon after break statement
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-153630@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=52643&edit=1

 ID:                 52643
 Updated by:         aharvey@php.net
 Reported by:        haakon dot nessjoen at gmail dot com
 Summary:            No error/warning for data after missing semicolon
                     after break statement
-Status:             Open
+Status:             Bogus
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Linux
 PHP Version:        5.2.14
 Block user comment: N

 New Comment:

I suspect Johannes meant to close this. :)


Previous Comments:
------------------------------------------------------------------------
[2010-08-19 18:28:53] johannes@php.net

break may have a parameter. In your case it is the return value of
$variable1 = 'hey'; which is the string 'hey'

------------------------------------------------------------------------
[2010-08-19 10:42:01] haakon dot nessjoen at gmail dot com

Description:
------------
If you forget the semicolon after a 'break' statement. Almost all
characters up to the next ; is ignored. Hence you won't get a error
message about the problem.

For example, if you set a variable immediately after a mistake like
this. You might be wondering for a long time of why the variable is not
set.

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

if (0)
 break

$variable1 = 'hey';
$variable2 = 'ho';

print "Variable1 = $variable1\n";
print "Variable2 = $variable2\n";

?>

Expected result:
----------------
Error message

Actual result:
--------------
Variable1 = 
Variable2 = ho


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



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


Thread (3 messages)

« previous php.bugs (#153630) next »