#29022 [Opn->Bgs]: "Warning: Constants may only evaluate to scalar values" on valid constant defin
| From: | derick@php.net | Date: | Tue, 06 Jul 2004 07:12:55 +0000 |
| Subject: | #29022 [Opn->Bgs]: "Warning: Constants may only evaluate to scalar values" on valid constant defin | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61750@lists.php.net to get a copy of this message | ||
ID: 29022
Updated by: derick@php.net
Reported By: johfivealive at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: Zend Engine 2 problem
Operating System: Fedora Core 2
PHP Version: 5.0.0RC3
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is correct behavior.
Previous Comments:
------------------------------------------------------------------------
[2004-07-05 20:18:10] johfivealive at hotmail dot com
Description:
------------
using the define() function I get a warning when I don't think I
should.
Reproduce code:
---------------
define( "LOGIK_MYSQL_HOST", $config->getMySQLHost() );
where $config->getMySQLHost() returns a string.
The following code makes the warning go away:
define( "LOGIK_MYSQL_HOST", (string) $config->getMySQLHost() );
Expected result:
----------------
define( "LOGIK_MYSQL_HOST", $config->getMySQLHost() );
should not produce a warning
Actual result:
--------------
define( "LOGIK_MYSQL_HOST", $config->getMySQLHost() );
produces the following warning:
"Warning: Constants may only evaluate to scalar values"
even though $config->getMySQLHost() returns a scalar, have to cast to
string in order to make the warning go away
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29022&edit=1