cloudinary_wordpress
cloudinary_wordpress copied to clipboard
This is failing and returning notice error
Hello this function seems to be broken in our project.
https://github.com/cloudinary/cloudinary_wordpress/blob/edd640e708893f77002d92c9c83ac8fd82163772/php/class-utils.php#L518
it returns this notice in the start of JSON
<br />
<b>Notice</b>: Uninitialized string offset: 0 in <b>/var/www/html/wp-content/plugins/cloudinary-image-management-and-manipulation-in-the-cloud-cdn/php/class-utils.php</b> on line <b>518</b><br />
We fixed it like this:
*/
public static function looks_like_json( $thing ) {
// return ! empty( $thing ) && is_string( $thing ) && in_array( ltrim( $thing )[0], array( '{', '[' ), true );
if (is_string($thing)) {
$trimmedThing = ltrim($thing);
return !empty($thing) && strlen($trimmedThing) > 0 && in_array($trimmedThing[0], ['{', '['], true);
} else {
return false; // or handle the case when $thing is not a string
}
}
Hi @shay-te,
Would you mind sharing more context on the issue? Is there a way to reproduce it on our side?
Could you also share a system report as documented here? If you don't want to share it here, please open a ticket to [email protected].
Thanks!
Hi @shay-te, is still relevant? Thanks!
No
On Wed, May 29, 2024 at 2:10 PM Loic VdB @.***> wrote:
Hi @shay-te https://github.com/shay-te, is still relevant? Thanks!
— Reply to this email directly, view it on GitHub https://github.com/cloudinary/cloudinary_wordpress/issues/933#issuecomment-2137152822, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHNOAMQBE7XDHWWI7QGSD3ZEWZRHAVCNFSM6AAAAABCZTV77CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZXGE2TEOBSGI . You are receiving this because you were mentioned.Message ID: @.***>
Thanks @shay-te !