WordPress.org

Make WordPress Core

#22486 closed defect (bug) (fixed)

PHP warning when creating a new site as part of a network

Reported by: jkudish Owned by: westi
Milestone: 3.5 Priority: high
Severity: major Version: 3.5
Component: Multisite Keywords: has-patch commit
Focuses: Cc:

Description (last modified by jkudish)

I get the following error when I create a new site as part of a network running an up-to-date checkout of trunk.

Notice: Undefined variable: s in .../wp/wp-admin/network/site-new.php on line 88

My setup is a bit particular but I am fairly positive it has nothing to do with the bug. Here it goes anyway:

  • locally hosted, using MAMP Pro, mapped to a .dev domain using my hosts file
  • subdomain setup for multisite
  • WordPress is in a subfolder on the domain, in a folder named 'wp'
  • The wp-content folder has been moved to '/content'

The double quotes are causing the $ to be executed as variables by the PHP parser instead of being interpreted as strings to replace by sprintf
Patch attached that fixes the issue.

Attachments (3)

22486.diff (1.1 KB) - added by jkudish 17 months ago.
22486.2.diff (1.1 KB) - added by jkudish 17 months ago.
22486.3.diff (1.1 KB) - added by SergeyBiryukov 17 months ago.

Download all attachments as: .zip

Change History (11)

jkudish17 months ago

comment:1 jkudish17 months ago

  • Description modified (diff)

comment:2 nacin17 months ago

Broken in [22272].

comment:4 nacin17 months ago

  • Keywords needs-patch added; has-patch removed
  • Owner set to westi
  • Status changed from new to assigned

The attached patch breaks the string; it is no longer translatable. We'll need to A) escape them, B) remove them, or C) add manual line breaks to the string. B or C are probably most friendly to the translators.

jkudish17 months ago

comment:5 jkudish17 months ago

In 22486.2.diff:

How's this approach? It splits the string up into 3 which may or may not be ideal for translators.

SergeyBiryukov17 months ago

comment:6 SergeyBiryukov17 months ago

  • Keywords has-patch added; needs-patch removed

In ms-functions.php we use actual line breaks for such strings:
http://core.trac.wordpress.org/browser/tags/3.4.2/wp-includes/ms-functions.php#L1027

22486.3.diff does the same for consistency.

comment:7 ocean9017 months ago

  • Keywords commit added

comment:8 nacin17 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 22664:

Add manual new lines to a string, as double quotes with \n is not optimal due to sprintf-parsing reasons. props SergeyBiryukov, fixes #22486. see #22260.

Note: See TracTickets for help on using tickets.