diff options
author | Anatol Belski <ab@php.net> | 2013-06-06 18:51:32 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2013-06-06 18:51:32 +0200 |
commit | 25cae37b13e76f91546e314c62822a9f85e6d408 (patch) | |
tree | cc938dd6d71f5f66f62b45d414f871ee188159dc /ext/standard | |
parent | 5ee047b4862dd9fc110b02ddc3b5a3e521424a3a (diff) | |
parent | 1aee7ad63672747bd941f169ef42bed5765137e0 (diff) | |
download | php-git-25cae37b13e76f91546e314c62822a9f85e6d408.tar.gz |
Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
Fixed bug #64934 Apache2 TS crash with get_browser()
Diffstat (limited to 'ext/standard')
-rw-r--r-- | ext/standard/browscap.c | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index 1e1252f60a..ed773b851c 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -451,6 +451,19 @@ static int browser_reg_compare(zval **browser TSRMLS_DC, int num_args, va_list a } /* }}} */ +static void browscap_zval_copy_ctor(zval **p) /* {{{ */ +{ + zval *new; + + ALLOC_ZVAL(new); + *new = **p; + + zval_copy_ctor(new); + + INIT_PZVAL(new); + *p = new; +} /* }}} */ + /* {{{ proto mixed get_browser([string browser_name [, bool return_array]]) Get information about the capabilities of a browser. If browser_name is omitted or null, HTTP_USER_AGENT is used. Returns an object by default; if return_array is true, returns an array. */ PHP_FUNCTION(get_browser) @@ -511,11 +524,11 @@ PHP_FUNCTION(get_browser) if (return_array) { array_init(return_value); - zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *)); + zend_hash_copy(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) browscap_zval_copy_ctor, (void *) &tmp_copy, sizeof(zval *)); } else { object_init(return_value); - zend_hash_copy(Z_OBJPROP_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *)); + zend_hash_copy(Z_OBJPROP_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) browscap_zval_copy_ctor, (void *) &tmp_copy, sizeof(zval *)); } while (zend_hash_find(Z_ARRVAL_PP(agent), "parent", sizeof("parent"), (void **) &z_agent_name) == SUCCESS) { @@ -524,10 +537,10 @@ PHP_FUNCTION(get_browser) } if (return_array) { - zend_hash_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *), 0); + zend_hash_merge(Z_ARRVAL_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) browscap_zval_copy_ctor, (void *) &tmp_copy, sizeof(zval *), 0); } else { - zend_hash_merge(Z_OBJPROP_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *), 0); + zend_hash_merge(Z_OBJPROP_P(return_value), Z_ARRVAL_PP(agent), (copy_ctor_func_t) browscap_zval_copy_ctor, (void *) &tmp_copy, sizeof(zval *), 0); } } |