Skip to content

Commit

Permalink
Fix #76556: get_debug_info handler for BreakIterator shows wrong type
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cmb69 committed Jun 30, 2018
1 parent 9b0df97 commit 1118fca
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ PHP NEWS
. Fixed bug #73342 (Vulnerability in php-fpm by changing stdin to
non-blocking). (Nikita)

- intl:
. Fixed bug #76556 (get_debug_info handler for BreakIterator shows wrong
type). (cmb)

- mbstring:
. Fixed bug #76532 (Integer overflow and excessive memory usage
in mb_strimwidth). (MarcusSchwarz)
Expand Down
2 changes: 1 addition & 1 deletion ext/intl/breakiterator/breakiterator_class.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static HashTable *BreakIterator_get_debug_info(zval *object, int *is_temp)
}

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

return debug_info;
}
Expand Down
23 changes: 23 additions & 0 deletions ext/intl/tests/bug76556.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
--TEST--
Bug #76556 (get_debug_info handler for BreakIterator shows wrong type)
--SKIPIF--
<?php
if (!extension_loaded('intl')) die('skip intl extension not available');
?>
--FILE--
<?php
$it = IntlBreakIterator::createCharacterInstance();
$it->setText('foo');
var_dump($it);
?>
===DONE===
--EXPECTF--
object(IntlRuleBasedBreakIterator)#%d (3) {
["valid"]=>
bool(true)
["text"]=>
string(3) "foo"
["type"]=>
string(%d) "%sRuleBasedBreakIterator%s"
}
===DONE===

0 comments on commit 1118fca

Please sign in to comment.