Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 636537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T20:31:35+00:00 2026-05-13T20:31:35+00:00

Read the comments in the code for a description: <?php class Bootstrap extends Zend_Application_Bootstrap_Bootstrap

  • 0

Read the comments in the code for a description:

<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
public function __construct($configSection){
        $rootDir = dirname(dirname(__FILE__));
        define('ROOT_DIR',$rootDir);

        set_include_path(get_include_path()
        . PATH_SEPARATOR . ROOT_DIR . '/library/'
        . PATH_SEPARATOR . ROOT_DIR .
        'application/models'
        );

        //PROBLEM LIES HERE, BEWARE OF DRAGONS.
        //Using this, I receive a deprecated warning.
        include 'Zend/Loader.php';
        Zend_Loader::registerAutoload();        

        //Using this, I recieve an error that autoload() has missing arguments.     
        //Zend_Loader_Autoloader::autoload();       

        //Load the configuration file.
        Zend_Registry::set('configSection', $configSection);
        $config = new Zend_Config_Ini(ROOT_DIR . '/application/config.ini',$configSection);

        Zend_Registry::set('config',$config);
        date_default_timezone_set($config->date_default_timezone);

        //Database configuration settings go here. :)
        $db = Zend_Db::factory($config->db);
        Zend_Db_Table_Abstract::setDefaultAdapter($db);
        Zend_Registry::set('db',$db);
    }

    public function configureFrontController(){
        $frontController = Zend_Controller_Front::getInstance();
        $frontController->setControllerDirectory(ROOT_DIR . '/application/controllers');
    }

    public function runApp(){
        $this->configureFrontController();

        //Runs the Zend application. :)
        $frontController = Zend_Controller_Front::getInstance();
        $frontController->dispath();
    }
}

I’m trying to follow a tutorial that wants me to configure my Zend app to use the autoloading functions that it offers.

When using the registerAutoLoad() method, I receive a deprecated warning and it tells me to use another method, the one below it in my code.

What can I do?

Edit: Why I was using the deprecated method:

One less than ideal aspect of the
bootstrap file in the original Hello
World is that there are a lot of
Zend_Loader::loadClass() calls to load
up the classes we need before we use
them.

In larger applications, there are even
more classes in use, resulting in
clutter throughout the application
just to ensure that the right classes
are included at the right time.

For our Places website, we use PHP’s
__autoload() functionality so that PHP will automatically load our classes
for us. PHP5 introduced the
__autoload() magic function that is called whenever you try to instantiate
a class that hasn’t yet been defined.

The Zend_Loader class has a special
registerAutoload() method specifically
for use with __autoload(), as shown in
listing 3.1 b. This method will
automatically use PHP5’s Standard PHP
Library (SPL) spl_autoload_register()
function so that multiple autoloaders
can be used.

After Zend_Loader::registerAutoload()
has been called, whenever a class is
instantiated that has not yet been
defined, the file containing the class
is included. This solves the problem
of Zend_Loader::loadClass() clutter
and ensures that only the needed files
are loaded for any given request.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T20:31:35+00:00Added an answer on May 13, 2026 at 8:31 pm

    Because Autoloading was changed in ZF1.8 you should replace

    require_once 'Zend/Loader.php';
    Zend_Loader::registerAutoload();
    

    with

    require_once 'Zend/Loader/Autoloader.php';
    $loader = Zend_Loader_Autoloader::getInstance();
    $loader->registerNamespace('App_');
    

    or use the fallback autoloader with

    $loader->setFallbackAutoloader(true);
    $loader->suppressNotFoundWarnings(false);
    

    Depending on the age of your tutorial, I suggest checking out the tutorial for the recent ZF1.10 at Rob Allen’s blog as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 449k
  • Answers 449k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer When saving, make a copy of the list in memory… May 15, 2026 at 8:06 pm
  • Editorial Team
    Editorial Team added an answer Dictionaries are unordered. If you mean "the 5th item added… May 15, 2026 at 8:06 pm
  • Editorial Team
    Editorial Team added an answer Lots of things you could do. s.substring(s.lastIndexOf(':') + 1); will… May 15, 2026 at 8:06 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.