php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68579 Unable to define fraction const in classes
Submitted: 2014-12-09 19:13 UTC Modified: 2014-12-09 19:18 UTC
From: randomdev4+phpbugs at gmail dot com Assigned:
Status: Wont fix Package: Scripting Engine problem
PHP Version: 5.5.19 OS: Ubuntu 14.04LTS
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: randomdev4+phpbugs at gmail dot com
New email:
PHP Version: OS:

 

 [2014-12-09 19:13 UTC] 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;
}
?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-12-09 19:17 UTC] aharvey@php.net
-Status: Open +Status: Wont fix
 [2014-12-09 19:17 UTC] 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:17 UTC] requinix@php.net
-Status: Wont fix +Status: Open
 [2014-12-09 19:17 UTC] 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:18 UTC] requinix@php.net
-Status: Open +Status: Wont fix
 [2014-12-09 19:18 UTC] requinix@php.net
Ah, sorry aharvey.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 06:01:30 2024 UTC