summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorSara Golemon <pollita@php.net>2003-12-02 19:14:31 +0000
committerSara Golemon <pollita@php.net>2003-12-02 19:14:31 +0000
commit1aaf7da2ceb5ca059c9270318641e210c7cccecd (patch)
tree96e3d8ca72c2f5d54c21e7b109d8a0184bde100c /main
parent88ccc6a630286258309f51e6a59a11924ce23e7c (diff)
downloadphp-git-1aaf7da2ceb5ca059c9270318641e210c7cccecd.tar.gz
Populate userstream objects with context property
Diffstat (limited to 'main')
-rw-r--r--main/streams/userspace.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/main/streams/userspace.c b/main/streams/userspace.c
index 53dce83195..d1203a7afa 100644
--- a/main/streams/userspace.c
+++ b/main/streams/userspace.c
@@ -284,7 +284,7 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, char *filen
{
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 @@ static php_stream *user_wrapper_opendir(php_stream_wrapper *wrapper, char *filen
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 php_userstreamop_stat(php_stream *stream, php_stream_statbuf *ssb TSR
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 @@ static int user_wrapper_unlink(php_stream_wrapper *wrapper, char *url, int optio
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_unlink(php_stream_wrapper *wrapper, char *url, int optio
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 @@ static int user_wrapper_stat_url(php_stream_wrapper *wrapper, char *url, int fla
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 */