File tree Expand file tree Collapse file tree 5 files changed +127
-0
lines changed Expand file tree Collapse file tree 5 files changed +127
-0
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ PHP NEWS
12
12
. Passing E_USER_ERROR to trigger_error() is now deprecated. (Girgias)
13
13
. Fixed bug GH-15292 (Dynamic AVX detection is broken for MSVC). (nielsdos)
14
14
. Using "_" as a class name is now deprecated. (Girgias)
15
+ . Exiting a namespace now clears seen symbols. (ilutov)
15
16
16
17
- Curl:
17
18
. Added constants CURL_HTTP_VERSION_3 (libcurl 7.66) and CURL_HTTP_VERSION_3ONLY
Original file line number Diff line number Diff line change @@ -248,6 +248,10 @@ PHP 8.4 UPGRADE NOTES
248
248
RFC: https://wiki.php.net/rfc/deprecated_attribute
249
249
. Implemented property hooks.
250
250
RFC: https://wiki.php.net/rfc/property-hooks
251
+ . Exiting a namespace now clears seen symbols. This allows using a symbol in a
252
+ namespace block, even if a previous namespace block declared a symbol with
253
+ the same name.
254
+ See Zend/tests/use_function/ns_end_resets_seen_symbols_1.phpt.
251
255
252
256
- Curl:
253
257
. curl_version() returns an additional feature_list value, which is an
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 @@ -377,6 +377,8 @@ static void zend_reset_import_tables(void) /* {{{ */
377
377
efree (FC (imports_const ));
378
378
FC (imports_const ) = NULL ;
379
379
}
380
+
381
+ zend_hash_clean (& FC (seen_symbols ));
380
382
}
381
383
/* }}} */
382
384
You can’t perform that action at this time.
0 commit comments