From: mgkimsal at gmail dot com Operating system: All PHP version: Irrelevant PHP Bug Type: Documentation problem Bug description: Constants should only be scalars
Description: ------------ I realize this is 18 months late, but why is this bogus? It's not only a winxp problem - this happens on all platforms I've tried (well, win and linux). Nor is this only a PHP5 problem - it's a problem in the 4 series as well (haven't tested 3). Either the docs should be changed, or the code behaviour should be changed. I'm in favor of the latter. While the 'resource' might be constant - "Resource id #4" might always be "Resource id #4", the state of that resource might change (file reading problems, db connection problems, etc.). If the value (or the functional state) of something can change, that's not really 'constant', is it? Also, I'm not sure how resource ID numbers are allocated, so this situation might not happen, but in a resource-intense app, might there be a chance of using a resource, closing it, opening a new one, and getting the same 'id' #? I only found out about this recently, but it seems wrong, and certainly goes against the documentation. Reproduce code: --------------- <?php $x = mysql_connect('localhost','rt_mgk_user','rt_mgk_pass','rt_mgk'); define('FOO',$x); if (is_resource(FOO)) { echo 'foo is a resource'; } else { echo 'foo is not a resource'; } ?> Expected result: ---------------- foo is not a resource Actual result: -------------- foo is a resource -- Edit bug report at http://bugs.php.net/?id=36461&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36461&r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36461&r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36461&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36461&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36461&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36461&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=36461&r=needscript Try newer version: http://bugs.php.net/fix.php?id=36461&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36461&r=support Expected behavior: http://bugs.php.net/fix.php?id=36461&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36461&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36461&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36461&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36461&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36461&r=dst IIS Stability: http://bugs.php.net/fix.php?id=36461&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36461&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36461&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36461&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=36461&r=mysqlcfg