Forráskód Böngészése

Merged r25062 from trunk

git-svn-id: http://framework.zend.com/svn/framework/standard/branches/release-1.12@25063 44c647ce-9c0f-0410-b52a-842ac1e357ba
rob 13 éve
szülő
commit
1dd8cc652d
2 módosított fájl, 33 hozzáadás és 0 törlés
  1. 3 0
      library/Zend/Gdata/App.php
  2. 30 0
      tests/Zend/Gdata/AppTest.php

+ 3 - 0
library/Zend/Gdata/App.php

@@ -1060,6 +1060,9 @@ class Zend_Gdata_App
                      break;
                  } catch (Zend_Exception $e) {
                      // package wasn't here- continue searching
+                 } catch (ErrorException $e) {
+                     // package wasn't here- continue searching
+                     // @see ZF-7013 and ZF-11959
                  }
             }
             if ($foundClassName != null) {

+ 30 - 0
tests/Zend/Gdata/AppTest.php

@@ -584,4 +584,34 @@ class Zend_Gdata_AppTest extends PHPUnit_Framework_TestCase
         $feed = $this->service->newFeed();
         $this->assertEquals($v, $feed->getMinorProtocolVersion());
     }
+
+    /**
+     * When error handler is overridden to throw an ErrorException, the extension loader
+     * in Zend_Gdata will throw an ErrorException when the class doesn't exist in the 
+     * first extension directory even if it exists in subsequent ones.  This test 
+     * enforces a fix that keeps this from happening
+     *
+     * @group ZF-12268
+     * @group ZF-7013
+     */
+    public function testLoadExtensionCausesFatalErrorWhenErrorHandlerIsOverridden()
+    {
+        // Override the error handler to throw an ErrorException
+        set_error_handler(create_function('$a, $b, $c, $d', 'throw new ErrorException($b, 0, $a, $c, $d);'), E_ALL);
+        try { 
+            $eq = $this->service->newEventQuery();
+            restore_error_handler();
+            $this->assertType('Zend_Gdata_Calendar_EventQuery', $eq);
+        } catch ( Zend_Gdata_App_Exception $ex ) {
+            // If we catch this exception, it means the ErrorException resulting
+            // from the include_once E_NOTICE was caught in the right place,
+            // but the extension was not found in any directory
+            // (Expected since we didn't load the Calendar extension dir)
+            restore_error_handler();
+            $this->assertContains('EventQuery', $ex->getMessage());
+        } catch ( ErrorException $ex ) {
+            restore_error_handler();
+            $this->fail('Did not expect ErrorException');
+        }
+    }
 }