diff options
author | Anatol Belski <ab@php.net> | 2017-09-12 12:13:42 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2017-09-12 12:13:42 +0200 |
commit | 05c65de0829a51e25958c0fc6e157fee78811206 (patch) | |
tree | addef77eabbc01e7da5a84657523b576e1f2a1c0 | |
parent | 0cb5a2cb49f19be4f702d445cb3c31816f9797bd (diff) | |
parent | b09497c0e2b923efef5c6c30789bc82687af9e26 (diff) | |
download | php-git-05c65de0829a51e25958c0fc6e157fee78811206.tar.gz |
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
Fixed bug #75193 segfault in collator_convert_object_to_string
-rw-r--r-- | ext/intl/collator/collator_sort.c | 8 | ||||
-rw-r--r-- | ext/intl/tests/bug75193.phpt | 14 |
2 files changed, 20 insertions, 2 deletions
diff --git a/ext/intl/collator/collator_sort.c b/ext/intl/collator/collator_sort.c index 4fc5f6a8e8..111dbeb195 100644 --- a/ext/intl/collator/collator_sort.c +++ b/ext/intl/collator/collator_sort.c @@ -59,8 +59,12 @@ static int collator_regular_compare_function(zval *result, zval *op1, zval *op2) zval norm1, norm2; zval *num1_p = NULL, *num2_p = NULL; zval *norm1_p = NULL, *norm2_p = NULL; - zval* str1_p = collator_convert_object_to_string( op1, &str1 ); - zval* str2_p = collator_convert_object_to_string( op2, &str2 ); + zval *str1_p, *str2_p; + + ZVAL_NULL(&str1); + str1_p = collator_convert_object_to_string( op1, &str1 ); + ZVAL_NULL(&str2); + str2_p = collator_convert_object_to_string( op2, &str2 ); /* If both args are strings AND either of args is not numeric string * then use ICU-compare. Otherwise PHP-compare. */ diff --git a/ext/intl/tests/bug75193.phpt b/ext/intl/tests/bug75193.phpt new file mode 100644 index 0000000000..d6c32dbe26 --- /dev/null +++ b/ext/intl/tests/bug75193.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #75193 segfault in collator_convert_object_to_string +--SKIPIF-- +<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?> +--FILE-- +<?php +$a = new \Collator('en_US'); +$b = [new stdclass, new stdclass]; +var_dump($a->sort($b)); +?> +===DONE=== +--EXPECT-- +bool(true) +===DONE=== |