Bug->Doc #68177 [Opn->Ver]: declare() + named constant = "Cannot convert to ordinal value"

From: Date: Fri, 17 Oct 2014 11:39:28 +0000
Subject: Bug->Doc #68177 [Opn->Ver]: declare() + named constant = "Cannot convert to ordinal value"
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-11562@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:         tyrael@php.net
 Reported by:        mikko dot rantalainen at peda dot net
 Summary:            declare() + named constant = "Cannot convert to
                     ordinal value"
-Status:             Open
+Status:             Verified
-Type:               Bug
+Type:               Documentation Problem
 Package:            Compile Warning
 Operating System:   Ubuntu Linux 10.04 LTS
 PHP Version:        5.6.1
 Block user comment: N
 Private report:     N

 New Comment:

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.


Previous Comments:
------------------------------------------------------------------------
[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


Thread (3 messages)

« previous php.doc.bugs (#11562) next »