Commit 2247bec
committed
Fix memory leak, callable validation, and edge cases for private(namespace)
This commit resolves several critical issues with the private(namespace)
visibility feature implementation:
Callable Validation Fix:
- is_callable() was incorrectly using EG(current_execute_data) instead of
the frame parameter passed to zend_is_callable_check_func()
- Created zend_get_caller_namespace_ex() that accepts an execute_data frame
- Updated both namespace visibility checks in callable validation to use
frame-aware version
- Ensures callable checks respect the actual caller's namespace context
Global Namespace Edge Case:
- Traditional zend_check_method_accessible() was rejecting private(namespace)
methods when called from top-level code (scope=NULL)
- Skip accessibility check for ZEND_ACC_NAMESPACE_PRIVATE methods since they
have their own namespace-based visibility rules
- Set namespace_name on top-level op_arrays to track namespace for file-level
code execution
Test Fixes:
- Fixed private_namespace_edge_005.phpt: Use bracketed namespace syntax
- Fixed inheritance test expectations to match actual error messages1 parent 6ca49d4 commit 2247bec
File tree
7 files changed
+31
-13
lines changed- Zend
- tests/access_modifiers
7 files changed
+31
-13
lines changedLines changed: 5 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | | - | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
| 25 | + | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3770 | 3770 | | |
3771 | 3771 | | |
3772 | 3772 | | |
| 3773 | + | |
| 3774 | + | |
3773 | 3775 | | |
3774 | 3776 | | |
3775 | 3777 | | |
| |||
3931 | 3933 | | |
3932 | 3934 | | |
3933 | 3935 | | |
3934 | | - | |
| 3936 | + | |
3935 | 3937 | | |
3936 | 3938 | | |
3937 | 3939 | | |
| |||
4004 | 4006 | | |
4005 | 4007 | | |
4006 | 4008 | | |
4007 | | - | |
| 4009 | + | |
| 4010 | + | |
4008 | 4011 | | |
4009 | 4012 | | |
4010 | 4013 | | |
| |||
4021 | 4024 | | |
4022 | 4025 | | |
4023 | 4026 | | |
4024 | | - | |
| 4027 | + | |
4025 | 4028 | | |
4026 | 4029 | | |
4027 | 4030 | | |
| |||
5380 | 5383 | | |
5381 | 5384 | | |
5382 | 5385 | | |
5383 | | - | |
| 5386 | + | |
5384 | 5387 | | |
5385 | | - | |
5386 | | - | |
5387 | 5388 | | |
5388 | 5389 | | |
5389 | 5390 | | |
| |||
5411 | 5412 | | |
5412 | 5413 | | |
5413 | 5414 | | |
| 5415 | + | |
| 5416 | + | |
| 5417 | + | |
| 5418 | + | |
| 5419 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
619 | 619 | | |
620 | 620 | | |
621 | 621 | | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
622 | 632 | | |
623 | 633 | | |
624 | 634 | | |
| |||
0 commit comments