Page 1 of 1

Finding the XML declaration remover in PhpBB?

Posted: Tue Nov 20, 2007 11:10 am
by JAB Creations
The developers over at PhpBB think I have no right to use an XML declaration the point of completely burying the code that intentionally goes in to the templates to remove it.

It's definitely a string that matches ?xml string and it will remove it regardless of how many times you declare it or what line it is on. Putting a symbol between ? and xml will break this script...but it will also break the declaration. So does anyone have an idea of what PHP syntax might be conjoining the ? and XML strings?

Posted: Thu Nov 22, 2007 2:30 am
by GeertDD

Code: Select all

// Using capturing parentheses
$str = preg_replace('/(\?).(xml)/', '$1$2', $str);

// Or using lookaround
$str = preg_replace('/(?<=\?).(?=xml)/', '', $str);
First one appears to be faster.