Development

Changeset 5851

You must first sign up to be able to contribute.

Changeset 5851

Show
Ignore:
Timestamp:
11/04/07 17:05:37 (2 years ago)
Author:
fabien
Message:

fixed sfZendFrameworkBridge AutoLoad? Not Working (closes #2314)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/lib/addon/bridge/sfZendFrameworkBridge.class.php

    r4752 r5851  
    2626class sfZendFrameworkBridge 
    2727{ 
     28  static protected 
     29    $withLoader = true; 
     30 
    2831  public static function autoload($class) 
    2932  { 
    3033    try 
    3134    { 
    32       if (class_exists('Zend_Version')
     35      if (self::$withLoader
    3336      { 
    3437        Zend_Loader::loadClass($class); 
     
    4649    return true; 
    4750  } 
    48    
     51 
    4952  /** 
    5053   * Detect and return the path to current Zend loader class. 
    5154   * 
    5255   * Starting from ZF 0.9.0 autoloading function has been moved 
    53    * from Zend.php to Zend/Version.php class. 
     56   * from Zend.php to Zend/Loader.php class. 
    5457   * Starting from ZF 1.0.0 Zend.php class no longer exists. 
    5558   * 
    56    * This function tries to detect whether Zend_Version exists 
     59   * This function tries to detect whether Zend_Loader exists 
    5760   * and returns its path if yes. 
    5861   * If the first step fails, the class will try to find Zend.php library 
    5962   * available in ZF <= 0.9.0 and returns its path if its exists. 
    60    *  
    61    * If neither Zend/Version.php nor Zend.php exists, 
     63   * 
     64   * If neither Zend/Loader.php nor Zend.php exists, 
    6265   * then this function will raise a sfAutoloadException exception. 
    6366   * 
     
    7275    $base = sfConfig::get('sf_zend_lib_dir') ? sfConfig::get('sf_zend_lib_dir').'/' : ''; 
    7376 
    74     // first check whether Zend/Version.php exists 
    75     // Zend/Version.php is available starting from ZF 0.9.0 
     77    // first check whether Zend/Loader.php exists 
     78    // Zend/Loader.php is available starting from ZF 0.9.0 
    7679    // Before ZF 0.9.0 you should call Zend.php 
    7780    // Plese note that Zend.php is still available in ZF 0.9.0 
    7881    // but it should not be called because deprecated 
    79     if (file_exists($base.'Zend/Version.php')) 
     82    if (file_exists($base.'Zend/Loader.php')) 
    8083    { 
    81       require_once($base.'Zend/Version.php'); 
     84      require_once($base.'Zend/Loader.php'); 
     85      self::$withLoader = true; 
    8286    } 
    8387    else if (file_exists($base.'Zend.php')) 
    8488    { 
    8589      require_once($base.'Zend.php'); 
     90      self::$withLoader = false; 
    8691    } 
    8792    else 
    8893    { 
    89       throw new sfAutoloadException('Invalid Zend Framework library structure, unable to find Zend/Version.php (ZF >= 0.9.0) or Zend.php (ZF < 0.9.0) library'); 
     94      throw new sfAutoloadException('Invalid Zend Framework library structure, unable to find Zend/Loader.php (ZF >= 0.9.0) or Zend.php (ZF < 0.9.0) library'); 
    9095    } 
    9196  } 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.