Skip to content

Commit

Permalink
Fixed bug #76337
Browse files Browse the repository at this point in the history
  • Loading branch information
xKerman authored and weltling committed May 20, 2018
1 parent a8a1dc0 commit 5681f65
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Zend/tests/bug76337.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--TEST--
Bug 76337: segmentation fault when an extension use zend_register_class_alias() and opcache enabled
--SKIPIF--
<?php if (!class_exists('_ZendTestClass') || !extension_loaded('Zend OPcache')) die('skip');
--INI--
opcache.enable=1
opcache.enable_cli=1
--FILE--
<?php
var_dump(class_exists('_ZendTestClassAlias'));
--EXPECT--
bool(true)
1 change: 1 addition & 0 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -2785,6 +2785,7 @@ ZEND_API int zend_register_class_alias_ex(const char *name, size_t name_len, zen

zend_assert_valid_class_name(lcname);

lcname = zend_new_interned_string(lcname);
ce = zend_hash_add_ptr(CG(class_table), lcname, ce);
zend_string_release(lcname);
if (ce) {
Expand Down
2 changes: 2 additions & 0 deletions ext/zend_test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,8 @@ PHP_MINIT_FUNCTION(zend_test)
zend_test_trait = zend_register_internal_class(&class_entry);
zend_test_trait->ce_flags |= ZEND_ACC_TRAIT;
zend_declare_property_null(zend_test_trait, "testProp", sizeof("testProp")-1, ZEND_ACC_PUBLIC);

zend_register_class_alias("_ZendTestClassAlias", zend_test_class);
return SUCCESS;
}

Expand Down

0 comments on commit 5681f65

Please sign in to comment.