Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#55776 closed defect (bug) (invalid)

sprintf missformat fatal error php 8

Reported by: ognjanovic's profile ognjanovic Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: php8
Focuses: administration Cc:

Description

There is a fatal error generated in admin-header.php on line 62

$screen_title  = sprintf(
				/* translators: Editor admin screen title. 1: "Edit item" text for the post type, 2: Post title. */
				__( '%1$s “%2$s”' ),
				$post_type_obj->labels->edit_item,
				$post_title
			);

This part
__( '%1$s “%2$s”' )

There should be a space after %2$s in order to work in php 8.0.14 (the only version I tested in).

Change History (5)

#1 follow-up: @johnbillion
3 years ago

  • Focuses coding-standards removed
  • Keywords reporter-feedback added; needs-patch removed

Thanks for the report @ognjanovic. Can you let us know the full fatal error message text, file name, line number, etc, please?

#2 in reply to: ↑ 1 @ognjanovic
3 years ago

Replying to johnbillion:

Thanks for the report @ognjanovic. Can you let us know the full fatal error message text, file name, line number, etc, please?

Sure. Trying to edit any post or page you’ll get this error

2022/05/18 11:35:51 [error] 50#0: *5269743 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught ValueError: Argument number specifier must be greater than zero and less than 2147483647 in /var/www/html/wp-admin/admin-header.php:62
Stack trace:
#0 /var/www/html/wp-admin/admin-header.php(62): sprintf()
#1 /var/www/html/wp-admin/edit-form-advanced.php(425): require_once('...')
#2 /var/www/html/wp-admin/post.php(206): require('...')
#3 {main}
  thrown in /var/www/html/wp-admin/admin-header.php on line 62" while reading response header from upstream, client: 10.130.10.1, server: mpn.gov.rs, request: "GET /wp-admin/post.php?post=646&action=edit HTTP/1.1", upstream: "fastcgi://unix:/run/php-fpm/www.sock:", host: "hidden.url", referrer: "https://hidden.url/wp-admin/edit.php?post_type=cpt"

#3 @ocean90
3 years ago

  • Keywords reporter-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version 5.9.3 deleted

Hello @ognjanovic, I'm assuming you're using WordPress with the Serbian translation? There was an error in the translation which was fixed a while ago, see https://translate.wordpress.org/projects/wp/dev/admin/sr/default/?filters%5Bstatus%5D=either&filters%5Boriginal_id%5D=12959676&sort%5Bby%5D=translation_date_added&sort%5Bhow%5D=asc. Please check wp-admin/update-core.php for any translation updates.

Marking as invalid since it's not a bug in core.

Related: #meta6256

#4 @jrf
3 years ago

  • Keywords php8 added

I can confirm @ocean90's assessment. Also see: https://3v4l.org/88qOj which shows that the code in Core is absolutely fine PHP cross-version. Which automatically points the finger at a translation being wrong.

This ticket was mentioned in Slack in #buddypress by imath. View the logs.


2 years ago

Note: See TracTickets for help on using tickets.