Skip to content

Commit

Permalink
Remove elimination of namespace from closure and escape opening brace
Browse files Browse the repository at this point in the history
  • Loading branch information
westonruter committed Nov 4, 2024
1 parent 6340423 commit 46229b9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion includes/validation/class-amp-validation-manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -1659,7 +1659,7 @@ public static function can_output_buffer() {
$called_functions = [];
$backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_debug_backtrace -- Only way to find out if we are in a buffering display handler.
foreach ( $backtrace as $call_stack ) {
if ( '{closure}' === $call_stack['function'] ) {
if ( '{closure}' === $call_stack['function'] ) { // TODO: This may not be the right format for PHP 8.4.
$called_functions[] = 'Closure::__invoke';
} elseif ( isset( $call_stack['class'] ) ) {
$called_functions[] = sprintf( '%s::%s', $call_stack['class'], $call_stack['function'] );
Expand Down
2 changes: 1 addition & 1 deletion tests/php/src/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function assertIndexedArrayContains( $expected_subset, $actual_superset )
public function normalize_closure_function_name( $data ) {
if ( is_string( $data ) ) {
$data = preg_replace(
'/(\w+\\\\)*{closure:[^}]+}/',
'/\{closure:[^}]+}/',
'{closure}',
$data
);
Expand Down

0 comments on commit 46229b9

Please sign in to comment.