Issues

ZF-6419: Zend_Tool's public/index.php doesn't work with Zend_Application

Issue Type: Bug Created: 2009-04-25T08:31:34.000+0000 Last Updated: 2009-04-25T12:53:42.000+0000 Status: Resolved Fix version(s): - 1.8.0 (30/Apr/09)

Reporter: Rob Allen (rob) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Application

Related issues: Attachments: - zf6419.patch

Description

The index.php generated by Zend_Tool (trunk revision 15149) generates the following code:

<pre class="highlight">
$application->bootstrap()
            ->run();

Unfortunately, Zend_Application::bootstrap() is defined as:

<pre class="highlight">
public function bootstrap()
{
    $this->getBootstrap()->bootstrap();
}

Either Zend_Application::bootstrap() should return $this; or Zend_Tool should generate code like this:

<pre class="highlight">
$application->bootstrap()
$application->run();

Comments

Posted by Rob Allen (rob) on 2009-04-25T08:54:50.000+0000

Attached suggested patch:

<pre class="literal">Index: tests/Zend/Application/ApplicationTest.php
===================================================================
--- tests/Zend/Application/ApplicationTest.php  (revision 15149)
+++ tests/Zend/Application/ApplicationTest.php  (working copy)
@@ -319,6 +319,12 @@
         $application = new Zend_Application('testing', $config->toArray());
         $this->assertTrue($application->hasOption('foo'));
     }
+
+    public function testBootstrapReturnsTheZendAppplicationInstance()
+    {
+        $application = $this->application->bootstrap();
+        $this->assertEquals($application, $this->application);
+    }
 }
 
 if (PHPUnit_MAIN_METHOD == 'Zend_Application_ApplicationTest::main') {
Index: library/Zend/Application.php
===================================================================
--- library/Zend/Application.php    (revision 15149)
+++ library/Zend/Application.php    (working copy)
@@ -285,11 +285,12 @@
     /**
      * Bootstrap application
      * 
-     * @return void
+     * @return Zend_Application
      */
     public function bootstrap()
     {
         $this->getBootstrap()->bootstrap();
+        return $this;
     }
 
     /**

Posted by Rob Allen (rob) on 2009-04-25T12:53:40.000+0000

Fixed by Mattthew in r15150 on trunk and r15151 on release-1.8

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts