Opened 14 years ago
Closed 12 years ago
#20793 closed defect (bug) (fixed)
Illegal string offset 'public' in wpmu_create_blog()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.7 | Priority: | normal |
| Severity: | normal | Version: | 3.0 |
| Component: | Multisite | Keywords: | has-patch |
| Focuses: | Cc: |
Description
If $meta is not passed and left as default empty string then:
update_option( 'blog_public', (int)$meta['public'] );
will throw a notice.
Attachments (5)
Change History (11)
#1
@
13 years ago
- Component changed from Warnings/Notices to Multisite
- Milestone changed from Future Release to 3.7
#2
@
12 years ago
20793.3.diff is a slightly different take:
- Does not modify
$meta. - Replaces multiple comparisons with a single
in_array()check. The comparisons are probably a tiny bit faster, but I don't think they're for performance reasons here. Introduced in mu:1364.
#3
follow-up:
↓ 4
@
12 years ago
I like the in_array() check. Does it matter that $meta will be passed unmodified to an action further down?
#4
in reply to:
↑ 3
@
12 years ago
Replying to jeremyfelt:
Does it matter that
$metawill be passed unmodified to an action further down?
For some reason it seemed better to me at the moment. On second thought, I agree with changing $meta, would just like it to be explicitly declared as an array: 20793.4.diff. I think it may throw a notice otherwise, however a quick test showed that it's not the case, so I may be wrong.
#5
@
12 years ago
20793.5.diff uses wp_parse_args() to make sure $meta is always an array, and $meta['public'] is always set.
In IRC discussion, nacin suggested that the default value for $meta should also be an array. Created #25149 for that.
Just ran into this.
wpmu_create_blog()implies that themetaparameter is optional, both in the@paramdocumentation and by setting the default of an empty string. If the array key for public is not set, a notice is thrown.20793.2.diff is a refresh of @duck_'s patch, which accounts for a missing
publickey and addresses some code formatting.