Skip to content

Optimize wp_slash() and prevent unnecessary code execution #8630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wp-includes/formatting.php
Original file line number Diff line number Diff line change
@@ -5763,7 +5763,7 @@ function sanitize_trackback_urls( $to_ping ) {
*/
function wp_slash( $value ) {
if ( is_array( $value ) ) {
$value = array_map( 'wp_slash', $value );
return array_map( 'wp_slash', $value );
}

if ( is_string( $value ) ) {

Unchanged files with check annotations Beta

await expect(
page,
'should redirect to the installation page'
).toHaveURL( /wp-admin\/install\.php$/ );

Check failure on line 40 in tests/e2e/specs/install.test.js

GitHub Actions / Test with SCRIPT_DEBUG disabled / Run E2E tests

[chromium] › tests/e2e/specs/install.test.js:34:6 › WordPress installation process › should install WordPress with pre-existing database credentials

1) [chromium] › tests/e2e/specs/install.test.js:34:6 › WordPress installation process › should install WordPress with pre-existing database credentials Error: should redirect to the installation page Timed out 5000ms waiting for expect(locator).toHaveURL(expected) Locator: locator(':root') Expected pattern: /wp-admin\/install\.php$/ Received string: "http://localhost:8889/" Call log: - should redirect to the installation page with timeout 5000ms - waiting for locator(':root') 9 × locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" 38 | page, 39 | 'should redirect to the installation page' > 40 | ).toHaveURL( /wp-admin\/install\.php$/ ); | ^ 41 | 42 | await expect( 43 | page.getByText( /WordPress database error/ ), at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/install.test.js:40:5

Check failure on line 40 in tests/e2e/specs/install.test.js

GitHub Actions / Test with SCRIPT_DEBUG enabled / Run E2E tests

[chromium] › tests/e2e/specs/install.test.js:34:6 › WordPress installation process › should install WordPress with pre-existing database credentials

1) [chromium] › tests/e2e/specs/install.test.js:34:6 › WordPress installation process › should install WordPress with pre-existing database credentials Error: should redirect to the installation page Timed out 5000ms waiting for expect(locator).toHaveURL(expected) Locator: locator(':root') Expected pattern: /wp-admin\/install\.php$/ Received string: "http://localhost:8889/" Call log: - should redirect to the installation page with timeout 5000ms - waiting for locator(':root') 9 × locator resolved to <html lang="en-US">…</html> - unexpected value "http://localhost:8889/" 38 | page, 39 | 'should redirect to the installation page' > 40 | ).toHaveURL( /wp-admin\/install\.php$/ ); | ^ 41 | 42 | await expect( 43 | page.getByText( /WordPress database error/ ), at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/install.test.js:40:5
await expect(
page.getByText( /WordPress database error/ ),
test( 'Test dismissing failed upload works correctly', async ({ page, admin, requestUtils }) => {
// Log in before visiting admin page.
await requestUtils.login();

Check failure on line 13 in tests/e2e/specs/media-upload.test.js

GitHub Actions / Test with SCRIPT_DEBUG disabled / Run E2E tests

[chromium] › tests/e2e/specs/media-upload.test.js:11:5 › Test dismissing failed upload works correctly

2) [chromium] › tests/e2e/specs/media-upload.test.js:11:5 › Test dismissing failed upload works correctly Error: apiRequestContext.get: 400 Bad Request Response text: 0 Call log: - → GET http://localhost:8889/wp-admin/admin-ajax.php?action=rest-nonce - user-agent: Playwright/1.50.1 (x64; ubuntu 24.04) node/20.19 CI/1 - accept: */* - accept-encoding: gzip,deflate,br - cookie: wordpress_test_cookie=WP%20Cookie%20check; wordpress_23778236db82f19306f247e20a353a99=admin%7C1743683364%7CCLwsKSDslrVtTJREjXwuA8jD4bfCw3o4rxDDSx2Tqcn%7Cd20c9a3de70ff12a1aac46ea651471af465312a7585f7c415ef94704732356a7; wordpress_logged_in_23778236db82f19306f247e20a353a99=admin%7C1743683364%7CCLwsKSDslrVtTJREjXwuA8jD4bfCw3o4rxDDSx2Tqcn%7C9e15c135cfed16eff053ba25aab48cf61cf3013020c2df3ba44dfea952726b52; wp-settings-time-1=1743510565 - ← 400 Bad Request - server: nginx/1.27.4 - date: Tue, 01 Apr 2025 12:29:25 GMT - content-type: text/html; charset=UTF-8 - transfer-encoding: chunked - connection: keep-alive - x-powered-by: PHP/8.2.28 - x-robots-tag: noindex - x-content-type-options: nosniff - referrer-policy: strict-origin-when-cross-origin - x-frame-options: SAMEORIGIN - expires: Wed, 11 Jan 1984 05:00:00 GMT - cache-control: no-cache, must-revalidate, max-age=0, no-store, private 11 | test( 'Test dismissing failed upload works correctly', async ({ page, admin, requestUtils }) => { 12 | // Log in before visiting admin page. > 13 | await requestUtils.login(); | ^ 14 | await admin.visitAdminPage( '/media-new.php' ); 15 | 16 | // It takes a moment for the multi-file uploader to become available. at RequestUtils.login (/home/runner/work/wordpress-develop/wordpress-develop/node_modules/@wordpress/e2e-test-utils-playwright/src/request-utils/login.ts:23:32) at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/media-upload.test.js:13:2
await admin.visitAdminPage( '/media-new.php' );

Check failure on line 14 in tests/e2e/specs/media-upload.test.js

GitHub Actions / Test with SCRIPT_DEBUG enabled / Run E2E tests

[chromium] › tests/e2e/specs/media-upload.test.js:11:5 › Test dismissing failed upload works correctly

2) [chromium] › tests/e2e/specs/media-upload.test.js:11:5 › Test dismissing failed upload works correctly Error: Not logged in 12 | // Log in before visiting admin page. 13 | await requestUtils.login(); > 14 | await admin.visitAdminPage( '/media-new.php' ); | ^ 15 | 16 | // It takes a moment for the multi-file uploader to become available. 17 | await page.waitForLoadState('load'); at Admin.visitAdminPage (/home/runner/work/wordpress-develop/wordpress-develop/node_modules/@wordpress/e2e-test-utils-playwright/src/admin/visit-admin-page.ts:36:9) at /home/runner/work/wordpress-develop/wordpress-develop/tests/e2e/specs/media-upload.test.js:14:2
// It takes a moment for the multi-file uploader to become available.
await page.waitForLoadState('load');