Jump to content

Constannt "Unknown modifier" error even though I fixed it multiple times?


Recommended Posts

I keep getting an "Unknown modifier" error with this line of code in my script:

 

$ret = @preg_replace('«'.stripslashes($pattern).'«i', $this->current_feed['replace'][$i], $this->postinfo[$postfield]);

 

The error says there is a '�' character but when I check the file there are none of them present in the code, though first time I chekced there were then I removed them but error still occurs.

 

preg_replace() [function.preg-replace]: Unknown modifier '�'

 

Is there a case that it is not refreshing the script and I need to delete and replace? (tried this though)

Is there an issue with the initial line of code I've shown? (it has worked for weeks up until I changed memory size scripts are allowed to use).

The weird issue is that no matter how many times I change the line to the previously working line - the script will still encounter the issue...?

 

All replies thanked in advance and I'll pop back soon to see any suggestions. Thanks.

I think you're using a character set that's not supported.  Why are you using that character as a delimiter anyway? («)

 

Also, remove the '@' symbol.  Suppressing errors isn't healthy, if you have errors you should handle them appropriately.

I think you're using a character set that's not supported.  Why are you using that character as a delimiter anyway? («)

 

Also, remove the '@' symbol.  Suppressing errors isn't healthy, if you have errors you should handle them appropriately.

 

The weird part is this script worked fine, then where the («) are was replaced with those weird question marks so I replaced with the backed up file but still get those errors saying they still exist when they don't any more?

 

Could the script possibly have cached an old version of the way it runs?

I think you're using a character set that's not supported.  Why are you using that character as a delimiter anyway? («)

 

Also, remove the '@' symbol.  Suppressing errors isn't healthy, if you have errors you should handle them appropriately.

 

The weird part is this script worked fine, then where the («) are was replaced with those weird question marks so I replaced with the backed up file but still get those errors saying they still exist when they don't any more?

 

Post your current code.

 

$ret = preg_replace('«'.stripslashes($pattern).'«i', $this->current_feed['replace'][$i], $this->postinfo[$postfield]);

 

Could it have cached the file it is using and is still using an old version with the weird question marks? As it's this same error over and over again even though the weird question marks are not in the code any more?

You can't use multibyte unicode characters (« is \u00AB) as delimiters for your pattern. See http://php.net/regexp.reference.delimiters

 

This.  I just told you that character is not supported.  Look at Salathe's link:

Often used delimiters are forward slashes (/), hash signs (#) and tildes (~).

You can't use multibyte unicode characters (« is \u00AB) as delimiters for your pattern. See http://php.net/regexp.reference.delimiters

 

This worked fine up until an hour ago when  the "«" was replaced with '�'  and it created the error.

 

I then fixed the line but it still keeps saying that the '�'  is causing an "Unknown modifier" even though the '�'  doesn't even exist in the code any more... ?

 

 

You can't use multibyte unicode characters (« is \u00AB) as delimiters for your pattern. See http://php.net/regexp.reference.delimiters

 

This worked fine up until an hour ago when  the "«" was replaced with '�'  and it created the error.

 

I then fixed the line but it still keeps saying that the '�'  is causing an "Unknown modifier" even though the '�'  doesn't even exist in the code any more... ?

 

 

 

The code you pasted still had it.

 

The code you pasted still had it.

 

This code has worked fine for months:

 

$ret = @preg_replace('«'.stripslashes($pattern).'«i', $this->current_feed['replace'][$i], $this->postinfo[$postfield]);

 

Then the error was saying that this character '�' found in the code (even in notepad) like this:

 

$ret = @preg_replace(''�'.stripslashes($pattern).''�i', $this->current_feed['replace'][$i], $this->postinfo[$postfield]); (had to leave off php tags to show it properly).

 

So I replaced the broken code with the code that has been working for months, but it still keeps saying that the '� is on that line and casuing an unknown modifier?? Thanks

Please listen.  Use this code:

 

$ret = preg_replace('~'.stripslashes($pattern).'~i', $this->current_feed['replace'][$i], $this->postinfo[$postfield]);

 

I'm testing this now, hopefully it works, but what I don't understand is why would it have worked all these months then just stopped?

 

Thanks all, I'll come back after rigorous testing :D

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.