]> granicus.if.org Git - php/commitdiff
Better convert
authorXinchen Hui <laruence@php.net>
Wed, 22 Oct 2014 09:25:41 +0000 (17:25 +0800)
committerXinchen Hui <laruence@php.net>
Wed, 22 Oct 2014 09:25:41 +0000 (17:25 +0800)
ext/standard/string.c

index 706a3eb07538b7f8a5bc9638c67005d23c1ea88f..e7578218136bbf234749bf251f34f5e297330d13 100644 (file)
@@ -1663,12 +1663,10 @@ static int php_needle_char(zval *needle, char *target TSRMLS_DC)
                        return SUCCESS;
                case IS_OBJECT:
                        {
-                               zval holder = *needle;
-                               zval_copy_ctor(&(holder));
-                               convert_to_long(&(holder));
-                               if(Z_TYPE(holder) != IS_LONG) {
-                                       return FAILURE;
-                               }
+                               zval holder;
+                          
+                               ZVAL_LONG(&holder, zval_get_long(needle));
+
                                *target = (char)Z_LVAL(holder);
                                return SUCCESS;
                        }