﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	severity	resolution	keywords	cc
13436	Wordpress class_exists() conflicts with __autoload() and php_auto_prepend	galbus		"== Issue ==

Wordpress core (and many plugins) use class_exists().

http://php.net/manual/en/function.class-exists.php

When Wordpress is integrated with custom/third party applications that use php_auto_prepend and autoload() to include/require files based on the $class_name parameter this generates errors as class_exists() triggers the autoload() and the files cannot be found.

== To reproduce ==

Using php_auto_prepend specify a file to include before every page request that contains the following PHP code:

{{{
<?php
function __autoload($class) {
    include($class.'.php');
}
?>
}}}

Visit any front-end or back-end Wordpress page.

== Solution ==

As there is no autoload() function defined in Wordpress core the class_exists() should implement the second class_exists() parameter:

{{{
<?php
if (!class_exists('ExampleClass', false)) {
    ...
}
?>
}}}

This stops calls to __autoload() and would fix the errors seen when integrating Wordpress with apps that implement this.

I have implemented this and tested it and Wordpress works fine, but I can't find out where the SVN repo is for Wordpress 3 Beta 2 (the SVN page on the site takes me to 2.x).

If someone could supply a link for SVN CO of WP3 I can provide the patch."	enhancement	reopened	normal	Future Release	General	3.1	minor		needs-patch	azizur
