We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 073b6ea commit 17d22a5Copy full SHA for 17d22a5
ext/standard/file.c
@@ -596,6 +596,13 @@ PHP_FUNCTION(file_put_contents)
596
if (flags & PHP_FILE_APPEND) {
597
mode[0] = 'a';
598
} else if (flags & LOCK_EX) {
599
+ /* check to make sure we are dealing with a regular file */
600
+ if (php_memnstr(filename, "://", sizeof("://") - 1, filename + filename_len)) {
601
+ if (strncasecmp(filename, "file://", sizeof("file://") - 1)) {
602
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Exclusive locks may only be set for regular files");
603
+ RETURN_FALSE;
604
+ }
605
606
mode[0] = 'c';
607
}
608
mode[2] = '\0';
0 commit comments