Bug #68643 [Opn->Nab]: Mathematical expression in class constant initialization causes crash

From: Date: Wed, 24 Dec 2014 20:58:57 +0000
Subject: Bug #68643 [Opn->Nab]: Mathematical expression in class constant initialization causes crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189184@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68643&edit=1 ID: 68643 Updated by: aharvey@php.net Reported by: najamelan at autistici dot org Summary: Mathematical expression in class constant initialization causes crash -Status: Open +Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: Linux PHP Version: 5.6.4 Block user comment: N Private report: N New Comment: This works fine on PHP 5.6.4, including the 5.6.4-1 package in Debian unstable. This is why we ask reporters to try the latest version. :) Previous Comments: ------------------------------------------------------------------------ [2014-12-24 06:57:48] najamelan at autistici dot org 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 this bug report at https://bugs.php.net/bug.php?id=68643&edit=1

« previous php.bugs (#189184) next »