#52996 closed defect (bug) (fixed)
Coding standard : Undefined varible $results
Reported by: | ravipatel | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.8 | Priority: | low |
Severity: | trivial | Version: | 3.0 |
Component: | Import | Keywords: | has-patch |
Focuses: | coding-standards | Cc: |
Description
Variable "$results" is undefined.
Attachments (1)
Change History (7)
#1
@
3 years ago
- Milestone changed from Awaiting Review to 5.8
- Priority changed from normal to low
- Severity changed from normal to trivial
- Version set to 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.
3 years ago
#3
Trac ticket: https://core.trac.wordpress.org/ticket/52996
#4
@
3 years ago
PR1181 removes all resets.
Please check and let me know in case of any changes. Feel free to update.
undefine variable $results