Error: Cannot create object
-
Hello!
When this plugin is working, sometimes an error occurs that blocks the normal work of the store.
When you open any page, just a white page appears with the following text: Error: Cannot create object.
Since this happens rarely (1-2 times a month), it was very difficult to find out why this was happening. Disabling plug-ins or changing the theme to the standard does not help, because It is not known when the error will repeat.
Attempting to find information about this error does not lead to a good result.
When I realized that this was not an error from NGINX, PHP or a database, I decided to check the presence of the text of this error in all the files of the site.
This error was found in this plugin, in the files woocs_after_33.php and woocs_before_33.php. This plug-in error occurs if an error occurs in obtaining currency rates using Sberbank.
$xml = simplexml_load_string($res) or die("Error: Cannot create object"); $xml = $this->object2array($xml); $rates = array(); $nominal = array(); //*** if (isset($xml['Valute'])) { if (!empty($xml['Valute'])) { foreach ($xml['Valute'] as $value) { $rates[$value['CharCode']] = floatval(str_replace(',', '.', $value['Value'])); $nominal[$value['CharCode']] = $value['Nominal']; } } }
I hope this information will help other users.
- The topic ‘Error: Cannot create object’ is closed to new replies.