Make WordPress Core

Opened 4 months ago

Last modified 4 months ago

#63899 new defect (bug)

Undefined array key 1 in WP_Interactivity_API::merge_style_property()

Reported by: tkay01's profile tkay01 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 6.8.2
Component: Interactivity API Keywords:
Focuses: Cc:

Description (last modified by sabernhardt)

Hi, I have a question. In my new wordpress project I am getting an error from wordpress interactivity api, and not sure how to resolve this.

I patched up the code with the following adjustments:

list( $name, $value ) = explode( ':', $style_assignment );	if ( trim( $name ) !== $style_property_name ) {	$result[] = ($name ? trim( $name ) : '') . ':' . ($value ? trim( $value ) : '') . ';'; } 

Will there be an update for the interactivity api,or has it already been resolved somewhere? I could not find a clear answer. But I got it working currently.\

kind regards,

Ted

See error:
Warning: Undefined array key 1 in /.../wp-includes/interactivity-api/class-wp-interactivity-api.php on line 1014
Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /.../wp-includes/interactivity-api/class-wp-interactivity-api.php on line 1016

Change History (3)

#1 @tkay01
4 months ago

the code was not formatted correctly, so I reposting it here correctly:

list( $name, $value ) = explode( ':', $style_assignment ); if(!$name && !$value) continue;	if ( trim( $name ) !== $style_property_name ) {	$result[] = ($name ? trim( $name ) : '') . ':' . ($value ? trim( $value ) : '') . ';';	} 

Unfortunately I still see this error in my wordpress project:
Warning: Undefined array key 1 in /var/www/html/wp-includes/interactivity-api/class-wp-interactivity-api.php on line 1014

Last edited 4 months ago by tkay01 (previous) (diff)

#2 @tkay01
4 months ago

I find the solution, I messed by with styling a img HTML element.
I forgot to add a key/property name to the translate3D method within defining the style for the component.

<img style="translate: none; rotate: none; scale: none; translate3d(0px, 0px, 0px);" 

and adjusted the following:

<img style="translate: none; rotate: none; scale: none; transform: translate3d(0px, 0px, 0px);" /> 

#3 @sabernhardt
4 months ago

  • Component changed from General to Interactivity API
  • Description modified (diff)
  • Summary changed from Undefined array key 1 in /var/www/html/wp-includes/interactivity-api/class-wp-interactivity-api.php on line 1014 Deprecated: trim(): to Undefined array key 1 in WP_Interactivity_API::merge_style_property()
Note: See TracTickets for help on using tickets.