[pmwiki-users] Transferring Wiki to another server

Bob Hazeldine bhazeldine at lkwdpl.org
Mon Nov 7 13:01:45 CST 2005


Rats.  I was hoping that wasn't it.

Patrick R. Michaud wrote:
> On Mon, Nov 07, 2005 at 11:34:44AM -0600, Jonathan Scott Duff wrote:
> 
>>On Mon, Nov 07, 2005 at 12:20:09PM -0500, Bob Hazeldine wrote:
>>
>>>PHP on new server is 5.0.4
>>>Pmwiki is 1.0.13
>>
>>Looking at the code, I'd guess that your previous webserver had a more
>>forgiving version of PHP installed as that line looks like it might
>>need addslashes wrapped around part of it. I'm not sure, but here's a
>>guess at what might work:
>>
>>$text = preg_replace("/(\\\\*)\\\\\n/e",
>>    "' '.str_repeat('<br />',strlen('".addslashes($1)."'))",$text);
> 
> 
> I'm suspecting a PHP bug, or perhaps PHP is changing the way it
> interprets the /e option (which would be Very Bad).
> 
> The original lines are:
> 
>   $text = preg_replace("/(\\\\*)\\\\\n/e",
>     "' '.str_repeat('<br />',strlen('$1'))",$text);
> 
> which is supposed to find lines with two or more backslashes at
> the end and generates <br /> tags for each.  In a normal preg_replace,
> PHP sees the "/e" at the end and puts backslashes in front of any
> quotes or backslashes it finds in the capture variable, so that
> $1 should be "\\" and not "\".  However, the error message being
> received is
> 
>     Fatal error: preg_replace() [function.preg-replace]: Failed evaluating 
>     code: ' '.str_repeat('<br />',strlen('\')) in 
>     /var/www/htdocs/pmwiki/pmwiki.php on line 821
> 
> which indicates that $1 received a single backslash.  Using
> addslashes() doesn't help here, as the argument ($1) still
> contains an unescaped backslash.
> 
> I think that several people have been able to run PmWiki on PHP 5.0.4
> without any problems, so I'm guessing it's something about the PHP
> instance on the server that's causing the problem here.
> 
> Pm
> 

-- 
-Bob Hazeldine
-Lakewood Public Library




More information about the pmwiki-users mailing list