|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-02-20 22:38 UTC] philip@php.net
[2006-02-21 00:47 UTC] mgkimsal at gmail dot com
[2006-02-21 17:10 UTC] philip@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 16 14:00:01 2025 UTC |
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