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

From: Date: Thu, 27 Mar 2008 16:08:43 +0000
Subject: Re: cvs: php-src(PHP_5_3) /ext/standard file.c
References: 1 2 3  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-49410@lists.php.net to get a copy of this message
Can't you check with php_stream_supports_lock here wether the stream-wrapper supports locking?
That requires an open stream.
And why don't you raise the warning after opening the stream? There is this check anyway: if (flags & LOCK_EX && (!php_stream_supports_lock(stream) || php_stream_lock(stream, LOCK_EX))) { php_stream_close(stream); RETURN_FALSE; }
On 27-Mar-08, at 3:15 AM, Benjamin Schulz wrote:
regards, Benjamin On 27.03.2008, at 00:06, Ilia Alshanetsky wrote:
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'; --PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Ilia Alshanetsky


« previous php.cvs (#49410) next »