File tree Expand file tree Collapse file tree 4 files changed +126
-0
lines changed Expand file tree Collapse file tree 4 files changed +126
-0
lines changed Original file line number Diff line number Diff line change @@ -33,6 +33,10 @@ PHP 8.4 UPGRADE NOTES
33
33
now 13 bytes longer. Total length is platform-dependent.
34
34
. Encountering recursion during comparison now results in a Error exception,
35
35
rather than a fatal error.
36
+ . Namespace closing braces now clear seen symbols. This allows using a symbol
37
+ in a namespace block, even if a previous namespace block declared a symbol
38
+ with the same name.
39
+ See Zend/tests/use_function/ns_end_resets_seen_symbols_1.phpt.
36
40
37
41
- DOM:
38
42
. Added DOMNode::compareDocumentPosition() and DOMNode::DOCUMENT_POSITION_*
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Namespace end resets seen function symbols
3
+ --FILE--
4
+ <?php
5
+
6
+ namespace {
7
+ function f () {
8
+ echo __FUNCTION__ , "\n" ;
9
+ }
10
+ f ();
11
+ }
12
+
13
+ namespace Ns {
14
+ function f () {
15
+ echo __FUNCTION__ , "\n" ;
16
+ }
17
+ f ();
18
+ }
19
+
20
+ namespace {
21
+ use function Ns \f ;
22
+ f ();
23
+ }
24
+
25
+ namespace Ns {
26
+ use function f ;
27
+ f ();
28
+ }
29
+
30
+ namespace {
31
+ f ();
32
+ }
33
+
34
+ namespace Ns {
35
+ f ();
36
+ }
37
+
38
+ namespace {
39
+ use function f ;
40
+ f ();
41
+ }
42
+
43
+ namespace Ns {
44
+ use function Ns \f ;
45
+ f ();
46
+ }
47
+
48
+ ?>
49
+ --EXPECTF--
50
+ Warning: The use statement with non-compound name 'f' has no effect in %s on line 36
51
+ f
52
+ Ns\f
53
+ Ns\f
54
+ f
55
+ f
56
+ Ns\f
57
+ f
58
+ Ns\f
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Namespace end resets seen class symbols
3
+ --FILE--
4
+ <?php
5
+
6
+ namespace {
7
+ class C {}
8
+ var_dump (new C );
9
+ }
10
+
11
+ namespace Ns {
12
+ class C {}
13
+ var_dump (new C );
14
+ }
15
+
16
+ namespace {
17
+ use Ns \C ;
18
+ var_dump (new C );
19
+ }
20
+
21
+ namespace Ns {
22
+ use C ;
23
+ var_dump (new C );
24
+ }
25
+
26
+ namespace {
27
+ var_dump (new C );
28
+ }
29
+
30
+ namespace Ns {
31
+ var_dump (new C );
32
+ }
33
+
34
+ namespace {
35
+ use C ;
36
+ var_dump (new C );
37
+ }
38
+
39
+ namespace Ns {
40
+ use Ns \C ;
41
+ var_dump (new C );
42
+ }
43
+
44
+ ?>
45
+ --EXPECTF--
46
+ Warning: The use statement with non-compound name 'C' has no effect in %s on line 32
47
+ object(C)#%d (0) {
48
+ }
49
+ object(Ns\C)#1 (0) {
50
+ }
51
+ object(Ns\C)#1 (0) {
52
+ }
53
+ object(C)#%d (0) {
54
+ }
55
+ object(C)#%d (0) {
56
+ }
57
+ object(Ns\C)#1 (0) {
58
+ }
59
+ object(C)#%d (0) {
60
+ }
61
+ object(Ns\C)#1 (0) {
62
+ }
Original file line number Diff line number Diff line change @@ -374,6 +374,8 @@ static void zend_reset_import_tables(void) /* {{{ */
374
374
efree (FC (imports_const ));
375
375
FC (imports_const ) = NULL ;
376
376
}
377
+
378
+ zend_hash_clean (& FC (seen_symbols ));
377
379
}
378
380
/* }}} */
379
381
You can’t perform that action at this time.
0 commit comments