Opened 10 years ago
Closed 4 years ago
#39048 closed defect (bug) (invalid)
undefined return array var being passed to wp_parse_str
| Reported by: | pbearne | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
Description
I spotted that the array being passed by ref is not be set in all places in core
This patch fixes that
#WCUS contrib day
Attachments (3)
Change History (6)
#1
@
10 years ago
@pbearne Thanks for the patch. I'm not certain I understand what issue this is resolving. Does not setting these arrays beforehand cause a PHP warning or error? A unit test demonstrating that would be immensely helpful here.
Note that generally code refactoring should not be done just because we can.
#3
@
4 years ago
- Milestone Awaiting Review
- Resolution → invalid
- Status new → closed
Hi there, thanks for the patch!
Unless I'm missing something, for variables passed by reference to there is no need to create them in advance.
Per the PHP manual:
If you assign, pass, or return an undefined variable by reference, it will get created.
This is similar to the $matches parameter of preg_match(), we don't generally define that in advance either.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
fixed patch remove other changes