php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66822 Cannot use T_POW in const expression...
Submitted: 2014-03-05 05:16 UTC Modified: 2014-03-07 07:09 UTC
From: david at orlandophp dot org Assigned: datibbaw (profile)
Status: Closed Package: *General Issues
PHP Version: 5.6.0alpha2 OS: Mac OS X 10.9.2
Private report: No CVE-ID: None
 [2014-03-05 05:16 UTC] david at orlandophp dot org
Description:
------------
Expected:

Defining a constant with the `const` keyword and an expression that contains the `T_POW` (**) operator, the constant should be set to the value of the expression.

Actual:

Using the `T_POW` operator in a `const` statement produces a Parse Error with message: "Parse error: syntax error, unexpected '**' (T_POW)"

Test script:
---------------
<?php

const MOLE = 2 ** 27;

echo MOLE;

Expected result:
----------------
134217728

Actual result:
--------------
Parse error: syntax error, unexpected '**' (T_POW) in example.php on line 2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-05 21:46 UTC] nikic@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: datibbaw
 [2014-03-07 07:09 UTC] bwoebi@php.net
-Status: Assigned +Status: Closed
 [2014-03-07 07:09 UTC] bwoebi@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC