diff options
author | Lauri Kenttä <lauri.kentta@gmail.com> | 2018-12-27 16:16:29 +0200 |
---|---|---|
committer | Christoph M. Becker <cmbecker69@gmx.de> | 2019-01-07 13:01:39 +0100 |
commit | f45ed833d1c7b08c868c0dc6847611e2b79bb65e (patch) | |
tree | 2f57546435428d40d771ab21abbceabadda4529f | |
parent | 7d638d0880b6f759706ca46da8e6f7a5d8728959 (diff) | |
download | php-git-f45ed833d1c7b08c868c0dc6847611e2b79bb65e.tar.gz |
Fix #77360: class_uses causes segfault
(cherry picked from commit 16c62a81795c253724a957d32e242545bb05253d)
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | ext/spl/php_spl.c | 2 | ||||
-rw-r--r-- | ext/spl/tests/bug77360.phpt | 19 |
3 files changed, 21 insertions, 1 deletions
@@ -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-- +<?php + +class foobar {} +$str = "foo"; +$str .= "bar"; +var_dump(class_uses($str, false)); +var_dump(class_uses($str, false)); +var_dump($str); + +?> +--EXPECT-- +array(0) { +} +array(0) { +} +string(6) "foobar" |