Doc #68177 [Ver]: declare() + named constant = "Cannot convert to ordinal value"
| From: | aharvey@php.net | Date: | Thu, 23 Oct 2014 19:53:52 +0000 |
| Subject: | Doc #68177 [Ver]: declare() + named constant = "Cannot convert to ordinal value" | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-11579@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=68177&edit=1
ID: 68177
Updated by: aharvey@php.net
Reported by: mikko dot rantalainen at peda dot net
Summary: declare() + named constant = "Cannot convert to
ordinal value"
Status: Verified
Type: Documentation Problem
-Package: Compile Warning
+Package: Documentation problem
Operating System: Ubuntu Linux 10.04 LTS
PHP Version: 5.6.1
Block user comment: N
Private report: N
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
Previous Comments:
------------------------------------------------------------------------
[2014-10-23 19:53:35] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=335128
Log: Clarify what types of values can be given to declare directives.
Fixes doc bug #68177 (declare() + named constant = "Cannot convert to ordinal
value").
------------------------------------------------------------------------
[2014-10-17 11:39:27] tyrael@php.net
declare is a compile time construct, and you can't use variables, constants or expressions with
it, because they aren't resolved yet.
so this shortcoming is expected and http://www.php.net/declare should be updated to explain this.
------------------------------------------------------------------------
[2014-10-07 13:17:27] mikko dot rantalainen at peda dot net
Description:
------------
The declare construct raises a warning "Cannot convert to ordinal value" if a named
constant is used as a parameter. If this is intentional limitation, it should be documented.
Otherwise, this is a bug.
Test case at http://3v4l.org/YFZ4D
Test script:
---------------
<?php
define("CONFIG_TICKS", 1);
declare(ticks=CONFIG_TICKS);
$x = "test";
Expected result:
----------------
The declared value of 'ticks' should be 1 and the script should emit no output.
Actual result:
--------------
Warning: Cannot convert to ordinal value in /in/YFZ4D on line 3
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=68177&edit=1