From: [EMAIL PROTECTED] Operating system: RedHat PHP version: 4.3.0 PHP Bug Type: Filesystem function related Bug description: Warning: fopen() expects parameter 1 to be string
A php script I have worked fine under PHP 4.2.3, but after the upgrade to PHP 4.3 whenever I try running it I get these errors: Warning: fopen() expects parameter 1 to be string, resource in ... on line 353 Warning: fwrite(): supplied argument is not a valid stream resource in ... on line 354 Warning: fclose(): supplied argument is not a valid stream resource in ... on line 355 Warning: getimagesize(Resource id #4) [function.getimagesize]: failed to create stream: No such file or directory in ... on line 361 The following blocks of code surround the problematic lines from above: if ($input = fopen($image, "rb")) { $image_data = fread ($input, 2048576); fclose($input); if (!$tmp_image = @tmpfile()) { exit("Cannot create tempfile using tmpfile()."); } 353: $output = fopen($tmp_image, "wb"); 354: fwrite($output, $image_data); 355: fclose($output); 356: } else { 357: exit("Cannot access ".$image." for reading. (Does not exist or has wrong permissions)"); 358: } 359: 360: // Create Image from file by type, get and set size 361: list($width,$height,$type) = getimagesize($tmp_image); 362: I'm having difficulty determining what the problem is since the code worked with PHP 4.2.3. Thanks for your help. -- Edit bug report at http://bugs.php.net/?id=22177&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=22177&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=22177&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=22177&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=22177&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=22177&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=22177&r=support Expected behavior: http://bugs.php.net/fix.php?id=22177&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=22177&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=22177&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=22177&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22177&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=22177&r=dst IIS Stability: http://bugs.php.net/fix.php?id=22177&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=22177&r=gnused