#13319 closed defect (bug) (fixed)
Code improvement in _fill_single_user(): Pass by Reference PHP 4 fixes
Reported by: | hakre | Owned by: | |
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | trivial | Version: | 3.0 |
Component: | General | Keywords: | has-patch |
Focuses: | Cc: |
Description
Passing an array by reference does not make very much sense when it is used read only. It is read only in _fill_single_user()
(PHP uses copy on write, not copy on read).
I think what intended was, that objects in that array (the items in there are an array of database result objects) are passed by reference so that they play nicely with PHP 4. To achieve this, care must be taken with the iterator that it does not create copies of the objects in that array of result objects there.
maybe_unserialize()
should be safe to use since database objects meta_value's property should contain scalars only.
The same is for get_user_metavalues()
which is not reflecting the propper iteration over the resultset.
This all then escalated up to _fill_many_users()
which is not properly handling those results as well.
Additional to those reference related fixes, some code-cleanup has been done according to the standard.
I had no problems running this on my testbed.
Attachments (2)
Change History (10)
#4
in reply to:
↑ 2
@
14 years ago
Replying to nacin:
I'm not sure I see the bug here.
No problem, there is a collection of some more resources about PHP variable handling so that we can educate ourselves on how to write PHP code for wordpress PHP requirements. Often I do not fully understand that out of the box as well I must admit. It's just not something easy to get I assume, this PHP variable handling. At least not for me even I do PHP coding since some years now. It can become quite tricky, especially with PHP 4.
References: [13576] #11914