- סטטוס
- נפתר
- דווח עבור
- WPML Multilingual CMS 4.5.10
- נפתר בגרסה
- WPML 4.6.4
- תוסף/ערכת עיצוב קשורים
- Elementor
- תגיות נושא
- Bug, Compatibility
סקירה כללית של התקלה
אם תייבא תוכן הדגמה שדורש את Elementor (המגיע מתבניות Astra או Real Homes, לדוגמה), תבחין שלא ניתן יהיה לתרגם אותו, ותופיע השגיאה הבאה ב־PHP 8:
Fatal error: Uncaught TypeError: json_decode(): Argument #1 ($json) must be of type string, array given in …/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/DataConvert.php:22
זה קורה מכיוון שתוכן ההדגמה הוא נתונים שעברו סריאליזציה, וקוד האינטגרציה שלנו מצפה למחרוזת המקודדת ב־JSON.
פתרון עוקף
הקפד ליצור גיבוי מלא של האתר שלך לפני שתמשיך.
- ערוך את הקובץ …/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Integrations/Elementor/DataConvert.php.
- חפש את שורה 21.
- שנה את:
public static function unserialize( $data ) { return json_decode( is_array( $data ) ? $data[0] : $data, true ); }ל:
public static function unserialize( $data ) { $data = is_array( $data ) ? $data[0] : $data; if (is_string($data)) { return json_decode( $data, true ); } return $data; }