Project:Zend Framework
Version:6.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

This small patch implements PHP autoloading so you just need to use Zend_* classes into your modules, no need to initialize nor anything.

It will work for any class whose name starts with 'Zend_*' and needs PHP > 5.1.2. About PHP autoload, see http://www.php.net/manual/en/function.spl-autoload-register.php

It also gets rid of the global variable, which I don't see why it's needed, and makes it a static one.

AttachmentSize
zend_autoload.patch1.25 KB

Comments

#1

Status:active» needs work

Thanks a lot! I love it.

/**
* Autoload implementation
*/
function zend_autoload($class) {dsm($class);
  // Just for classes starting with 'Zend'
  if (strpos($class, 'Zend_') === 0) {
    zend_initialize($class);

We probably don't want that dsm in there ;-) . Applies cleanly to HEAD too!

#2

Actually, we might want to look into Autoload Drupal module and possibly add it as a dependency.

#3

The issue with Autoload is that you need to define all classes previously (hook_autoload_info), while in this case we are doing class autoloading using only class name.

This patch is compatible with Autoload, actually I'm using both in the same install.

#4

Why not just use the Zend_Loader to do the heavy lifting for Zend?

#5

Status:needs work» fixed

This is what the 2.x branch and Drupal 7 versions already do.

#6

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here