php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28727 Bug in parser module
Submitted: 2004-06-10 14:04 UTC Modified: 2004-06-10 17:00 UTC
From: vvkrougl at mail dot ru Assigned:
Status: Not a bug Package: Compile Failure
PHP Version: 4.3.4 OS: FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: vvkrougl at mail dot ru
New email:
PHP Version: OS:

 

 [2004-06-10 14:04 UTC] vvkrougl at mail dot ru
Description:
------------
This script isn't work at all! IE display this line:"Parse error: parse error in /s.php on line 3". If I change the 'break' staement to 'die("Something...")' then everything work fine!



Reproduce code:
---------------
<?
do {
  $a = 1 or break;
} while (0);
?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-10 14:27 UTC] tony2001@php.net
break is language construct and cannot be used in such expressions just becase PHP can't compute the value of such expression. 

On the other hand, die() is just a function, which returns a result value.

couple of example:
if ($foo == $var || break) //wrong. break returns nothing and PHP cannot compute expression's value.
if ($foo == $var || echo) //wrong. echo returns nothing
if ($foo == $var || strlen('some')) // ok
$foo == 1 OR echo 1; //wrong
$foo == 1 OR print 1; //correct. print() always return true.


 [2004-06-10 15:02 UTC] vvkrougl at mail dot ru
Thanks, I understand.
I rewrite my code to:
if ( !($res = some_func()) ) break;

But this line looks more nicely and it is a pity that she does not work:
$res = some_func() or break;

Thanks!
 [2004-06-10 17:00 UTC] magnus@php.net
Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 19:01:29 2024 UTC