Fix broken escaped include path which breaks some but not all Windows installs.
authorBrion Vibber <brion@users.mediawiki.org>
Mon, 25 Oct 2004 02:33:33 +0000 (02:33 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Mon, 25 Oct 2004 02:33:33 +0000 (02:33 +0000)
PHPTAL-NP-0.7.0/libs/PHPTAL/Generator.php

index 147b0a0..3707694 100644 (file)
@@ -81,8 +81,12 @@ class PHPTAL_Generator
                 $this->_code .= $code;
             }
             if ($this->_gettext_required) {
+               # Protect against the string and the inclusion.
+               # Note: some really obscure characters might still break.
+               $path = addslashes( PT_IP );
+               $path = str_replace( array( '$', '\\' ), array( '\\$', '\\\\' ), $path );
                 $this->_code = preg_replace('/^<\?php/sm', 
-                                            '<?php require_once "' . addslashes( PT_IP ) . '/GetText.php";', 
+                                            '<?php require_once "' . $path . '/GetText.php";', 
                                            $this->_code, 
                                            1);
             }