|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-04-13 10:42 UTC] mattwil@php.net
[2008-05-09 09:30 UTC] mattwil@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Mon Jan 05 14:00:01 2026 UTC |
Description: ------------ Using todays prebuilt snap of 5.3 on Windows, it looks like resources being used as array keys are being converted to int(0). The prevents them being used as unique array keys. This is a big change from php 5.2.5, Reproduce code: --------------- <?php error_reporting(E_ALL | E_STRICT); $fres = fopen("g:/tmp/arraytest.php", "r"); $fres2 = fopen("g:/tmp/arraytest.phpb", "w"); var_dump($fres); var_dump($fres2); $myarray = array(1,2); var_dump($myarray); $myarray[$fres] = "bob"; $myarray[$fres2] = "bob2"; var_dump($myarray); ?> Expected result: ---------------- PHP Strict Standards: Resource ID#5 used as offset, casting to integer (5) in G:\tmp\arraytest.php on line 15 PHP Strict Standards: Resource ID#6 used as offset, casting to integer (6) in G:\tmp\arraytest.php on line 16 array(4) { [0]=> int(1) [1]=> int(2) [5]=> string(3) "bob" [6]=> string(4) "bob2" } Actual result: -------------- Strict Standards: Resource ID#5 used as offset, casting to integer (5) in G:\tmp\arraytest.php on line 15 Strict Standards: Resource ID#6 used as offset, casting to integer (6) in G:\tmp\arraytest.php on line 16 array(2) { [0]=> string(4) "bob2" [1]=> int(2) }