#52996 closed defect (bug) (fixed)
Coding standard : Undefined varible $results
| Reported by: | ravipatel | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | low | Milestone: | 5.8 |
| Component: | Import | Version: | 3.0 |
| Severity: | trivial | Keywords: | has-patch |
| Cc: | Focuses: | coding-standards |
Description
Variable "$results" is undefined.
Attachments (1)
Change History (7)
#1
@
5 years ago
- Milestone Awaiting Review → 5.8
- Priority normal → low
- Severity normal → trivial
- Version → trunk
@ravipatel The report is valid and the patch good. Thanks for that.
Having said that, I think we may need to rethink the practice happening here.
The first few functions in this file, all end with something along the lines of:
<?php // Unset to save memory. unset( $results, $r ); return $hashtable;
With how PHP memory management and garbage collection works, this, to me, is ludicrous.
Variables created within the scope of a function are discarded automatically when PHP leaves the scope of the function, i.e. on return, so doing a call to unset() straight before a return statement is absolutely unnecessary and useless.
These statements can, and should be, removed.
This ticket was mentioned in PR #1181 on WordPress/wordpress-develop by mukeshpanchal27.
5 years ago
#3
Trac ticket: https://core.trac.wordpress.org/ticket/52996
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
undefine variable $results