Skip to content

Commit 1118fca

Browse files
committed
Fix #76556: get_debug_info handler for BreakIterator shows wrong type
We use the retrieved type for the "type" element instead of the text. This has been confused during the PHP 7 upgrade[1]. [1] http://git.php.net/?p=php-src.git;a=commit;h=1d793348067e5769144c0f7efd86428a4137baec
1 parent 9b0df97 commit 1118fca

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ PHP NEWS
1515
. Fixed bug #73342 (Vulnerability in php-fpm by changing stdin to
1616
non-blocking). (Nikita)
1717

18+
- intl:
19+
. Fixed bug #76556 (get_debug_info handler for BreakIterator shows wrong
20+
type). (cmb)
21+
1822
- mbstring:
1923
. Fixed bug #76532 (Integer overflow and excessive memory usage
2024
in mb_strimwidth). (MarcusSchwarz)

ext/intl/breakiterator/breakiterator_class.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp)
167167
}
168168

169169
ZVAL_STRING(&val, const_cast<char*>(typeid(*biter).name()));
170-
zend_hash_str_update(debug_info, "type", sizeof("type") - 1, &bio->text);
170+
zend_hash_str_update(debug_info, "type", sizeof("type") - 1, &val);
171171

172172
return debug_info;
173173
}

ext/intl/tests/bug76556.phpt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
Bug #76556 (get_debug_info handler for BreakIterator shows wrong type)
3+
--SKIPIF--
4+
<?php
5+
if (!extension_loaded('intl')) die('skip intl extension not available');
6+
?>
7+
--FILE--
8+
<?php
9+
$it = IntlBreakIterator::createCharacterInstance();
10+
$it->setText('foo');
11+
var_dump($it);
12+
?>
13+
===DONE===
14+
--EXPECTF--
15+
object(IntlRuleBasedBreakIterator)#%d (3) {
16+
["valid"]=>
17+
bool(true)
18+
["text"]=>
19+
string(3) "foo"
20+
["type"]=>
21+
string(%d) "%sRuleBasedBreakIterator%s"
22+
}
23+
===DONE===

0 commit comments

Comments
 (0)