You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
adamziel
changed the title
WordPress: Syntax error, unexpected 'has' (T_STRING) in /wordpress/wp-includes/class-wp-recovery-mode-email-service.php on line 4
Annotations-related syntax errors in the minified WordPress build
Jan 30, 2024
Adds a newline character after every PHP annotation.
## Rationale
Loading WordPress on PHP 7.4 yields the following error:
```
Parse error: syntax error, unexpected 'has' (T_STRING) in /wordpress/wp-includes/class-wp-recovery-mode-email-service.php on line 4
```
This is caused by the minification of PHP files via `php -w`.
**PHP 8.0, which is currently used, outputs:**
```php
<?php
#[AllowDynamicProperties] final class WP_Recovery_Mode_Email_Service { /* ... code ... */ $message = __( 'Howdy!', '
WordPress has a built-in feature ...
```
The class declaration is treated as a comment by PHP 7.4.
**However, PHP 7.4 outputs:**
```php
<?php
final class WP_Recovery_Mode_Email_Service { /* ... code ... */ $message = __( 'Howdy!', '
WordPress has a built-in feature ...
```
Note the missing annotation.
Closes#985
## Testing instructions
Confirm the CI tests pass
Loading WordPress on PHP 7.4 yields the following error:
This is caused by the minification of PHP files via
php -w
.PHP 8.0, which is currently used, outputs:
The class declaration is treated as a comment by PHP 7.4.
However, PHP 7.4 outputs:
Note the missing annotation.
Proposed solution
I have two ideas:
I'll explore the first one
The text was updated successfully, but these errors were encountered: