Ver Fonte

ZF-8842: check that the loaded class implements Zend_Serializer_Adapter_AdapterInterface without execute code

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@20347 44c647ce-9c0f-0410-b52a-842ac1e357ba
mabe há 16 anos atrás
pai
commit
8a9228685e
1 ficheiros alterados com 5 adições e 3 exclusões
  1. 5 3
      library/Zend/Serializer.php

+ 5 - 3
library/Zend/Serializer.php

@@ -65,12 +65,14 @@ class Zend_Serializer
             throw new Zend_Serializer_Exception('Can\'t load serializer adapter "'.$adapterName.'"', 0, $e);
         }
 
-        $adapterObj = new $adapterClass($opts);
-        if (!$adapterObj instanceof Zend_Serializer_Adapter_AdapterInterface) {
+        // ZF-8842:
+        // check that the loaded class implements Zend_Serializer_Adapter_AdapterInterface without execute code
+        if (!in_array('Zend_Serializer_Adapter_AdapterInterface', class_implements($adapterClass))) {
             require_once 'Zend/Serializer/Exception.php';
             throw new Zend_Serializer_Exception('The serializer adapter class "'.$adapterClass.'" must implement Zend_Serializer_Adapter_AdapterInterface');
         }
-        return $adapterObj;
+
+        return new $adapterClass($opts);
     }
 
     /**