mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Fixed bug #70681
This commit is contained in:
parent
505c9c3742
commit
bbae7ddf29
3 changed files with 21 additions and 0 deletions
4
NEWS
4
NEWS
|
@ -2,6 +2,10 @@ PHP NEWS
|
||||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||
?? ??? 2015, PHP 5.6.15
|
?? ??? 2015, PHP 5.6.15
|
||||||
|
|
||||||
|
- Core:
|
||||||
|
. Fixed bug #70681 (Segfault when binding $this of internal instance method
|
||||||
|
to null). (Nikita)
|
||||||
|
|
||||||
- Date:
|
- Date:
|
||||||
. Fixed bug #70619 (DateTimeImmutable segfault). (Laruence)
|
. Fixed bug #70619 (DateTimeImmutable segfault). (Laruence)
|
||||||
|
|
||||||
|
|
11
Zend/tests/bug70681.phpt
Normal file
11
Zend/tests/bug70681.phpt
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
--TEST--
|
||||||
|
Bug #70681: Segfault when binding $this of internal instance method to null
|
||||||
|
--FILE--
|
||||||
|
<?php
|
||||||
|
|
||||||
|
$c = (new ReflectionMethod('SplStack', 'count'))->getClosure(new SplStack);
|
||||||
|
$c = $c->bindTo(null);
|
||||||
|
|
||||||
|
?>
|
||||||
|
--EXPECTF--
|
||||||
|
Warning: Cannot unbind $this of internal method in %s on line %d
|
|
@ -88,6 +88,12 @@ ZEND_METHOD(Closure, bind)
|
||||||
zend_error(E_WARNING, "Cannot bind an instance to a static closure");
|
zend_error(E_WARNING, "Cannot bind an instance to a static closure");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newthis == NULL && !(closure->func.common.fn_flags & ZEND_ACC_STATIC)
|
||||||
|
&& closure->func.type == ZEND_INTERNAL_FUNCTION) {
|
||||||
|
zend_error(E_WARNING, "Cannot unbind $this of internal method");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (scope_arg != NULL) { /* scope argument was given */
|
if (scope_arg != NULL) { /* scope argument was given */
|
||||||
if (IS_ZEND_STD_OBJECT(*scope_arg)) {
|
if (IS_ZEND_STD_OBJECT(*scope_arg)) {
|
||||||
ce = Z_OBJCE_P(scope_arg);
|
ce = Z_OBJCE_P(scope_arg);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue