Hi team,
I just switched my local dev site to PHP 8.6 and every frontend page now starts with hundreds of lines like this, right in the HTML:
E_DEPRECATED: Calling is_a() with a string when $allow_string is false in.../cornerstone/includes/classes/Tss/Evaluator.php on line 37.
Setup: Pro 6.9.8 / Cornerstone 7.9.8, WordPress 7.1.5, PHP 8.6.0, WP_DEBUG on, WP_DEBUG_DISPLAY off.
There are two separate things going on:
-
is_a()with a non-object. PHP 8.6 deprecates callingis_a()on a string (or anything that isn’t an object) unless$allow_stringis true. It used to just return false silently. The TSS code does this for every CSS value:
- Tss/Evaluator.php lines 37, 41, 104
- Tss/Typed/Typed.php line 24
- Tss/Functions/BuiltInFunction.php line 40Replacing
is_a( $x, Foo::class )with$x instanceof Foofixes it and behaves exactly the same. There are about 137is_a()calls in Cornerstone overall, so a search across the codebase is probably worth it.
-
The ErrorHandler echoes errors into the output. Util/ErrorHandler.php catches everything during
Styling::postProcess(), andflush()then echoes it straight into the page, ignoringdisplay_errors/WP_DEBUG_DISPLAY. That’s why the notices end up in the HTML instead of the log, and it also causes “headers already sent” warnings (pluggable.php, WooCommerce AJAX). Ideally caught errors would go toerror_log()and only be shown when display_errors is on.Small extra: line 79 usesE_STRICT, which is itself deprecated since PHP 8.4.
Live sites without WP_DEBUG aren’t affected (WordPress leaves E_DEPRECATED out of error_reporting there), but anyone developing with debug mode on PHP 8.6 will hit this right away.
Thanks in advance!