Bug #68579 [Opn->Wfx]: Unable to define fraction const in classes

From: Date: Tue, 09 Dec 2014 19:18:00 +0000
Subject: Bug #68579 [Opn->Wfx]: Unable to define fraction const in classes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188985@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68579&edit=1 ID: 68579 Updated by: requinix@php.net Reported by: randomdev4+phpbugs at gmail dot com Summary: Unable to define fraction const in classes -Status: Open +Status: Wont fix Type: Bug Package: Scripting Engine problem Operating System: Ubuntu 14.04LTS PHP Version: 5.5.19 Block user comment: N Private report: N New Comment: Ah, sorry aharvey. Previous Comments: ------------------------------------------------------------------------ [2014-12-09 19:17:35] requinix@php.net Thank you for your bug report. This issue has already been fixed in the latest released version of PHP, which you can download at http://www.php.net/downloads.php Available in 5.6+. http://3v4l.org/KCsVh ------------------------------------------------------------------------ [2014-12-09 19:17:07] aharvey@php.net Support for constant scalar expressions was added in PHP 5.6: http://php.net/manual/en/migration56.new-features.php#migration56.new-features.const-scalar-exprs Closing won't fix, since we won't be adding this to 5.5. ------------------------------------------------------------------------ [2014-12-09 19:13:13] randomdev4+phpbugs at gmail dot com Description: ------------ As per test script, define() works, and a simple variable works. But the moment you try to define a const in a class, PHP complains with the error below: Parse error: parse error, expecting ','' or ';'' in /Users/ben/test.php on line 8 Test script: --------------- <?php define(X,1/8); echo X."\n"; $y=1/8; echo $y."\n"; class foo { const bar = 1/8; } ?> ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68579&edit=1

« previous php.bugs (#188985) next »