ID: 29534
Updated by: [EMAIL PROTECTED]
Reported By: tomas_matousek at hotmail dot com
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: WinXP
PHP Version: 5.0.0
New Comment:
Andy said some time ago that we shouldn't define resources as
constants.
Previous Comments:
------------------------------------------------------------------------
[2004-08-05 12:58:37] tomas_matousek at hotmail dot com
Description:
------------
A resource can be defined as a constant:
e.g. define("my_file",fopen(...)); or STDIN, STDOUT, STDERR in CLI
mode.
In the "Constants" manual section constant values are constrained to
scalars only.
"Only scalar data (boolean, integer, float and string) can be contained
in constants."
However, a resource is not a scalar (is_scalar returns false).
Moreover, a NULL can be used as a value of a constant.
It's a mess, isn't it?
IMHO a resource should be a scalar. Such a change is acceptable since
there is a notice in the is_scalar() function description which allows
it:
"Note:
is_scalar() does not consider resource type values to be scalar as
resources are abstract datatypes which are currently based on integers.
This implementation detail should not be relied upon, as it may change."
And there should be stated in the constants section of the manual that
a NULL can be also a constant (don't forget to correct an error message
which is reported if one tries to define a constant with a value being
e.g. an array or object).
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29534&edit=1