php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #50629 Invalid CRT parameters detected in stream_get_contents()
Submitted: 2010-01-01 19:45 UTC Modified: 2010-08-12 01:32 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:2 (100.0%)
From: viaujoc at videotron dot ca Assigned: pajoye (profile)
Status: Closed Package: Streams related
PHP Version: 5.3.1 OS: win32 only - Win2003
Private report: No CVE-ID: None
 [2010-01-01 19:45 UTC] viaujoc at videotron dot ca
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]"


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-01-01 20:48 UTC] pajoye@php.net
Have to reproduce it.
 [2010-08-12 00:07 UTC] kalle@php.net
-Status: Assigned +Status: Feedback
 [2010-08-12 00:07 UTC] kalle@php.net
Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

I cannot reproduce this with PHP trunk on Vista x86/VC9
 [2010-08-12 00:25 UTC] pajoye@php.net
-Status: Feedback +Status: Assigned
 [2010-08-12 00:25 UTC] pajoye@php.net
What makes you think that something has changed in regard of this error?

Please keep the status as it is :)
 [2010-08-12 01:32 UTC] viaujoc at videotron dot ca
-Status: Assigned +Status: Closed
 [2010-08-12 01:32 UTC] viaujoc at videotron dot ca
I cannot reproduce this bug in PHP 5.3.2+. This version seems to have solved it but I cannot find any related solved bug in the release notes.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 07:01:29 2024 UTC