php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49948 stream_select() / _get_osfhandle
Submitted: 2009-10-21 18:13 UTC Modified: 2020-09-20 04:22 UTC
Votes:30
Avg. Score:4.5 ± 0.7
Reproduced:28 of 28 (100.0%)
Same Version:21 (75.0%)
Same OS:24 (85.7%)
From: uw@php.net Assigned: cmb (profile)
Status: No Feedback Package: Streams related
PHP Version: 5.3SVN-2009-10-21 (snap) OS: win32 only - Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: uw@php.net
New email:
PHP Version: OS:

 

 [2009-10-21 18:13 UTC] uw@php.net
Description:
------------
Hi,

I am getting "Invalid parameter detected in CRT function '_get_osfhandle'" when running the below code. 

I have compiled a source code snapshot version of PHP 5.3.2-dev on Windows. I used VC9 Express and SDK 6.1 . OS is XP Prof. I've run PHP from within the build tree in the hope it will pick the binaries (dlls, resource files, whatever there is) I have compiled myself. 

However, I have also seen this warning with yesterdays VC9 non TS binaries from the windows.php.net on another box. A couple of ext/mysqli tests fail because of the warning. The affected mysqli API calls is mysqli_poll(). It makes use of [php_]select() just like the below code.

Reproduce code:
---------------
$stream = stream_socket_client("tcp://193.99.144.80:80", $errno, $error, $whatever, STREAM_CLIENT_ASYNC_CONNECT | STREAM_CLIENT_CONNECT);
var_dump($stream);
$read = $write = $except = array($stream);
var_dump(stream_select($read, $write, $except, 1));

Expected result:
----------------
No warning. 

Actual result:
--------------
resource(5) of type (stream)

Warning: Invalid parameter detected in CRT function '_get_osfhandle' (f:\dd\vctools\crt_bld\self_x86\crt\src\osfinfo.c:314) in E:\php-sdk\php53dev\vc9\x86\php5.
3-200910211230\Debug_TS\select.php on line 5
int(1)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-21 19:45 UTC] will at flourishlib dot com
I am getting the same bug with the PHP 5.3.3RC1 VC9 x86 Thread Safe build. The 
server is a Windows 2008 R2 x64 machine. The code that is producing the error 
for me is:

<?php
error_reporting(E_ALL | E_STRICT);
ini_set('display_errors', 1);

date_default_timezone_set('America/New_York');
$con = fsockopen('www.google.com', 80);
$read = array($con);
$write = NULL;
$except = NULL;
stream_select($read, $write, $except, 1, 0);
?>

The error is:
Warning: Invalid CRT parameters detected in C:\tmp\stream_select.php on line 10

I can probably provide access to the machine if need be.
 [2010-08-23 19:03 UTC] thekid@php.net
Same on with VC9 binaries from 5.3.3-RELEASE using the non-threadsafe version. So basically anything with VC9.

The warning I get (both Windows XP and Windows Vista) is:

  "Invalid CRT parameters detected"

I'm using the second example (w/ fsockopen("www.google.com"[...])).
 [2011-03-15 08:35 UTC] ivan dot enderlin at hoa-project dot net
I got the same problem with PHP5.3.3 on Windows7 (6.1.7600) and maybe with 5.3.2 too. Problem comes from stream_select and produces a warning: invalid CRT.
 [2011-03-15 09:12 UTC] ivan dot enderlin at hoa-project dot net
I got the same problem with PHP5.3.4 on Windows7 (6.1.7600).
 [2012-03-11 22:46 UTC] uuf6429 at gmail dot com
Same issue on Windows 7 64bit + PHP 5.4 (Zend Server Community Edition).
 [2017-10-24 07:32 UTC] kalle@php.net
-Status: Assigned +Status: Open -Assigned To: pajoye +Assigned To:
 [2020-09-07 12:15 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2020-09-07 12:15 UTC] cmb@php.net
I cannot reproduce that with current PHP-7.3. Presumably, the
issue has been fixed in the meantime, or can somebody else
reproduce it with any of the actively supported PHP versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2020-09-20 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Sep 29 10:01:23 2020 UTC