|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-10-10 00:44 UTC] daniel dot meister at datahouse dot ch
Description:
------------
It is not possible to set a class-constant to the value of negative infinity (-INF) while it is possible to set it to any float value or even to positive infinity (INF) or not-a-number (NAN).
configuration:
- no configure options
- no changes to php.ini
Reproduce code:
---------------
class A {
const a = -INF;
}
echo is_infinite(A::a);
Expected result:
----------------
1
Actual result:
--------------
Fatal error: Unsupported operand types in /path/to/file/filename.php on line n
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 07:00:01 2025 UTC |
possible workarounds: define("C",-INF); class A { const a = C; } class A { const a = -1E100000000; }Could reproduce with PHP 5.2-HEAD and PHP 5.3-HEAD. The error occurs on the line with: const a = -INF; Note that the same error occurs with: const a = -(1); Because you can't use an expression when defining a constant.