Jetpack: PHP 8.0 "Only the first byte will be assigned to the string offset" + Changed Table in Editor

Created on 27 Oct 2020  路  11Comments  路  Source: Automattic/jetpack

It's sounds a bit quirky, and I am not able to locate what's actually happening. Right now I only have symptoms. Bear with me.
On a fairly new site, maybe a week old, I all of a sudden see this warning just before the editor loads:

`Warning: Only the first byte will be assigned to the string offset in /wp-includes/class.wp-scripts.php on line 492

The Browser console didn't reveal anything except the 'Quirky' Mode notification:
Screen Shot 2020-10-27 at 6 11 54 PM

Neither the Warning, nor the Quirky Mode notification appears when deactivating the Jetpack plugin.

I used the Troubleshooting mode of the Site health plugin to narrow it down...

Another symptom is how the table block is displayed.

With Jetpack enabled:
Screen Shot 2020-10-27 at 5 48 34 PM

With Jetpack deactivated:

Screen Shot 2020-10-27 at 5 54 30 PM

Tested with these two themes

  • Twenty-Twenty-one v 1.0
  • Twenty-Twenty v 1.5

Environment

  • Jetpack v. 9.0.2
  • WordPress trunk (WordPress 5.6-beta2-49351)
  • Gutenberg zip from master this morning (10-27)
  • PHP 8.0.0rc1

_(yep living on the bleeding edge right now)_

Steps to reproduce the issue

  1. Select New Post
  2. You see the error shortly displayed before the editor loads
  3. Open Browser console, you see Quirky mode message
  4. View source and see the warning displayed before the

Google Chrome 86.0.4240.111
OSX 10.15.7

I also tested this on WordPress 5.6 beta 2 on PHP 7.3 and I wasn't able to reproduce it.
I googled the error message found this page = php 8

General [Pri] Normal [Status] In Progress [Type] Bug

All 11 comments

`Warning: Only the first byte will be assigned to the string offset in /wp-includes/class.wp-scripts.php on line 492

Thanks for the report! I've added it to the issue where we currently track all PHP 8 compatibility issues, #17166.

I am having trouble reproducing the issue with the Table block, though. Could you let me know what Jetpack features are currently active on your site?

Thank you!

Thanks @jeherve -

I installed Jetpack again (was annoyed at the notice showing up all the time) and tested it again.
This time it showed an error message in the browser console that might help.
Uncaught TypeError: Object(...) is not a function
at Object. (editor.js:14)
at o (editor.js:1)
at Object. (editor.js:18)
at o (editor.js:1)
at Module. (editor.js:18)
at o (editor.js:1)
at Object. (editor.js:18)
at o (editor.js:1)
at editor.js:1
at editor.js:1
Screen Shot 2020-11-03 at 10 13 14 AM

As you can see in the photo of my screen, for each instance of editor.js the error message points to https://c0.wp.com/p/jetpack/9.0.2/_inc/blocks/editor.js

This actually doesn't seem to be related to the table block. The error message shows up on every instance of the block editor now

Test environment today

The error message shows up on every instance of the block editor now

Test environment today

WordPress 5.6-beta3-49486
Gutenberg 9.3.0-nightly
Chrome Version 86.0.4240.111

Thank you. Do you happen to use any other plugins on that site, or a theme that would add custom blocks? I'm asking because I can't seem to be able to reproduce the issue at the moment, with a setup similar to yours:

  • WordPress 5.6-beta3-49486
  • Gutenberg 9.3.0-nightly from your fork
  • Chrome version 86.0.4240.111
  • Jetpack 9.0.2
  • WP_DEBUG on, but no errors reported in the logs
  • No errors in the browser console either

Just tested through all plugins and https://wordpress.org/plugins/social-share-block/ is causing the browser console error together with Jetpack.

the "Warning: Only the first byte will be assigned to the string offset in /home/customer/www/icodeforapurpose.com/public_html/wp-includes/class.wp-scripts.php on line 492' stays around all through.

Ah, thank you, that's helpful! I believe this block issue may be a duplicate of #17289.

the "Warning: Only the first byte will be assigned to the string offset in /home/customer/www/icodeforapurpose.com/public_html/wp-includes/class.wp-scripts.php on line 492' stays around all through.

I haven't been able to reproduce that one yet. Does this happen when opening the block editor, or when taking a specific action on the site, even when no other plugins are active?

That "warning" appeared as soon as I click on the Edit Post link from the All Posts or All Pages screen. It disappears behind the Full-screen editing window, but if you use the View Source, you see it on top of the screen.
Here is a video. https://recordit.co/9Cm6AOYwyc

17289 might not be the same problem as it mentions experimental-editor.js while the occurrence I see is related to the /_inc/blocks/editor.js

it mentions experimental-editor.js while the occurrence I see is related to the /_inc/blocks/editor.js

Right. We initially found the issue with our experimental blocks, but eventually found that it was happening for all blocks.

That "warning" is appeared as soon as I click on the Edit Post link from the All Posts or All Pages screen.

Ah, I was finally able to reproduce. We'll get this fixed. Thanks again for the report. Until that's fixed, I would recommend that you turn off the display of errors with define( 'WP_DEBUG_DISPLAY', false );.

I believe this warning is produced by using wp_localize_script(string $handle, string $object_name, array $l10n) (here and some other places) with string as the third argument instead of array (even though it works).

@websevendev That may indeed be it. We're about to fix those instances in Jetpack, we're working on those changes in #17938.

Was this page helpful?
0 / 5 - 0 ratings