Opened 14 years ago
Closed 13 years ago
#20793 closed defect (bug) (fixed)
Illegal string offset 'public' in wpmu_create_blog()
| Reported by: | duck_ | Owned by: | SergeyBiryukov |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.7 |
| Component: | Multisite | Version: | 3.0 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
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)
#2
@
13 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
@
13 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
@
13 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
@
13 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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.