diff --git a/lib/PayPal/Validation/ModelAccessorValidator.php b/lib/PayPal/Validation/ModelAccessorValidator.php index 2810e17..67c131d 100644 --- a/lib/PayPal/Validation/ModelAccessorValidator.php +++ b/lib/PayPal/Validation/ModelAccessorValidator.php @@ -26,8 +26,12 @@ class ModelAccessorValidator if ($mode != 'disabled') { //If the mode is disabled, bypass the validation foreach (array('set' . $attributeName, 'get' . $attributeName) as $methodName) { + if (get_class($class) == "PayPal\\Common\\PPModel") { + // Silently return false on cases where you are using PPModel instance directly + return false; + } //Check if both getter and setter exists for given attribute - if (!method_exists($class, $methodName)) { + elseif (!method_exists($class, $methodName)) { //Delegate the error based on the choice $className = is_object($class) ? get_class($class) : (string)$class; $errorMessage = "Missing Accessor: $className:$methodName. Please let us know by creating an issue at https://github.com/paypal/PayPal-PHP-SDK/issues";