1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Keep the orig_path for xport stream

Closes GH-11113
This commit is contained in:
iamluc
2023-04-20 10:34:25 +02:00
committed by Jakub Zelenka
parent 8d8cfe24d3
commit 730f32bad9
9 changed files with 53 additions and 21 deletions

2
NEWS
View File

@@ -201,6 +201,8 @@ PHP NEWS
- Streams:
. Fixed bug #51056: blocking fread() will block even if data is available.
(Jakub Zelenka)
. Added storing of the original path used to open xport stream.
(Luc Vieillescazes)
- XSLTProcessor:
. Fixed bug #69168 (DomNode::getNodePath() returns invalid path). (nielsdos)

View File

@@ -17,7 +17,7 @@ fclose($server);
?>
--EXPECTF--
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -32,4 +32,6 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:%d"
}

View File

@@ -9,7 +9,7 @@ fclose($tcp_socket);
?>
--EXPECTF--
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -24,4 +24,6 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31330"
}

View File

@@ -38,7 +38,7 @@ var_dump(stream_get_meta_data($client));
?>
--EXPECTF--
Write some data:
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -53,11 +53,13 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31331"
}
Read a line from the client, causing data to be buffered:
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -72,11 +74,13 @@ array(7) {
int(15)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31331"
}
Read 3 bytes of data from the client:
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -91,11 +95,13 @@ array(7) {
int(12)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31331"
}
Close the server side socket and read the remaining data from the client:
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -110,4 +116,6 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31331"
}

View File

@@ -36,7 +36,7 @@ fclose($server);
?>
--EXPECTF--
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -51,11 +51,13 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31332"
}
Set a timeout on the client and attempt a read:
array(7) {
array(8) {
["timed_out"]=>
bool(true)
["blocked"]=>
@@ -70,11 +72,13 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31332"
}
Write some data from the server:
array(7) {
array(8) {
["timed_out"]=>
bool(true)
["blocked"]=>
@@ -89,11 +93,13 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31332"
}
Read some data from the client:
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -108,4 +114,6 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31332"
}

View File

@@ -31,7 +31,7 @@ fclose($server);
?>
--EXPECTF--
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -46,12 +46,14 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31333"
}
Set blocking to false:
bool(true)
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -66,12 +68,14 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31333"
}
Set blocking to true:
bool(true)
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -86,4 +90,6 @@ array(7) {
int(0)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31333"
}

View File

@@ -36,7 +36,7 @@ fclose($client);
?>
--EXPECTF--
Write some data:
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -51,11 +51,13 @@ array(7) {
int(%i)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31334"
}
Read a line from the client:
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -70,11 +72,13 @@ array(7) {
int(%i)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31334"
}
Close the server side socket and read the remaining data from the client:
array(7) {
array(8) {
["timed_out"]=>
bool(false)
["blocked"]=>
@@ -89,4 +93,6 @@ array(7) {
int(%i)
["seekable"]=>
bool(false)
["uri"]=>
string(21) "tcp://127.0.0.1:31334"
}

View File

@@ -59,7 +59,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
{
php_stream *stream = NULL;
php_stream_transport_factory factory = NULL;
const char *p, *protocol = NULL;
const char *p, *protocol, *orig_path = NULL;
size_t n = 0;
bool failed = false;
bool bailout = false;
@@ -94,6 +94,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
}
}
orig_path = name;
for (p = name; isalnum((int)*p) || *p == '+' || *p == '-' || *p == '.'; p++) {
n++;
}
@@ -135,6 +136,7 @@ PHPAPI php_stream *_php_stream_xport_create(const char *name, size_t namelen, in
if (stream) {
zend_try {
php_stream_context_set(stream, context);
stream->orig_path = pestrdup(orig_path, persistent_id ? 1 : 0);
if ((flags & STREAM_XPORT_SERVER) == 0) {
/* client */

View File

@@ -966,9 +966,5 @@ PHPAPI php_stream *php_stream_generic_socket_factory(const char *proto, size_t p
return NULL;
}
if (flags == 0) {
return stream;
}
return stream;
}