Bug #70237 [NEW]: Empty while and do-while segmentation fault with opcode on CLI enabled
| From: | notrix at gmail dot com | Date: | Tue, 11 Aug 2015 08:43:10 +0000 |
| Subject: | Bug #70237 [NEW]: Empty while and do-while segmentation fault with opcode on CLI enabled | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-195106@lists.php.net to get a copy of this message | ||
From: notrix at gmail dot com
Operating system: Ubuntu 14.04
PHP version: 5.5.28
Package: opcache
Bug Type: Bug
Bug description:Empty while and do-while segmentation fault with opcode on CLI enabled
Description:
------------
If I enable opcache on cli environment (opcache.enable_cli) and run my
test.php script I get: "[1] 19066 segmentation fault (core dumped)
php test.php"
This happens only if while (or do-while) condition is variable and
content (between curly braces) is empty or contains only comments.
Actually the code makes no sense, but I had to debug few hours and found
this exact code with only comment "// TODO: .." in do-while braces.
Commenting out whole loop block fixed issue, but it's still a bug I
think.
Reproduced on php 5.5.27 and 5.6.11
Test script:
---------------
<?php
if ((int) ini_get('opcache.enable_cli') !== 1) {
throw new Exception('Opcode cache must be enabled on CLI
environment');
}
function neverUsed() {
$bool = false;
while ($bool) { };
// Same with: do { } while ($bool);
}
echo "OK";
Expected result:
----------------
Expected to see OK printed
Actual result:
--------------
[1] 19066 segmentation fault (core dumped) php test.php
--
Edit bug report at https://bugs.php.net/bug.php?id=70237&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70237&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70237&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70237&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=70237&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=70237&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=70237&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=70237&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=70237&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=70237&r=support
Expected behavior: https://bugs.php.net/fix.php?id=70237&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=70237&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=70237&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=70237&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70237&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=70237&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=70237&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=70237&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=70237&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=70237&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=70237&r=mysqlcfg