diff --git a/inc/functions.php b/inc/functions.php index f0e5f66..1a8c243 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -114,8 +114,8 @@ function accelerate_scripts_styles_method() { // wp_enqueue_style( 'accelerate-fontawesome', get_template_directory_uri() . '/fontawesome/css/font-awesome.css', array(), '4.7.0' ); - wp_enqueue_script( 'html5shiv', ACCELERATE_JS_URL . '/html5shiv.js', array(), '3.7.3', false ); - wp_script_add_data( 'html5shiv', 'conditional', 'lte IE 8' ); + // Empty handle kept so scripts that list 'html5shiv' as a dependency still load. + wp_register_script( 'html5shiv', false, array(), ACCELERATE_THEME_VERSION, false ); } function accelerate_block_editor_styles() { diff --git a/tests/e2e/specs/smoke/no-php-notices.spec.ts b/tests/e2e/specs/smoke/no-php-notices.spec.ts new file mode 100644 index 0000000..3801e13 --- /dev/null +++ b/tests/e2e/specs/smoke/no-php-notices.spec.ts @@ -0,0 +1,23 @@ +import { test, expect } from "@playwright/test"; + +/** + * @area assets + * @tier fresh + * @guards themegrill/accelerate-pro#21 + * @source themegrill/radiate#73 (same fix); themegrill/spacious#151 + * @why accelerate_scripts_styles_method() registered html5shiv with + * wp_script_add_data( 'html5shiv', 'conditional', 'lte IE 8' ), which + * WordPress 6.9+ deprecates, so every front-end page printed a + * "Deprecated: WP_Dependencies->add_data()" notice when WP_DEBUG_DISPLAY + * is on. Only observable where debug display is enabled; on a site with it + * off this passes regardless. Asserts no PHP notice markup anywhere in the + * response (it is printed inside ), not the absence of html5shiv. + */ +test("front page prints no PHP notices or deprecations @assets @smoke @fresh", async ({ page }) => { + // Read the raw response: PHP prints the notice while wp_head() runs, before + // , so a body locator would miss it. + const response = await page.goto("/"); + expect(response?.ok(), `homepage returned HTTP ${response?.status()}`).toBeTruthy(); + const html = await response!.text(); + expect(html).not.toMatch(/(?:^|>|\s)(?:)?(?:Deprecated|Notice|Warning|Fatal error)(?:<\/b>)?:\s/); +});