#50629 [NEW]: Invalid CRT parameters detected in stream_get_contents()

From: Date: Fri, 01 Jan 2010 19:45:06 +0000
Subject: #50629 [NEW]: Invalid CRT parameters detected in stream_get_contents()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-146259@lists.php.net to get a copy of this message
From: viaujoc at videotron dot ca Operating system: Win2003 PHP version: 5.3.1 PHP Bug Type: Streams related Bug description: Invalid CRT parameters detected in stream_get_contents() Description: ------------ When using stream_get_contents() without the $maxlength argument, the warning "Warning: Invalid CRT parameters detected" is showing up. This only happens in PHP 5.3.1, it works correctly in PHP 5.2.12. Adding a very large value to $maxlength, even much larger than the actual content to be retrieve makes the warning go away. Reproduce code: --------------- <?php $sock = fsockopen("127.0.0.1",80); $writeStr = "GET / HTTP/1.0\r\n\r\n"; for ($written = 0; $written < strlen($writeStr); $written += $fwrite) { $fwrite = fwrite($sock,substr($writeStr,$written)); if (!$fwrite) break; } $data = stream_get_contents($sock); var_dump($data); ?> Expected result: ---------------- The warning "Warning: Invalid CRT parameters detected" should not show up, it does not in PHP 5.2.12. In both PHP 5.2.12 and 5.3.1, $data is containing the same thing. Actual result: -------------- Warning: Invalid CRT parameters detected in D:\wwwroot\Dev\Framework_TestApp\bug.php on line 8 string(726) "HTTP/1.1 200 OK Content-Length: 555 Content-Type: text/html Server: Microsoft-IIS/6.0 X-Powered-By: ASP.NET Date: Fri, 01 Jan 2010 19:34:36 GMT Connection: close <html><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>127.0.0.1 - /</title></head><body><H1>127.0.0.1 - /</H1><hr> <pre> [... the rest of $data is here]" -- Edit bug report at http://bugs.php.net/?id=50629&edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50629&r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50629&r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50629&r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50629&r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50629&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50629&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50629&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50629&r=needscript Try newer version: http://bugs.php.net/fix.php?id=50629&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50629&r=support Expected behavior: http://bugs.php.net/fix.php?id=50629&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50629&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50629&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50629&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50629&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=50629&r=dst IIS Stability: http://bugs.php.net/fix.php?id=50629&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50629&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50629&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50629&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50629&r=mysqlcfg

« previous php.bugs (#146259) next »