Thanks for letting me know. That is odd, I didn’t get this warning, I was flicking between all major versions of php and didn’t catch it.
what version of php are you using?
-
This reply was modified 9 months, 1 week ago by
Benbodhi. Reason: spelling mistake
thanks for sharing the php version 🙏
I don’t think it is to do with the PHP version. And I can’t seem to cause it again.
Is “css_target” a recently added setting stored in (array) option “bodhi_svgs_settings”. If so, I suspect the first time you read it you get the PHP warning, but the following code then adds it so that you don’t see the warning again.
it was an existing setting, but I did a lot of refactoring.
so you see the warning when first loading the plugin, but then it disappears because of the order of the settings being added?
thanks for this info, helpful for me to be able to track it down.
Just more info – I’ve had the plugin enabled for at least a month, and today was the first time I have the error in my error_log. So it doesn’t occur on activation:
PHP Warning: Undefined array key “css_target”
I have just encountered the same PHP warning after updating the plugin from 2.5.6
to 2.5.8
.
Same issue locked it to 2.5.7 on sites we used it on till this is resolved.
Same problem with version 2.5.8 under PHP 8.3. It works when you switch back to version 2.5.7.
-
This reply was modified 8 months, 3 weeks ago by
cataras.
Same error here 2.5.8 under PHP 8.2.22
Same issue here with version 2.5.8 on PHP 8.3.9
Undefined array key "css_target"
in /plugins/svg-support/admin/admin-init.php (line 54)
Same issue with PHP 8.2 & SVG Support 2.5.8
Disable then enable the plugin resolve the issue (with wp-cli, or by deleting the plugin)
-
This reply was modified 7 months, 1 week ago by
striffly.
Also had this issue with 2.5.8
Downgrading wpackagist-plugin/svg-support (2.5.8 => 2.5.7)
@benbodhi got same error on PHP 7.4.
The error is caused by line 54 in admin-init.php because of the undefined target css_target
$value[‘css_target’] = esc_attr( sanitize_text_field( $value[‘css_target’] ) );
You just need to check if the value exist before calling it.
apologies for the delay on this!
I have added the fix in the upcoming version 2.5.9 which will be pushed to the WP repo soon.
It’s still in development as I address a backlog of things here. Latest dev version is at https://github.com/benbodhi/svg-support if you want to test it early.