Skip to content

Commit eb61c4d

Browse files
authored
Merge pull request #506 from redbullmarky/php8
Segfault fix when using empty()
2 parents eb66c66 + 79a4680 commit eb61c4d

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

tests/issue_504_001.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Test empty() : Segmentation fault caused by 'empty' check on a V8Function object
3+
--SKIPIF--
4+
<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
5+
--FILE--
6+
<?php
7+
$v = new \V8Js();
8+
$r = $v->executeString('
9+
a = {
10+
main: function() {}
11+
};
12+
', null, V8Js::FLAG_FORCE_ARRAY | V8Js::FLAG_PROPAGATE_PHP_EXCEPTIONS);
13+
14+
if (!empty($r['main'])) {
15+
echo 'Ok' . PHP_EOL;
16+
}
17+
?>
18+
--EXPECTF--
19+
Ok
20+

v8js_v8object_class.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -933,7 +933,6 @@ PHP_MINIT_FUNCTION(v8js_v8object_class) /* {{{ */
933933
/* V8<Object|Function> handlers */
934934
memcpy(&v8js_v8object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
935935
v8js_v8object_handlers.clone_obj = NULL;
936-
v8js_v8object_handlers.cast_object = NULL;
937936
v8js_v8object_handlers.get_property_ptr_ptr = v8js_v8object_get_property_ptr_ptr;
938937
v8js_v8object_handlers.has_property = v8js_v8object_has_property;
939938
v8js_v8object_handlers.read_property = v8js_v8object_read_property;

0 commit comments

Comments
 (0)