PHP class_exists acting case sensitive
<p>According to PHP's documentation <a href="http://php.net/manual/en/function.class-exists.php" rel="nofollow"><code>class_exists()</code></a> is not case sensitive. However, I'm experiencing that it is. For example, <code>class_exists("\\My\\Class")</code> returns true but <code>class_exists("\\My\\class")</code> returns false.</p>

<p>I'm running <code>PHP 5.3.3.</code> I have two separate environments. This is working correctly in one environment, but the other environment is acting like it cares about case.</p>

<p>What am I missing? Is there a config setting somewhere?</p>

<p><strong>UPDATE:</strong></p>

<p>For anyone else experiencing this problem, I found the issue. <code>class_exists()</code> uses the autoloader for any classes that have not been declared. <code>class_exists()</code> will behave as case insensitive as long as the class shows up in the list returned by <a href="http://php.net/manual/en/function.get-declared-classes.php" rel="nofollow"><code>get_declared_classes()</code></a>. However, if the class you are looking for does not show up in this list, it relies on the registered autoloader stack to find it. The autoloader my project is using is Symfony2's UniversalClassLoader which ultimately relies on <a href="http://php.net/manual/en/function.file-exists.php" rel="nofollow"><code>file_exists()</code></a> to autoload the class. <code>file_exists()</code> IS case sensitive as long as the system's environment is case sensitive. This is why I was seeing the problem on one environment and not the other. There are many ways to solve this problem by adding an autoloader that is not case sensitive. There are also some good examples of some case insensitive <code>file_exists()</code> implementations in the documentation comments.</p>

<p>I sincerely apologize for wasting everyone's time by not effectively communicating the problem and providing a pseudo-example instead of actual code. Rather than my intention of getting to the core of my problem, my pseudo-example was a distraction. I have failed and for that I am truly sorry.</p>
