Opened 16 years ago
Closed 16 years ago
#10047 closed defect (bug) (fixed)
[Code Review] An array should not be directly put into a string
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | high |
Severity: | blocker | Version: | 2.8 |
Component: | Template | Keywords: | has-patch |
Focuses: | Cc: |
Description
Description
In latest wordpress 2.8 nightly build, file wp-includes/link-template.php, function get_boundary_post, from line 1037 to 1041
$categories = array_merge($cat_array, $excluded_categories); $order = $start ? 'ASC' : 'DESC'; return get_posts("numberposts=1&order=$order&orderby=ID&category=$categories");
As you see, $categories is an array, it should not be used in this way, which will cause a string "Array" in php, am i right?
P/S
I noticed these codes are part of 2.8 new feature "display adjacent relational links in the head" - Ticket #8703, thus determine Severity to be major. If it doesn't meet your bug evaluation principle, feel free to point it.
Attachments (1)
Change History (5)
#3
@
16 years ago
- Keywords has-patch added; needs-patch removed
attachment 10047.diff added
- Changes the code mentioned to use array notation
- Changes a XMLRPC call to array notation as well (Changed it earlier.. not because it was buggy though)
For anyone elses reference, Heres a quick regex to pull up the locations where the string notation is used:
\w+\(\s*["'][a-z0-9]+=
Note: See
TracTickets for help on using
tickets.
Core shouldn't be using the string notation anyway.. It should be passing an array for this exact reason.
I'll make up a patch in an hour if no-one else is making one.