Bug 453333 - [parser] Parser allow non integer scalars in break/continue
Summary: [parser] Parser allow non integer scalars in break/continue
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: PDT (show other bugs)
Version: unspecified   Edit
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: PHP Core CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-26 12:19 EST by Dawid Pakula CLA
Modified: 2020-05-14 11:24 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dawid Pakula CLA 2014-11-26 12:19:44 EST
Example:
while(true) {
  continue 'what_ever';
}

Now:
no errors

Expected:
fatal error: 'break' operator accepts only positive numbers
Comment 1 Dawid Pakula CLA 2018-03-29 16:18:35 EDT
I think we can easy do this via our ValidatorVisitor.
Comment 2 Thierry BLIND CLA 2018-03-29 21:10:04 EDT
Yes, but only for php >= 5.4 ;)

Following code was valid and made no error using php < 5.4 (evaluated at runtime):

<?php
$j = -1;
while(true) {
  break $j;
}
?>

With php >= 5.4, 'break' operator with non-constant operand is no longer supported
Comment 3 Eclipse Genie CLA 2018-03-30 08:07:57 EDT
New Gerrit change created: https://git.eclipse.org/r/120510