Skip to content

Commit de26b55

Browse files
committed
fd fix
1 parent 1fdece5 commit de26b55

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

UPGRADING

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ PHP 5.4 UPGRADE NOTES
339339
- ob_start() no longer starts multiple output buffers when passed
340340
array("callback1", "callback2", "callback3", ...).
341341

342+
- Since 5.4.4, "php://fd" stream syntax is available only in CLI build.
343+
342344
==============================
343345
5. Changes to existing classes
344346
==============================

ext/standard/php_fopen_wrapper.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,20 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, char *path, ch
263263
long fildes_ori;
264264
int dtablesize;
265265

266+
if (strcmp(sapi_module.name, "cli")) {
267+
if (options & REPORT_ERRORS) {
268+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Direct access to file descriptors is only available from command-line PHP");
269+
}
270+
return NULL;
271+
}
272+
273+
if ((options & STREAM_OPEN_FOR_INCLUDE) && !PG(allow_url_include) ) {
274+
if (options & REPORT_ERRORS) {
275+
php_error_docref(NULL TSRMLS_CC, E_WARNING, "URL file-access is disabled in the server configuration");
276+
}
277+
return NULL;
278+
}
279+
266280
start = &path[3];
267281
fildes_ori = strtol(start, &end, 10);
268282
if (end == start || *end != '\0') {

0 commit comments

Comments
 (0)