cvs: ZendEngine2 / zend_API.c

From: Date: Mon, 24 Nov 2008 19:17:24 +0000
Subject: cvs: ZendEngine2 / zend_API.c
Groups: php.zend-engine.cvs 
Request: Send a blank email to php-zend-engine-cvs+get-7231@lists.php.net to get a copy of this message
stas Mon Nov 24 19:17:24 2008 UTC Modified files: /ZendEngine2 zend_API.c Log: add object-compatible array parameters http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_API.c?r1=1.490&r2=1.491&diff_format=u Index: ZendEngine2/zend_API.c diff -u ZendEngine2/zend_API.c:1.490 ZendEngine2/zend_API.c:1.491 --- ZendEngine2/zend_API.c:1.490 Fri Oct 10 15:19:22 2008 +++ ZendEngine2/zend_API.c Mon Nov 24 19:17:24 2008 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: zend_API.c,v 1.490 2008/10/10 15:19:22 dmitry Exp $ */ +/* $Id: zend_API.c,v 1.491 2008/11/24 19:17:24 stas Exp $ */ #include "zend.h" #include "zend_execute.h" @@ -319,7 +319,7 @@ { char *spec_walk = *spec; char c = *spec_walk++; - int return_null = 0; + int return_null = 0, obj_array = 0; int alternate_form = 0; int return_orig_type = 0; zend_uchar orig_type; @@ -686,7 +686,8 @@ } } break; - + case 'A': + obj_array = 1; case 'a': { zval **p = va_arg(*va, zval **); @@ -694,14 +695,15 @@ *p = NULL; break; } - if (Z_TYPE_PP(arg) == IS_ARRAY) { + if (Z_TYPE_PP(arg) == IS_ARRAY || (Z_TYPE_PP(arg) == IS_OBJECT && obj_array != 0)) { *p = *arg; } else { return "array"; } } break; - + case 'H': + obj_array = 1; case 'h': { HashTable **p = va_arg(*va, HashTable **); @@ -711,6 +713,11 @@ } if (Z_TYPE_PP(arg) == IS_ARRAY) { *p = Z_ARRVAL_PP(arg); + } else if(obj_array && Z_TYPE_PP(arg) == IS_OBJECT) { + *p = HASH_OF(*arg); + if(*p == NULL) { + return "array"; + } } else { return "array"; } @@ -915,6 +922,7 @@ case 'C': case 'h': case 'U': case 'S': case 'f': case 'x': + case 'A': case 'H': max_num_args++; break;

« previous php.zend-engine.cvs (#7231) next »