]> granicus.if.org Git - php/commitdiff
make next() return a single value instead of an array with one element
authorHarald Radi <phanto@php.net>
Tue, 14 Aug 2001 00:28:54 +0000 (00:28 +0000)
committerHarald Radi <phanto@php.net>
Tue, 14 Aug 2001 00:28:54 +0000 (00:28 +0000)
ext/com/COM.c
ext/rpc/com/com_wrapper.c

index 0063f426b1834195ff21be7f407fbd0ba256e7df..aeae84ddcfefc9fd2616e06941216f25bfe0029e 100644 (file)
@@ -741,6 +741,15 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **
                        }
                }
 
+               /* return a single element if next() was called without count */
+               if((arg_count == 0) && (count == 1))
+               {
+                       long index[] = {1};
+
+                       SafeArrayGetElement(pSA, index, var_result);
+                       SafeArrayDestroy(pSA);
+               }
+
                return SUCCESS;
        }
        else if(C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "reset"))
index 0063f426b1834195ff21be7f407fbd0ba256e7df..aeae84ddcfefc9fd2616e06941216f25bfe0029e 100644 (file)
@@ -741,6 +741,15 @@ int do_COM_invoke(comval *obj, pval *function_name, VARIANT *var_result, pval **
                        }
                }
 
+               /* return a single element if next() was called without count */
+               if((arg_count == 0) && (count == 1))
+               {
+                       long index[] = {1};
+
+                       SafeArrayGetElement(pSA, index, var_result);
+                       SafeArrayDestroy(pSA);
+               }
+
                return SUCCESS;
        }
        else if(C_HASENUM(obj) && strstr(Z_STRVAL_P(function_name), "reset"))