cvs: php-src(PHP_5_3) /ext/standard file.c

From: Date: Wed, 26 Mar 2008 23:06:48 +0000
Subject: cvs: php-src(PHP_5_3) /ext/standard file.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-49398@lists.php.net to get a copy of this message
iliaa Wed Mar 26 23:06:48 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/standard file.c Log: Fixed bug #44501 (LOCK_EX mode in file_put_contents() is impropertly handled in combination with url wrappers) http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.28.2.9&r2=1.409.2.6.2.28.2.10&diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.409.2.6.2.28.2.9 php-src/ext/standard/file.c:1.409.2.6.2.28.2.10 --- php-src/ext/standard/file.c:1.409.2.6.2.28.2.9 Sun Feb 24 11:45:55 2008 +++ php-src/ext/standard/file.c Wed Mar 26 23:06:47 2008 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.409.2.6.2.28.2.9 2008/02/24 11:45:55 felipe Exp $ */ +/* $Id: file.c,v 1.409.2.6.2.28.2.10 2008/03/26 23:06:47 iliaa Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -596,6 +596,13 @@ if (flags & PHP_FILE_APPEND) { mode[0] = 'a'; } else if (flags & LOCK_EX) { + /* check to make sure we are dealing with a regular file */ + if (php_memnstr(filename, "://", sizeof("://") - 1, filename + filename_len)) { + if (strncasecmp(filename, "file://", sizeof("file://") - 1)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Exclusive locks may only be set for regular files"); + RETURN_FALSE; + } + } mode[0] = 'c'; } mode[2] = '\0';

« previous php.cvs (#49398) next »