Bug #68643 [NEW]: Mathematical expression in class constant initialization causes crash

From: Date: Wed, 24 Dec 2014 06:57:49 +0000
Subject: Bug #68643 [NEW]: Mathematical expression in class constant initialization causes crash
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189171@lists.php.net to get a copy of this message
From: najamelan at autistici dot org Operating system: Linux PHP version: 5.6.4 Package: Scripting Engine problem Bug Type: Bug Bug description:Mathematical expression in class constant initialization causes crash Description: ------------ I'm sorry, I could only test this on 5.6.2-1 (debian) but it's very fast to verify for someone who has the latest version installed, see script below. Test script: --------------- <?php // php version 5.6.2-1 -> on debian const BLA = 1; class Test { const BLI = BLA * 5; // works on cli and crashes the interpreter on cgi (internal server error 500) // const BLI = 3 * 5; -> works fine on both cgi and cli but illegal according to the docs // https://wiki.php.net/rfc/const_scalar_exprs is said to be implemented in 5.6 // but neither the language specs nor the documentation reflect this. function __construct() { print_r( self::BLI ); // the interpreter only crashes when trying to access the constant } } new Test(); ?> Expected result: ---------------- 1. under no circumstance ever cause internal server 500 error (debugging nightmare) 2. update specs and docs Actual result: -------------- 500 in apache nothing in php error log -- Edit bug report at https://bugs.php.net/bug.php?id=68643&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68643&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68643&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68643&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68643&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68643&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68643&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68643&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68643&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68643&r=support Expected behavior: https://bugs.php.net/fix.php?id=68643&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68643&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68643&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68643&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68643&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68643&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68643&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68643&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68643&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68643&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68643&r=mysqlcfg

« previous php.bugs (#189171) next »