From 16c62a81795c253724a957d32e242545bb05253d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lauri=20Kentt=C3=A4?= Date: Thu, 27 Dec 2018 16:16:29 +0200 Subject: [PATCH] Fix #77360: class_uses causes segfault --- NEWS | 1 + ext/spl/php_spl.c | 2 +- ext/spl/tests/bug77360.phpt | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 ext/spl/tests/bug77360.phpt diff --git a/NEWS b/NEWS index df3dbc2b54..a4b9d1f3a5 100644 --- a/NEWS +++ b/NEWS @@ -18,6 +18,7 @@ PHP NEWS . Fixed bug #77298 (segfault occurs when add property to unserialized empty ArrayObject). (jhdxr) . Fixed bug #77359 (spl_autoload causes segfault). (Lauri Kenttä) + . Fixed bug #77360 (class_uses causes segfault). (Lauri Kenttä) 03 Jan 2019, PHP 7.3.1 diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c index b5379baae0..4da4201f88 100644 --- a/ext/spl/php_spl.c +++ b/ext/spl/php_spl.c @@ -69,7 +69,7 @@ static zend_class_entry * spl_find_ce_by_name(zend_string *name, zend_bool autol zend_string *lc_name = zend_string_tolower(name); ce = zend_hash_find_ptr(EG(class_table), lc_name); - zend_string_free(lc_name); + zend_string_release(lc_name); } else { ce = zend_lookup_class(name); } diff --git a/ext/spl/tests/bug77360.phpt b/ext/spl/tests/bug77360.phpt new file mode 100644 index 0000000000..2afa535cd1 --- /dev/null +++ b/ext/spl/tests/bug77360.phpt @@ -0,0 +1,19 @@ +--TEST-- +Bug #77360: class_uses causes segfault +--FILE-- + +--EXPECT-- +array(0) { +} +array(0) { +} +string(6) "foobar" -- 2.40.0