title: PHP include_path getting \-escape processed "later" on Windows
body: <p>I know how to fix this with brute-force prevention (I think), but I'm wondering if anyone has encountered this and/or come up with some good ideas for tracking down the real root cause.</p>
  
  <p>I'm on <code>Windows XP</code> with <code>php 5.4.31</code>. I've set my include_path such that with <code>xdebug</code> I can see the result of <code>get_include_path()</code> to be:</p>
  
  <pre><code>C:/xampp1826/htdocs/OSH2/application/../library;C:\xampp1826\htdocs\OSH2\library;.;C:\xampp1826\php\PEAR
  </code></pre>
  
  <p>This is a <code>ZF1</code> application that uses the <code>Zend</code> class autoloader, and that's what <code>include_path()</code> returns as various things get autoloaded successfully. Then "suddenly", just before attempting to autoload one particular class for which it has correctly computed the filename relative to the <code>include_path</code>, I can see that <code>get_include_path()</code> returns that string with each \xa sequence converted to a line feed <code>(ascii decimal 10)</code>, causing the autoloader's <code>include_once</code> to fail.</p>
  
  <p>I've done exhaustive searches for additional calls to <code>set_include_path()</code> (including all the <code>php</code> libraries I use), and there are only a couple. And I've put breakpoints on them and displayed the result of <code>get_include_path()</code> after each one. Doing that I haven't been able to find <code>php</code> code that actually makes the change! I suppose I could have missed a spot, and I'll re-check everything again after some sleep, but as things stand right now, it looks like a bug in <code>php</code>. In fact, once the right characters are in the <code>include_path</code> string, I can't even imagine how <code>php</code> code could easily/accidentally perform the escape processing. And although I can't easily switch back right now, I did not have this problem using <code>php 5.3.1</code> on what I'm 99% certain was the exact same source code. Was there some kind of change in <code>php 5.4</code> that might explain this?</p>
  
  <p>Has anyone else seen something like this, and if so how did you track down the root cause?</p>
  
  <p>Since php on windows is perfectly happy to accept forward slashes in pathnames rather than back slashes, my brute force prevention strategy is simply to ensure that no backslashes ever get into the include path, with code along the lines of:</p>
  
  <pre><code>define('APPLICATION_PATH', str_replace('\\', '/', realpath(str_replace('\\', '/', realpath(dirname(__FILE__) . '/../application')))));
  </code></pre>