Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
GoogleCodeExporter opened this issue Feb 17, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link

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
Copy link
Author

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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant