Skip to content

Commit 3cc59b3

Browse files
committed
Merge branch 'master' of git.php.net:php-src
* 'master' of git.php.net:php-src: Add some NEWS entries Allow self etc in eval / file scope fix typo in php.ini
2 parents a989c0a + d258b7a commit 3cc59b3

File tree

6 files changed

+44
-4
lines changed

6 files changed

+44
-4
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@
2929
(Laruence)
3030
. Fixed bug #68252 (segfault in Zend/zend_hash.c in function
3131
_zend_hash_del_el). (Laruence)
32+
. Fixed bug #65598 (Closure executed via static autoload incorrectly marked as
33+
static). (Nikita)
34+
. Fixed bug #66811 (Cannot access static::class in lambda, writen outside of a
35+
class). (Nikita)
36+
. Fixed bug #69568 (call a private function in closure failed). (Nikita)
3237
. Added PHP_INT_MIN constant. (Andrea)
3338
. Added Closure::call() method. (Andrea)
3439
. Implemented FR #38409 (parse_ini_file() looses the type of booleans). (Tjerk)
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
--TEST--
2-
Accessing self::FOO outside a class
2+
Accessing self::FOO in a free function
33
--FILE--
44
<?php
5-
var_dump(self::FOO);
5+
function test() {
6+
var_dump(self::FOO);
7+
}
68
?>
79
--EXPECTF--
810
Fatal error: Cannot use "self" when no class scope is active in %s on line %d

Zend/tests/self_in_eval.phpt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--TEST--
2+
self etc. can be used in eval() in a class scope
3+
--FILE--
4+
<?php
5+
6+
class C {
7+
const FOO = 1;
8+
private static $bar = 2;
9+
public static function f() {
10+
eval(<<<'PHP'
11+
var_dump(self::FOO);
12+
var_dump(self::$bar);
13+
var_dump(self::class);
14+
var_dump(static::class);
15+
PHP
16+
);
17+
}
18+
}
19+
20+
C::f();
21+
22+
?>
23+
--EXPECT--
24+
int(1)
25+
int(2)
26+
string(1) "C"
27+
string(1) "C"
28+

Zend/zend_compile.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,6 +1325,11 @@ static inline zend_bool zend_is_scope_known() /* {{{ */
13251325
return 0;
13261326
}
13271327

1328+
if (!CG(active_op_array)->function_name) {
1329+
/* A file/eval will be run in the including/eval'ing scope */
1330+
return 0;
1331+
}
1332+
13281333
if (!CG(active_class_entry)) {
13291334
/* Not being in a scope is a known scope */
13301335
return 1;

php.ini-development

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ zend.assertions = 1
16361636

16371637
[mbstring]
16381638
; language for internal character representation.
1639-
; This affects mb_send_mail() and mbstrig.detect_order.
1639+
; This affects mb_send_mail() and mbstring.detect_order.
16401640
; http://php.net/mbstring.language
16411641
;mbstring.language = Japanese
16421642

php.ini-production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1636,7 +1636,7 @@ zend.assertions = -1
16361636

16371637
[mbstring]
16381638
; language for internal character representation.
1639-
; This affects mb_send_mail() and mbstrig.detect_order.
1639+
; This affects mb_send_mail() and mbstring.detect_order.
16401640
; http://php.net/mbstring.language
16411641
;mbstring.language = Japanese
16421642

0 commit comments

Comments
 (0)