rezakho / ganon

Automatically exported from code.google.com/p/ganon
0 stars 0 forks source link

Fatal error: Call to undefined function reg_replace() on line 1509 #44

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What will reproduce the problem?

- Using the function removeClass();

What is the expected output? What do you see instead?

 - Fatal error:  Call to undefined function reg_replace() on line 1509

Which version are you using?

 - Generated on 20 Oct 2012

Please provide any additional information below.

It should be 'preg_replace'.

Original issue reported on code.google.com by ktork...@gmail.com on 31 Jul 2013 at 12:53

GoogleCodeExporter commented 8 years ago
After replacing 'reg_replace' with 'preg_replace' it works but still leaves a 
space after the remaining class name so I've added a 'trim';

I've changed Line 1509 from:

$class = reg_replace('`\b'.preg_quote($c).'\b`si', '', $class);

    to:

$class = trim(preg_replace('`\b'.preg_quote($c).'\b`si', '', $class));

Probably it can be done with regex but it was easier for me with trim.

Original comment by ktork...@gmail.com on 31 Jul 2013 at 1:04

GoogleCodeExporter commented 8 years ago
Your solution leave an extra white space if you need to remove 'bar' from 'foo 
bar foobar'.
Can be fixed with:
$class = rtrim(preg_replace('`\b'.preg_quote($c).'\b\s?`si', '', $class));

Original comment by stef...@balocco.name on 2 Sep 2013 at 10:19