From f45ed833d1c7b08c868c0dc6847611e2b79bb65e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauri=20Kentt=C3=A4?= Date: Thu, 27 Dec 2018 16:16:29 +0200 Subject: Fix #77360: class_uses causes segfault (cherry picked from commit 16c62a81795c253724a957d32e242545bb05253d) --- 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 e263b92add..d9c98a2d01 100644 --- a/NEWS +++ b/NEWS @@ -59,6 +59,7 @@ PHP NEWS - SPL: . Fixed bug #77359 (spl_autoload causes segfault). (Lauri Kenttä) + . Fixed bug #77360 (class_uses causes segfault). (Lauri Kenttä) - SQLite3: . Fixed bug #77051 (Issue with re-binding on SQLite3). (BohwaZ) 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" -- cgit v1.2.1