Request for Official Patch: compareObjects() Causes Fatal Error When Invalid Dat
-
Hi Zapier team,
We’ve encountered a fatal error with the Zapier for WordPress plugin (v1.5.2) related to the
compareObjects()method inzapier.php.Error details:
Uncaught ReflectionException: Class "0" does not exist in /wp-content/plugins/zapier/zapier.php on line 390This happens when
compareObjects()is called with unexpected or invalid data types (e.g., a string instead of an object), specifically at this line:$reflect1 = new ReflectionClass($obj1);In our case, the plugin had become deactivated or corrupted, leading to
$obj1being a string value like"0", which causes a fatalReflectionException.Proposed fix:
To make the plugin more robust and prevent complete site crashes, we recommend adding a type check before attempting to create
ReflectionClassinstances:private function compareObjects($obj1, $obj2) {
if (!is_object($obj1) || !is_object($obj2)) {
return []; // Or log/throw if needed
}
$reflect1 = new ReflectionClass($obj1);
$reflect2 = new ReflectionClass($obj2);...
}We’d appreciate it if this fix could be included in the next official release to prevent similar issues for other users. Let us know if you need more details or logs.
Thanks for your help and for maintaining this plugin!
The topic ‘Request for Official Patch: compareObjects() Causes Fatal Error When Invalid Dat’ is closed to new replies.