05
Jan 13

Regular expressions – test online

I have been fiddling around with Regular Expressions these days. As most people who ever tried it know that you can do about anything but it is at the same time nearly impossible.

Instead of making a test page, altering and refreshing minor changes all day I decided to look around a bit for a handy tool. There are a lot of them out there but I found a nice one.

The cool thing is you can easily switch between modes, modifiers and it automatically refreshed. The only minor point is that it is sometimes hard to see the difference between no match and an expression crash.

Check it out: Online regular expressions tester

Let me know if you found a better one!


14
Nov 12

PHP 5.4 and call-time-pass-by-reference

A word of warning. I just updated to PHP 5.4 which broke my installation because call-time-pass-by-reference has been removed in this version. See: passing by reference.

Along with some other functions you shouldn’t be using anymore anyway. See the incompatible list.

For up-to-date plugins and software this shouldn’t be a problem since it was deprecated for a while already.

For me it notably breaks the Feedwordpress plugin in WordPress and gives a fatal error, which is annoying. A simple solution is present but you need to dive into the code and replace a few lines. See the solution here.

I fear older plugins of various kinds are also vulnerable for this problem, so I advice to check your installation locally against a new php version to see if any problems arise before your host decides to upgrade their installation!


08
Nov 12

WordPress Update_option and serialize

I ran into this interesting feature yesterday I was not aware of. If you are trying to put options WordPress using Update_option serializing the data before actually causes unexpected behaviour.

The catch is that WordPress already serializes data send to the function. When invoking get_option the data will be unserialized. Obviously this causes an error if you try to unserialize the whole thing after that.

In short, just push an unserialized array unto update_option and everything will be fine!

update_option("stuff",array('foo','bar'));
$foobar = get_option("stuff");

See this blog post for more backgrounds.