$cleaned[0]['body'] = preg_replace_callback('~&#x([0-9a-f]+);~i', 'chr(hexdec("\\1"))', $cleaned[0]['body']);
$cleaned[0]['body'] = preg_replace_callback('~&#([0-9]+);~', 'chr("\\1")', $cleaned[0]['body']);
So...
That text isn't part of a standard SMF install. You just pasted that here without further explanations, what exactly should we do about it?
I suppose this is another case why we need a mind reading mod. It's not finished, feel free to contribute.
Yes this is for secure mod.
I solution only one:
Replace:
$cleaned[0]['body'] = preg_replace_callback('~&#([0-9]+);~', 'chr("\\1")', $cleaned[0]['body']);
With:
$cleaned[0]['body'] = preg_replace_callback('~&#([0-9]+);~', create_function ('$matches', 'return chr($matches[1]);'), $cleaned[0]['body']);
But this
$cleaned[0]['body'] = preg_replace_callback('~&#x([0-9a-f]+);~e', create_function ('$matches', 'return chr(hexdec($matches[1]));'), $cleaned[0]['body']);
Give me error:
Quotepreg_replace_callback(): Modifier /e cannot be used with replacement callback
What is wrong?
You can't use the /e option with preg_replace_callback, nor can you use it with preg_replace any more.
But as ever, more details about what you're actually trying to do would be useful because we're still not mind readers.
Quote from: ‽ on July 21, 2014, 01:09:02 PM
You can't use the /e option with preg_replace_callback, nor can you use it with preg_replace any more.
But as ever, more details about what you're actually trying to do would be useful because we're still not mind readers.
I just update mod which one is for php 5.3 or less. My host have php 5.5. I got error every day if just any viewing post.
Yes because we're mind readers and know exactly what you're talking about.
Oh, wait, no we don't.
Omg MESWEB you have been politely asked to provide FULL details of what you are trying to achieve and you can either do it and we (may) support you after you doing it or you could also check if you need support with your native language because no offense dude but your English is quite bad. Post here if you choose the second option: http://www.simplemachines.org/community/index.php?board=97.0
Quote from: Flavio93Zena on July 21, 2014, 02:03:13 PM
Omg MESWEB you have been politely asked to provide FULL details of what you are trying to achieve and you can either do it and we (may) support you after you doing it or you could also check if you need support with your native language because no offense dude but your English is quite bad. Post here if you choose the second option: http://www.simplemachines.org/community/index.php?board=97.0
What are You don't understand? OMG. Look at the subject. What You see? Yes You will see:
Quotepreg_replace_callback(): Requires argument 2, 'chr("\1")', to be a valid callback
So what is that mind? It's a ERROR message from logs. WOW. Why MESWEB write that subject? Because he f**king need help. Help what? He need help with this f**king code:
$cleaned[0]['body'] = preg_replace_callback('~&#x([0-9a-f]+);~e', create_function ('$matches', 'return chr(hexdec($matches[1]));'), $cleaned[0]['body']);
I so sorry for asking help with codding. If any one don't know PHP they should don't answer - this is just simple and clever.
Oh, I know PHP. I am actually certified as a Zend Certified Engineer. I'm also formerly an SMF dev and one of the people who worked on doing this stuff for SMF itself to be compatible with PHP 5.5. I presume that's enough of a qualification for you?
The problem is we don't have enough material to work on, you've provided bits of code without any context as to what the code is supposed to do or what mod it's from so we can look at what code might work better for the job at hand.
Actually I am requesting lock on this for you being the most rude user I had ever met and also for still not explaining the problem that you have.
Thank you all for not helping. Sorry for wasting Your time.
Thank you for not providing enough information to be able to help you. Sorry you didn't get the help you were looking for.
Its a regex not a simple php code, regex suppose to find unique things or things has common parts. So the thing here, probably most of the people reading this topic cannot solve the issue or help you. Actually, our rules says if this code is a part of a modification you must ask mod author to make his/her mod compatible with PHP5.5, or you can skip this issues with asking your host to downgrade your host to PHP 5.4