[PHP-CVS] cvs: php-src /main/streams userspace.c
bjori Fri May 8 11:36:44 2009 UTC Modified files: /php-src/main/streams userspace.c Log: MFb5.3: fix comments http://cvs.php.net/viewvc.cgi/php-src/main/streams/userspace.c?r1=1.55r2=1.56diff_format=u Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.55 php-src/main/streams/userspace.c:1.56 --- php-src/main/streams/userspace.c:1.55 Tue Mar 31 16:25:58 2009 +++ php-src/main/streams/userspace.cFri May 8 11:36:43 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: userspace.c,v 1.55 2009/03/31 16:25:58 bjori Exp $ */ +/* $Id: userspace.c,v 1.56 2009/05/08 11:36:43 bjori Exp $ */ #include php.h #include php_globals.h @@ -1212,7 +1212,7 @@ add_property_null(object, context); } - /* call the unlink method */ + /* call the mkdir method */ MAKE_STD_ZVAL(zfilename); ZVAL_STRING(zfilename, url, 1); args[0] = zfilename; @@ -1277,7 +1277,7 @@ add_property_null(object, context); } - /* call the unlink method */ + /* call the rmdir method */ MAKE_STD_ZVAL(zfilename); ZVAL_STRING(zfilename, url, 1); args[0] = zfilename; @@ -1337,9 +1337,7 @@ add_property_null(object, context); } - /* call the stat_url method */ - - /* call it's stream_open method - set up params first */ + /* call it's stat_url method - set up params first */ MAKE_STD_ZVAL(zfilename); ZVAL_STRING(zfilename, url, 1); args[0] = zfilename; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
bjori Tue Mar 31 16:25:58 2009 UTC Modified files: /php-src/main/streams userspace.c Log: Fix errormessage check # Is correct in 5. http://cvs.php.net/viewvc.cgi/php-src/main/streams/userspace.c?r1=1.54r2=1.55diff_format=u Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.54 php-src/main/streams/userspace.c:1.55 --- php-src/main/streams/userspace.c:1.54 Wed Mar 25 19:55:50 2009 +++ php-src/main/streams/userspace.cTue Mar 31 16:25:58 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: userspace.c,v 1.54 2009/03/25 19:55:50 bjori Exp $ */ +/* $Id: userspace.c,v 1.55 2009/03/31 16:25:58 bjori Exp $ */ #include php.h #include php_globals.h @@ -515,7 +515,7 @@ RETURN_TRUE; } else { /* We failed. But why? */ - if (zend_hash_exists(php_stream_get_url_stream_wrappers_hash(), protocol, protocol_len)) { + if (zend_hash_exists(php_stream_get_url_stream_wrappers_hash(), protocol, protocol_len+1)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Protocol %s:// is already defined, protocol); } else { /* Hash doesn't exist so it must have been an invalid protocol scheme */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
bjori Wed Mar 25 19:55:50 2009 UTC Modified files: /php-src/main/streams userspace.c Log: Add missing proto http://cvs.php.net/viewvc.cgi/php-src/main/streams/userspace.c?r1=1.53r2=1.54diff_format=u Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.53 php-src/main/streams/userspace.c:1.54 --- php-src/main/streams/userspace.c:1.53 Tue Mar 10 23:40:01 2009 +++ php-src/main/streams/userspace.cWed Mar 25 19:55:50 2009 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: userspace.c,v 1.53 2009/03/10 23:40:01 helly Exp $ */ +/* $Id: userspace.c,v 1.54 2009/03/25 19:55:50 bjori Exp $ */ #include php.h #include php_globals.h @@ -250,6 +250,11 @@ { reset to start of dir list; } + + function stream_lock($operation) + { + return true / false; + } }}} **/ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
stasThu Aug 16 23:53:40 2007 UTC Modified files: /php-src/main/streams userspace.c Log: fix proto http://cvs.php.net/viewvc.cgi/php-src/main/streams/userspace.c?r1=1.43r2=1.44diff_format=u Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.43 php-src/main/streams/userspace.c:1.44 --- php-src/main/streams/userspace.c:1.43 Tue Jul 3 10:22:55 2007 +++ php-src/main/streams/userspace.cThu Aug 16 23:53:40 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: userspace.c,v 1.43 2007/07/03 10:22:55 dmitry Exp $ */ +/* $Id: userspace.c,v 1.44 2007/08/16 23:53:40 stas Exp $ */ #include php.h #include php_globals.h @@ -443,7 +443,7 @@ } -/* {{{ proto bool stream_wrapper_register(string protocol, string classname) +/* {{{ proto bool stream_wrapper_register(string protocol, string classname[, integer flags]) Registers a custom URL protocol handler class */ PHP_FUNCTION(stream_wrapper_register) { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
scottmacTue May 15 13:01:47 2007 UTC Modified files: /php-src/main/streams userspace.c Log: Fixed bug #41390 (Clarify error message with invalid protocol scheme syntax) http://cvs.php.net/viewvc.cgi/php-src/main/streams/userspace.c?r1=1.41r2=1.42diff_format=u Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.41 php-src/main/streams/userspace.c:1.42 --- php-src/main/streams/userspace.c:1.41 Tue Feb 13 19:50:13 2007 +++ php-src/main/streams/userspace.cTue May 15 13:01:47 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: userspace.c,v 1.41 2007/02/13 19:50:13 tony2001 Exp $ */ +/* $Id: userspace.c,v 1.42 2007/05/15 13:01:47 scottmac Exp $ */ #include php.h #include php_globals.h @@ -458,8 +458,8 @@ if (zend_hash_exists(php_stream_get_url_stream_wrappers_hash(), protocol, protocol_len)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Protocol %s:// is already defined, protocol); } else { - /* Should never happen */ - php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to register wrapper class %s to %s://, classname, protocol); + /* Hash doesn't exist so it must have been an invalid protocol scheme */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid protocol scheme specified. Unable to register wrapper class %s to %s://, classname, protocol); } } } else { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
tony2001Tue Feb 13 19:50:13 2007 UTC Modified files: /php-src/main/streams userspace.c Log: improve php_userstreamop_seek() check for errors in stream_seek() and return correct status http://cvs.php.net/viewvc.cgi/php-src/main/streams/userspace.c?r1=1.40r2=1.41diff_format=u Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.40 php-src/main/streams/userspace.c:1.41 --- php-src/main/streams/userspace.c:1.40 Wed Jan 24 21:43:47 2007 +++ php-src/main/streams/userspace.cTue Feb 13 19:50:13 2007 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: userspace.c,v 1.40 2007/01/24 21:43:47 pollita Exp $ */ +/* $Id: userspace.c,v 1.41 2007/02/13 19:50:13 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -759,6 +759,10 @@ retval = NULL; } + if (ret) { + return ret; + } + /* now determine where we are */ ZVAL_STRINGL(func_name, USERSTREAM_TELL, sizeof(USERSTREAM_TELL)-1, 0); @@ -768,16 +772,20 @@ retval, 0, NULL, 0, NULL TSRMLS_CC); - if (call_result == SUCCESS retval != NULL Z_TYPE_P(retval) == IS_LONG) + if (call_result == SUCCESS retval != NULL Z_TYPE_P(retval) == IS_LONG) { *newoffs = Z_LVAL_P(retval); - else - php_error_docref(NULL TSRMLS_CC, E_WARNING, %s:: USERSTREAM_TELL is not implemented!, - us-wrapper-classname); + ret = 0; + } else if (call_result == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, %s:: USERSTREAM_TELL is not implemented!, us-wrapper-classname); + ret = -1; + } else { + ret = -1; + } - if (retval) + if (retval) { zval_ptr_dtor(retval); - - return 0; + } + return ret; } /* parse the return value from one of the stat functions and store the -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
tony2001Mon Aug 14 15:00:05 2006 UTC Modified files: /php-src/main/streams userspace.c Log: fix #38450 (constructor is not called for classes used in userspace stream wrappers) http://cvs.php.net/viewvc.cgi/php-src/main/streams/userspace.c?r1=1.34r2=1.35diff_format=u Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.34 php-src/main/streams/userspace.c:1.35 --- php-src/main/streams/userspace.c:1.34 Sat Apr 22 23:49:39 2006 +++ php-src/main/streams/userspace.cMon Aug 14 15:00:04 2006 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: userspace.c,v 1.34 2006/04/22 23:49:39 tony2001 Exp $ */ +/* $Id: userspace.c,v 1.35 2006/08/14 15:00:04 tony2001 Exp $ */ #include php.h #include php_globals.h @@ -231,6 +231,40 @@ object_init_ex(us-object, uwrap-ce); ZVAL_REFCOUNT(us-object) = 1; PZVAL_IS_REF(us-object) = 1; + + if (uwrap-ce-constructor) { + zend_fcall_info fci; + zend_fcall_info_cache fcc; + zval *retval_ptr; + + fci.size = sizeof(fci); + fci.function_table = uwrap-ce-function_table; + fci.function_name = NULL; + fci.symbol_table = NULL; + fci.object_pp = us-object; + fci.retval_ptr_ptr = retval_ptr; + fci.param_count = 0; + fci.params = NULL; + fci.no_separation = 1; + + fcc.initialized = 1; + fcc.function_handler = uwrap-ce-constructor; + fcc.calling_scope = EG(scope); + fcc.object_pp = us-object; + + if (zend_call_function(fci, fcc TSRMLS_CC) == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Could not execute %s::%s(), uwrap-ce-name, uwrap-ce-constructor-common.function_name); + zval_dtor(us-object); + FREE_ZVAL(us-object); + efree(us); + FG(user_stream_current_filename) = NULL; + return NULL; + } else { + if (retval_ptr) { + zval_ptr_dtor(retval_ptr); + } + } + } if (context) { MAKE_STD_ZVAL(zcontext); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
hyanantha Thu Sep 23 09:07:43 2004 EDT Modified files: /php-src/main/streams userspace.c Log: CLIB_STAT_PATCH check is redundant. So removing it http://cvs.php.net/diff.php/php-src/main/streams/userspace.c?r1=1.27r2=1.28ty=u Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.27 php-src/main/streams/userspace.c:1.28 --- php-src/main/streams/userspace.c:1.27 Fri Sep 10 16:45:35 2004 +++ php-src/main/streams/userspace.cThu Sep 23 09:07:43 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: userspace.c,v 1.27 2004/09/10 20:45:35 pollita Exp $ */ +/* $Id: userspace.c,v 1.28 2004/09/23 13:07:43 hyanantha Exp $ */ #include php.h #include php_globals.h @@ -766,7 +766,7 @@ STAT_PROP_ENTRY(rdev); #endif STAT_PROP_ENTRY(size); -#if defined(NETWARE) defined(CLIB_STAT_PATCH) +#ifdef NETWARE STAT_PROP_ENTRY_EX(atime, atime.tv_sec); STAT_PROP_ENTRY_EX(mtime, mtime.tv_sec); STAT_PROP_ENTRY_EX(ctime, ctime.tv_sec); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
pollita Tue Mar 16 19:08:23 2004 EDT Modified files: /php-src/main/streams userspace.c Log: Provide a meaningful error message when registration fails http://cvs.php.net/diff.php/php-src/main/streams/userspace.c?r1=1.22r2=1.23ty=u Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.22 php-src/main/streams/userspace.c:1.23 --- php-src/main/streams/userspace.c:1.22 Mon Mar 8 18:11:45 2004 +++ php-src/main/streams/userspace.cTue Mar 16 19:08:22 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: userspace.c,v 1.22 2004/03/08 23:11:45 abies Exp $ */ +/* $Id: userspace.c,v 1.23 2004/03/17 00:08:22 pollita Exp $ */ #include php.h #include php_globals.h @@ -421,10 +421,17 @@ uwrap-ce = *(zend_class_entry**)uwrap-ce; if (php_register_url_stream_wrapper(protocol, uwrap-wrapper TSRMLS_CC) == SUCCESS) { RETURN_TRUE; + } else { + /* We failed. But why? */ + if (zend_hash_exists(php_stream_get_url_stream_wrappers_hash(), protocol, protocol_len)) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, Protocol %s:// is already defined., protocol); + } else { + /* Should never happen */ + php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to register wrapper class %s to %s://, classname, protocol); + } } } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, class '%s' is undefined, - classname); + php_error_docref(NULL TSRMLS_CC, E_WARNING, class '%s' is undefined, classname); } zend_list_delete(rsrc_id); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
wez Sun Mar 7 17:05:22 2004 EDT Modified files: /php-src/main/streams userspace.c Log: Connect feof() call to user-space stream feof() method. Fixes Bug #27417 and #27508 http://cvs.php.net/diff.php/php-src/main/streams/userspace.c?r1=1.20r2=1.21ty=u Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.20 php-src/main/streams/userspace.c:1.21 --- php-src/main/streams/userspace.c:1.20 Mon Jan 26 22:20:35 2004 +++ php-src/main/streams/userspace.cSun Mar 7 17:05:21 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: userspace.c,v 1.20 2004/01/27 03:20:35 iliaa Exp $ */ +/* $Id: userspace.c,v 1.21 2004/03/07 22:05:21 wez Exp $ */ #include php.h #include php_globals.h @@ -418,9 +418,7 @@ rsrc_id = ZEND_REGISTER_RESOURCE(NULL, uwrap, le_protocols); if (zend_hash_find(EG(class_table), uwrap-classname, classname_len + 1, (void**)uwrap-ce) == SUCCESS) { -#ifdef ZEND_ENGINE_2 uwrap-ce = *(zend_class_entry**)uwrap-ce; -#endif if (php_register_url_stream_wrapper(protocol, uwrap-wrapper TSRMLS_CC) == SUCCESS) { RETURN_TRUE; } @@ -767,16 +765,29 @@ int call_result; php_userstream_data_t *us = (php_userstream_data_t *)stream-abstract; int ret = -1; - zval *zvalue; + zval *zvalue = NULL; zval **args[1]; - MAKE_STD_ZVAL(zvalue); - ZVAL_LONG(zvalue, value); - args[0] = zvalue; - switch (option) { + case PHP_STREAM_OPTION_CHECK_LIVENESS: + ZVAL_STRINGL(func_name, USERSTREAM_EOF, sizeof(USERSTREAM_EOF)-1, 0); + call_result = call_user_function_ex(NULL, us-object, func_name, retval, 0, NULL, 0, NULL TSRMLS_CC); + if (call_result == SUCCESS retval != NULL Z_TYPE_P(retval) == IS_BOOL) { + ret = Z_LVAL_P(retval) ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR; + } else { + ret = PHP_STREAM_OPTION_RETURN_ERR; + php_error_docref(NULL TSRMLS_CC, E_WARNING, + %s:: USERSTREAM_EOF is not implemented! Assuming EOF, + us-wrapper-classname); + } + break; + case PHP_STREAM_OPTION_LOCKING: - // TODO wouldblock + MAKE_STD_ZVAL(zvalue); + ZVAL_LONG(zvalue, value); + args[0] = zvalue; + + /* TODO wouldblock */ ZVAL_STRINGL(func_name, USERSTREAM_LOCK, sizeof(USERSTREAM_LOCK)-1, 0); call_result = call_user_function_ex(NULL, @@ -789,21 +800,26 @@ ret = !Z_LVAL_P(retval); } else if (call_result == FAILURE) { if (value == 0) { - ret = 0; // lock support test (TODO: more check) + /* lock support test (TODO: more check) */ + ret = 0; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, %s:: USERSTREAM_LOCK is not implemented!, us-wrapper-classname); } } - if (retval) - zval_ptr_dtor(retval); - break; } /* clean up */ - zval_ptr_dtor(zvalue); + if (retval) { + zval_ptr_dtor(retval); + } + + + if (zvalue) { + zval_ptr_dtor(zvalue); + } return ret; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
iliaa Mon Jan 26 22:20:36 2004 EDT Modified files: /php-src/main/streams userspace.c Log: Removed unused variable. http://cvs.php.net/diff.php/php-src/main/streams/userspace.c?r1=1.19r2=1.20ty=u Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.19 php-src/main/streams/userspace.c:1.20 --- php-src/main/streams/userspace.c:1.19 Wed Jan 21 05:17:12 2004 +++ php-src/main/streams/userspace.cMon Jan 26 22:20:35 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: userspace.c,v 1.19 2004/01/21 10:17:12 hholzgra Exp $ */ +/* $Id: userspace.c,v 1.20 2004/01/27 03:20:35 iliaa Exp $ */ #include php.h #include php_globals.h @@ -1202,7 +1202,6 @@ { zval func_name; zval *retval = NULL; - zval **args[1]; php_userstream_data_t *us = (php_userstream_data_t *)stream-abstract; ZVAL_STRINGL(func_name, USERSTREAM_DIR_REWIND, sizeof(USERSTREAM_DIR_REWIND)-1, 0); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
hholzgraWed Jan 21 05:17:14 2004 EDT Modified files: /php-src/main/streams userspace.c Log: stream_lock() method added to userspace streams wrapper http://cvs.php.net/diff.php/php-src/main/streams/userspace.c?r1=1.18r2=1.19ty=u Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.18 php-src/main/streams/userspace.c:1.19 --- php-src/main/streams/userspace.c:1.18 Thu Jan 8 03:17:59 2004 +++ php-src/main/streams/userspace.cWed Jan 21 05:17:12 2004 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: userspace.c,v 1.18 2004/01/08 08:17:59 andi Exp $ */ +/* $Id: userspace.c,v 1.19 2004/01/21 10:17:12 hholzgra Exp $ */ #include php.h #include php_globals.h @@ -110,6 +110,7 @@ #define USERSTREAM_DIR_READdir_readdir #define USERSTREAM_DIR_REWIND dir_rewinddir #define USERSTREAM_DIR_CLOSE dir_closedir +#define USERSTREAM_LOCK stream_lock /* {{{ class should have methods like these: @@ -759,6 +760,55 @@ return ret; } + +static int php_userstreamop_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC) { + zval func_name; + zval *retval = NULL; + int call_result; + php_userstream_data_t *us = (php_userstream_data_t *)stream-abstract; + int ret = -1; + zval *zvalue; + zval **args[1]; + + MAKE_STD_ZVAL(zvalue); + ZVAL_LONG(zvalue, value); + args[0] = zvalue; + + switch (option) { + case PHP_STREAM_OPTION_LOCKING: + // TODO wouldblock + ZVAL_STRINGL(func_name, USERSTREAM_LOCK, sizeof(USERSTREAM_LOCK)-1, 0); + + call_result = call_user_function_ex(NULL, + us-object, + func_name, + retval, + 1, args, 0, NULL TSRMLS_CC); + + if (call_result == SUCCESS retval != NULL Z_TYPE_P(retval) == IS_BOOL) { + ret = !Z_LVAL_P(retval); + } else if (call_result == FAILURE) { + if (value == 0) { + ret = 0; // lock support test (TODO: more check) + } else { + php_error_docref(NULL TSRMLS_CC, E_WARNING, %s:: USERSTREAM_LOCK is not implemented!, + us-wrapper-classname); + } + } + + if (retval) + zval_ptr_dtor(retval); + + break; + } + + /* clean up */ + zval_ptr_dtor(zvalue); + + return ret; +} + + static int user_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper-abstract; @@ -1152,6 +1202,7 @@ { zval func_name; zval *retval = NULL; + zval **args[1]; php_userstream_data_t *us = (php_userstream_data_t *)stream-abstract; ZVAL_STRINGL(func_name, USERSTREAM_DIR_REWIND, sizeof(USERSTREAM_DIR_REWIND)-1, 0); @@ -1175,8 +1226,8 @@ user-space, php_userstreamop_seek, NULL, /* cast */ - php_userstreamop_stat, /* stat */ - NULL /* set_option */ + php_userstreamop_stat, + php_userstreamop_set_option, }; php_stream_ops php_stream_userspace_dir_ops = { -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
pollita Sat Dec 13 18:13:52 2003 EDT Modified files: /php-src/main/streams userspace.c Log: Export STREAM_MKDIR_RECURSIVE constant Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.15 php-src/main/streams/userspace.c:1.16 --- php-src/main/streams/userspace.c:1.15 Fri Dec 12 23:07:14 2003 +++ php-src/main/streams/userspace.cSat Dec 13 18:13:51 2003 @@ -17,7 +17,7 @@ +--+ */ -/* $Id: userspace.c,v 1.15 2003/12/13 04:07:14 pollita Exp $ */ +/* $Id: userspace.c,v 1.16 2003/12/13 23:13:51 pollita Exp $ */ #include php.h #include php_globals.h @@ -80,6 +80,7 @@ REGISTER_LONG_CONSTANT(STREAM_URL_STAT_LINK, PHP_STREAM_URL_STAT_LINK, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(STREAM_URL_STAT_QUIET, PHP_STREAM_URL_STAT_QUIET, CONST_CS|CONST_PERSISTENT); + REGISTER_LONG_CONSTANT(STREAM_MKDIR_RECURSIVE, PHP_STREAM_MKDIR_RECURSIVE, CONST_CS|CONST_PERSISTENT); return SUCCESS; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
pollita Tue Dec 2 13:52:59 2003 EDT Modified files: /php-src/main/streams userspace.c Log: Update userspace/url_stat proto Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.10 php-src/main/streams/userspace.c:1.11 --- php-src/main/streams/userspace.c:1.10 Sat Sep 13 11:27:08 2003 +++ php-src/main/streams/userspace.cTue Dec 2 13:52:58 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: userspace.c,v 1.10 2003/09/13 15:27:08 abies Exp $ */ +/* $Id: userspace.c,v 1.11 2003/12/02 18:52:58 pollita Exp $ */ #include php.h #include php_globals.h @@ -32,7 +32,7 @@ }; static php_stream *user_wrapper_opener(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); -static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, php_stream_statbuf *ssb TSRMLS_DC); +static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC); static int user_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC); static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, char *filename, char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC); @@ -145,7 +145,7 @@ return array( just like that returned by fstat() ); } - function url_stat(string $url) + function url_stat(string $url, int $flags) { return array( just like that returned by stat() ); } @@ -766,11 +766,11 @@ return ret; } -static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, php_stream_statbuf *ssb TSRMLS_DC) +static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper-abstract; - zval *zfilename, *zfuncname, *zretval; - zval **args[1]; + zval *zfilename, *zfuncname, *zretval, *zflags; + zval **args[2]; int call_result; zval *object; int ret = -1; @@ -788,6 +788,10 @@ ZVAL_STRING(zfilename, url, 1); args[0] = zfilename; + MAKE_STD_ZVAL(zflags); + ZVAL_LONG(zflags, flags); + args[1] = zflags; + MAKE_STD_ZVAL(zfuncname); ZVAL_STRING(zfuncname, USERSTREAM_STATURL, 1); @@ -795,7 +799,7 @@ object, zfuncname, zretval, - 1, args, + 2, args, 0, NULL TSRMLS_CC); if (call_result == SUCCESS zretval != NULL Z_TYPE_P(zretval) == IS_ARRAY) { @@ -816,6 +820,7 @@ zval_ptr_dtor(zfuncname); zval_ptr_dtor(zfilename); + zval_ptr_dtor(zflags); return ret; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-CVS] cvs: php-src /main/streams userspace.c
pollita Tue Dec 2 14:14:32 2003 EDT Modified files: /php-src/main/streams userspace.c Log: Populate userstream objects with context property Index: php-src/main/streams/userspace.c diff -u php-src/main/streams/userspace.c:1.11 php-src/main/streams/userspace.c:1.12 --- php-src/main/streams/userspace.c:1.11 Tue Dec 2 13:52:58 2003 +++ php-src/main/streams/userspace.cTue Dec 2 14:14:31 2003 @@ -16,7 +16,7 @@ +--+ */ -/* $Id: userspace.c,v 1.11 2003/12/02 18:52:58 pollita Exp $ */ +/* $Id: userspace.c,v 1.12 2003/12/02 19:14:31 pollita Exp $ */ #include php.h #include php_globals.h @@ -284,7 +284,7 @@ { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper-abstract; php_userstream_data_t *us; - zval *zfilename, *zoptions, *zretval = NULL, *zfuncname; + zval *zfilename, *zoptions, *zretval = NULL, *zfuncname, *zcontext; zval **args[2]; int call_result; php_stream *stream = NULL; @@ -304,6 +304,17 @@ object_init_ex(us-object, uwrap-ce); ZVAL_REFCOUNT(us-object) = 1; PZVAL_IS_REF(us-object) = 1; + + if (context) { + MAKE_STD_ZVAL(zcontext); + php_stream_context_to_zval(context, zcontext); + add_property_zval(us-object, context, zcontext); + /* The object property should be the only reference, + 'get rid' of our local reference. */ + zval_ptr_dtor(zcontext); + } else { + add_property_null(us-object, context); + } /* call it's dir_open method - set up params first */ MAKE_STD_ZVAL(zfilename); @@ -722,7 +733,7 @@ static int user_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int options, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper-abstract; - zval *zfilename, *zfuncname, *zretval; + zval *zfilename, *zfuncname, *zretval, *zcontext; zval **args[1]; int call_result; zval *object; @@ -734,6 +745,17 @@ ZVAL_REFCOUNT(object) = 1; PZVAL_IS_REF(object) = 1; + if (context) { + MAKE_STD_ZVAL(zcontext); + php_stream_context_to_zval(context, zcontext); + add_property_zval(object, context, zcontext); + /* The object property should be the only reference, + 'get rid' of our local reference. */ + zval_ptr_dtor(zcontext); + } else { + add_property_null(object, context); + } + /* call the unlink method */ MAKE_STD_ZVAL(zfilename); ZVAL_STRING(zfilename, url, 1); @@ -769,7 +791,7 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, int flags, php_stream_statbuf *ssb, php_stream_context *context TSRMLS_DC) { struct php_user_stream_wrapper *uwrap = (struct php_user_stream_wrapper*)wrapper-abstract; - zval *zfilename, *zfuncname, *zretval, *zflags; + zval *zfilename, *zfuncname, *zretval, *zflags, *zcontext; zval **args[2]; int call_result; zval *object; @@ -781,6 +803,17 @@ ZVAL_REFCOUNT(object) = 1; PZVAL_IS_REF(object) = 1; + if (context) { + MAKE_STD_ZVAL(zcontext); + php_stream_context_to_zval(context, zcontext); + add_property_zval(object, context, zcontext); + /* The object property should be the only reference, + 'get rid' of our local reference. */ + zval_ptr_dtor(zcontext); + } else { + add_property_null(object, context); + } + /* call the stat_url method */ /* call it's stream_open method - set up params first */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php