@@ -451,6 +451,19 @@ static int browser_reg_compare(zval **browser TSRMLS_DC, int num_args, va_list a
451
451
}
452
452
/* }}} */
453
453
454
+ static void browscap_zval_copy_ctor (zval * * p ) /* {{{ */
455
+ {
456
+ zval * new ;
457
+
458
+ ALLOC_ZVAL (new );
459
+ * new = * * p ;
460
+
461
+ zval_copy_ctor (new );
462
+
463
+ INIT_PZVAL (new );
464
+ * p = new ;
465
+ } /* }}} */
466
+
454
467
/* {{{ proto mixed get_browser([string browser_name [, bool return_array]])
455
468
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. */
456
469
PHP_FUNCTION (get_browser )
@@ -511,11 +524,11 @@ PHP_FUNCTION(get_browser)
511
524
512
525
if (return_array ) {
513
526
array_init (return_value );
514
- zend_hash_copy (Z_ARRVAL_P (return_value ), Z_ARRVAL_PP (agent ), (copy_ctor_func_t ) zval_add_ref , (void * ) & tmp_copy , sizeof (zval * ));
527
+ 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 * ));
515
528
}
516
529
else {
517
530
object_init (return_value );
518
- zend_hash_copy (Z_OBJPROP_P (return_value ), Z_ARRVAL_PP (agent ), (copy_ctor_func_t ) zval_add_ref , (void * ) & tmp_copy , sizeof (zval * ));
531
+ 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 * ));
519
532
}
520
533
521
534
while (zend_hash_find (Z_ARRVAL_PP (agent ), "parent" , sizeof ("parent" ), (void * * ) & z_agent_name ) == SUCCESS ) {
@@ -524,10 +537,10 @@ PHP_FUNCTION(get_browser)
524
537
}
525
538
526
539
if (return_array ) {
527
- 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 );
540
+ 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 );
528
541
}
529
542
else {
530
- 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 );
543
+ 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 );
531
544
}
532
545
}
533
546
0 commit comments