Skip to content

Commit 6fd6ad8

Browse files
committed
Fixed bug #78658
1 parent cbf589b commit 6fd6ad8

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 7.3.12
44

5+
- Core:
6+
. Fixed bug #78658 (Memory corruption using Closure::bindTo). (Nikita)
7+
58
- Iconv:
69
. Fixed bug #78642 (Wrong libiconv version displayed). (gedas at martynas,
710
cmb).

Zend/tests/bug78658.phpt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
Bug #78658: Memory corruption using Closure::bindTo()
3+
--FILE--
4+
<?php
5+
6+
$c = function(){};
7+
8+
$scope = "AAAA";
9+
$scope = "{$scope}BBBB";
10+
$c->bindTo(new stdClass, $scope);
11+
12+
?>
13+
--EXPECTF--
14+
Warning: Class 'AAAABBBB' not found in %s on line %d

Zend/zend_closures.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ ZEND_METHOD(Closure, bind)
200200
ce = closure->func.common.scope;
201201
} else if ((ce = zend_lookup_class_ex(class_name, NULL, 1)) == NULL) {
202202
zend_error(E_WARNING, "Class '%s' not found", ZSTR_VAL(class_name));
203-
zend_string_release_ex(class_name, 0);
203+
zend_tmp_string_release(tmp_class_name);
204204
RETURN_NULL();
205205
}
206206
zend_tmp_string_release(tmp_class_name);

0 commit comments

Comments
 (0)