|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-03-27 16:59 UTC] ab@php.net
-Assigned To:
+Assigned To: stas
[2014-04-13 01:14 UTC] tyrael@php.net
[2014-04-13 01:48 UTC] dfuhry at gmail dot com
[2014-05-13 23:37 UTC] stas@php.net
-Status: Assigned
+Status: Not a bug
[2014-05-13 23:37 UTC] stas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 22:00:02 2025 UTC |
Description: ------------ Commit df2a38e7f8603f51afa4c2257b3369067817d818 removed the ability to use php://fd/x file descriptors in non-CLI mode. Thus, sometime after PHP 5.3 it became no longer possible to issue parallel async database queries and stream_select on the array of database connection socket file descriptors. When trying to fopen("php://fd/x") (for some file descriptor number "x") the unhelpful error I receive is: "failed to open stream: operation failed". Neither the commit nor source comments make clear to me why the change was made, but if it is possible to revert it, or otherwise make alterations to allow the above use case, I would advocate doing so. I use unexposed pg_socket() method in the below, which returns the file descriptor of the socket of the database connection. Test script: --------------- $conn1 = pg_connect("dbname=a user=b host=c"); $conn2 = pg_connect("dbname=a user=b host=c"); // Next two lines should return resources representing file descriptors // but instead error and return FALSE. $r1 = fopen("php://fd/" . pg_socket($conn1)); $r2 = fopen("php://fd/" . pg_socket($conn2)); pg_send_query($conn1, "SELECT pg_sleep(random())"); pg_send_query($conn2, "SELECT pg_sleep(random())"); $r = array($r1, r2); $w = array(); $e = array(); stream_select($r, $w, $e, NULL); // Would return whichever conn finished first. Expected result: ---------------- fopen("php://fd/x") calls return a valid stream resource, not FALSE. Actual result: -------------- ... failed to open stream: operation failed ... ... failed to open stream: operation failed ...