com php-src: Fix #76556: get_debug_info handler for B reakIterator shows wrong type: NEWS ext/intl/breaki terator/breakiterator_class.cpp
ext/intl/tests/bug76 556.phpt
| From: | Christoph Michael Becker | Date: | Sat, 30 Jun 2018 21:15:02 +0000 |
| Subject: | com php-src: Fix #76556: get_debug_info handler for B reakIterator shows wrong type: NEWS ext/intl/breaki terator/breakiterator_class.cpp ext/intl/tests/bug76 556.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-102348@lists.php.net to get a copy of this message | ||
Commit: 1118fca75dca112e7a6aa60296626733ccfc4284
Author: Christoph M. Becker <cmbecker69@gmx.de> Sat, 30 Jun 2018 19:41:55 +0200
Parents: 9b0df97a42749464069859c5ca77c0241a8b05ca
Branches: PHP-7.1 PHP-7..2 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1118fca75dca112e7a6aa60296626733ccfc4284
Log:
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
Bugs:
https://bugs.php.net/76556
Changed paths:
M NEWS
M ext/intl/breakiterator/breakiterator_class.cpp
A ext/intl/tests/bug76556.phpt
Diff:
diff --git a/NEWS b/NEWS
index d21ff66..b2310d8 100644
--- a/NEWS
+++ b/NEWS
@@ -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)
diff --git a/ext/intl/breakiterator/breakiterator_class.cpp
b/ext/intl/breakiterator/breakiterator_class.cpp
index ae9e258..cc38654 100644
--- a/ext/intl/breakiterator/breakiterator_class.cpp
+++ b/ext/intl/breakiterator/breakiterator_class.cpp
@@ -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;
}
diff --git a/ext/intl/tests/bug76556.phpt b/ext/intl/tests/bug76556.phpt
new file mode 100644
index 0000000...57395fb
--- /dev/null
+++ b/ext/intl/tests/bug76556.phpt
@@ -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===