Skip to content

Commit

Permalink
Fix #77360: class_uses causes segfault
Browse files Browse the repository at this point in the history
(cherry picked from commit 16c62a8)
  • Loading branch information
Metabolix authored and cmb69 committed Jan 7, 2019
1 parent 7d638d0 commit f45ed83
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/php_spl.c
Expand Up @@ -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);
}
Expand Down
19 changes: 19 additions & 0 deletions 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"

0 comments on commit f45ed83

Please sign in to comment.