php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #69597 'break' not in the 'loop' or 'switch' context
Submitted: 2015-05-07 18:10 UTC Modified: 2015-05-07 18:55 UTC
From: benjamin dot balet at gmail dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: master-Git-2015-05-07 (Git) OS: All
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: benjamin dot balet at gmail dot com
New email:
PHP Version: OS:

 

 [2015-05-07 18:10 UTC] benjamin dot balet at gmail dot com
Description:
------------
Hi,

I've found a bug in PHP7-dev that I can reproduce on Ubuntu/amd64 and Win64/amd64 (but I think it is not OS specific). The bug occurs in - at least - the 10 latest nighly builds.

I've discovered it while trying to build an xlsx file with PHPExcel, it displays :
'break' not in the 'loop' or 'switch' context in PHPExcel/Calculation/Functions.php on line 581

I tried to search before submitting this bug and I hope it is not a duplicate.

Benjamin

Test script:
---------------
You can reproduce the bug on my demo:
 - use bbalet/bbalet to login
 - Menu "Request", "List of Leave Request"
 - Button "Export this list" at the bottom of the page.

PHP7 (fail): http://php7.jorani.org/
PHP  5.5.12 (pass) : http://demo.jorani.org/
HHVM (pass) : http://hhvm.jorani.org/

The full source of the project is on Github https://github.com/bbalet/jorani
And PHPExcel lib: https://github.com/PHPOffice/PHPExcel


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-05-07 18:24 UTC] nikic@php.net
Could you please past an excerpt (e.g. the body of the containing function) of the code around line 581 or alternatively provide the commit you're using? The code from the master branch of PHPExcel does not have a break in line 581.
 [2015-05-07 18:37 UTC] benjamin dot balet at gmail dot com
Oh, I see that they changed it. Strange that this code was working with PHP5.5/5.6. Anyway, I assume that this is an illegal use of break keyword...

My version
https://github.com/bbalet/jorani/blob/master/application/third_party/PHPExcel/Calculation/Functions.php#L587

Latest version
https://github.com/PHPOffice/PHPExcel/blob/develop/Classes/PHPExcel/Calculation/Functions.php#L587

Latest commit mentions that the break was unnecessary:
https://github.com/PHPOffice/PHPExcel/commit/eb768751c6ce8c034bb251f9fd84879cf6b044c1
 [2015-05-07 18:55 UTC] benjamin dot balet at gmail dot com
-Status: Open +Status: Closed
 [2015-05-07 18:55 UTC] benjamin dot balet at gmail dot com
The PHP compiler is stricter regarding the use of break keyword.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 21:01:30 2024 UTC