#29022 [NEW]: "Warning: Constants may only evaluate to scalar values" on valid constant defin
| From: | johfivealive at hotmail dot com | Date: | Mon, 05 Jul 2004 18:18:11 +0000 |
| Subject: | #29022 [NEW]: "Warning: Constants may only evaluate to scalar values" on valid constant defin | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-61708@lists.php.net to get a copy of this message | ||
From: johfivealive at hotmail dot com
Operating system: Fedora Core 2
PHP version: 5.0.0RC3
PHP Bug Type: Zend Engine 2 problem
Bug description: "Warning: Constants may only evaluate to scalar values" on valid
constant defin
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 bug report at http://bugs.php.net/?id=29022&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29022&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29022&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=29022&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=29022&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=29022&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=29022&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=29022&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=29022&r=support
Expected behavior: http://bugs.php.net/fix.php?id=29022&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=29022&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=29022&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=29022&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29022&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=29022&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=29022&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=29022&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=29022&r=float