Opened 12 years ago
Closed 11 years ago
#20793 closed defect (bug) (fixed)
Illegal string offset 'public' in wpmu_create_blog()
Reported by: | duck_ | Owned by: | SergeyBiryukov |
---|---|---|---|
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
@
11 years ago
- Component changed from Warnings/Notices to Multisite
- Milestone changed from Future Release to 3.7
#2
@
11 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
@
11 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
@
11 years ago
Replying to jeremyfelt:
Does it matter that
$meta
will 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
@
11 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 themeta
parameter is optional, both in the@param
documentation 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
public
key and addresses some code formatting.