From: tomas_matousek at hotmail dot com Operating system: WinXP PHP version: 5.0.0 PHP Bug Type: Feature/Change Request Bug description: Resources should be scalars
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 bug report at http://bugs.php.net/?id=29534&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29534&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29534&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29534&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29534&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29534&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29534&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29534&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29534&r=support Expected behavior: http://bugs.php.net/fix.php?id=29534&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29534&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29534&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29534&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29534&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29534&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29534&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29534&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29534&r=float