Skip to content

Commit 96da461

Browse files
jlbprofnikic
authored andcommitted
Fix for bug in file handling refactor.
While testing the cPanel usage of PHP-FPM, we stumbled on this bug. Without the fix, the zend_string is corrupted and getting odd filenames When using FPM we kept getting "No input file specified". I work for cPanel and we use PHP extensively.
1 parent 5eead6d commit 96da461

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

main/fopen_wrappers.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ PHPAPI int php_fopen_primary_script(zend_file_handle *file_handle)
402402
IS_ABSOLUTE_PATH(PG(doc_root), length)) {
403403
size_t path_len = strlen(path_info);
404404
filename = zend_string_alloc(length + path_len + 2, 0);
405-
memcpy(filename, PG(doc_root), length);
405+
memcpy(ZSTR_VAL(filename), PG(doc_root), length);
406406
if (!IS_SLASH(ZSTR_VAL(filename)[length - 1])) { /* length is never 0 */
407407
ZSTR_VAL(filename)[length++] = PHP_DIR_SEPARATOR;
408408
}

0 commit comments

Comments
 (0)