Procházet zdrojové kódy

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 před 16 roky
rodič
revize
8a9228685e
1 změnil soubory, kde provedl 5 přidání a 3 odebrání
  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);
             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';
             require_once 'Zend/Serializer/Exception.php';
             throw new Zend_Serializer_Exception('The serializer adapter class "'.$adapterClass.'" must implement Zend_Serializer_Adapter_AdapterInterface');
             throw new Zend_Serializer_Exception('The serializer adapter class "'.$adapterClass.'" must implement Zend_Serializer_Adapter_AdapterInterface');
         }
         }
-        return $adapterObj;
+
+        return new $adapterClass($opts);
     }
     }
 
 
     /**
     /**