Menu

#78 Include directives with \\0 (on Windows)

open
nobody
3
2005-09-17
2005-09-17
JW
No

On line 176 in the file
framework/template/compiler/codewriter.inc.php, a
preg_replace replaces the first occurence of "<?php "
in the file with the include directives. But, if
$includecode contains "\\0", this will be replaced with
"<?php " (http://www.php.net/preg_replace). On Windows,
directories are seperated using a backslashed backslash
(\\). So, if there's a directory starting with "0",
it's replaced with "<?php ".
For example, if $includecode contains
require_once 'C:\\php\\myproject\\0.9\\file.php';
the "\\0" is replaced with "<?php ", and this becomes
require_once 'C:\\php\\myproject<?php .9\\file.php';
resulting in an error.

Discussion

  • JW

    JW - 2005-09-17
    • priority: 5 --> 3
     
  • JW

    JW - 2005-09-17

    Logged In: YES
    user_id=1303526

    This can easily be fixed by changing line 176 from:
    return preg_replace($pattern, '<?php ' . $includecode,
    $this->code, 1);

    into:
    return preg_replace($pattern, '<?php ' . str_replace('\\',
    '/', $includecode), $this->code, 1);

    Anyway, I don't think I can change it in the CVS (at least
    not without installing a CVS client), so could someone
    change it it the code?

     

Log in to post a comment.

MongoDB Logo MongoDB