Can't you check with php_stream_supports_lock here wether the stream-
wrapper supports locking?
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
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php