Req #69056 [NEW]: Typecasting resources to integers should be defined

From: Date: Sun, 15 Feb 2015 13:58:42 +0000
Subject: Req #69056 [NEW]: Typecasting resources to integers should be defined
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-190699@lists.php.net to get a copy of this message
From: grzegorz129 at gmail dot com Operating system: PHP version: 5.6.5 Package: *Programming Data Structures Bug Type: Feature/Change Request Bug description:Typecasting resources to integers should be defined Description: ------------ Typecasting resources to integers became common practice when used with stream_select(). It provides fast & consistent between versions method to locate sockets returned by stream_select(), however it's still undefined by PHP documentation (manual for integer type clearly warns about casting unknown types to integers: "The behaviour of converting to integer is undefined for other types. Do not rely on any observed behaviour, as it can change without notice."). From some time now stream_select() preserves assoc. array keys (which enables usage of eg. local socket name as key), but it also cannot be considered stable due to doc bug #68798. Expected result: ---------------- Casting resources to integers should be documented. Casting resource to integer should produce unique number of resource (which is actual result, but not documented). Actual result: -------------- Casting resource to integer produces strict warning. Actual integer produced is the same as shown by var_dump(). Example: class StreamServer#1 (1) { private $zeroStream => resource(22) of type (Direct I/O File Descriptor) } -- Edit bug report at https://bugs.php.net/bug.php?id=69056&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69056&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69056&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69056&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=69056&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=69056&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=69056&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=69056&r=needscript Try newer version: https://bugs.php.net/fix.php?id=69056&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=69056&r=support Expected behavior: https://bugs.php.net/fix.php?id=69056&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=69056&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=69056&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=69056&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69056&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=69056&r=dst IIS Stability: https://bugs.php.net/fix.php?id=69056&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=69056&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=69056&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=69056&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=69056&r=mysqlcfg

« previous php.bugs (#190699) next »