Archive for August, 2007

more fun migrating from php4

Friday, August 31st, 2007

This is mentioned in the php manual, in php4 the get_class function returns the class name in lower case while in php5 it is returned in the true case the class was defined in. eg: for a class called DateSpan

PHP4: get_class($dateSpan) == ‘datespan’;

PHP5: get_class($dateSpan) == ‘DateSpan’;

migrating from php4 to php5 - watch out for domxml

Tuesday, August 21st, 2007

We recently moved a substantial application from php4 to php5 and it all went very smoothly, nearly…

The code had been thoroughly tested against php5 and was passing all the tests. We’d had problems with php5 passing objects by reference rather than value which had broken code in the pass and we knew we had that base covered. The problem was that we had tested against php5 on windows and were deploying to php5 on linux. Our code used the old domxml library which you can get as an extension quite easily for windows but for linux it was an absolute nightmare.

Domxml has been removed from php5 for what I’m sure are very good reasons and moved to the pecl library. Fair enough, the new dom library is by all reports far superior. Except the pecl library doesn’t have the actual extension on their website so ‘pecl install domxml’ fails.

I managed to track down the domxml source code in the pecl CVS but the bloody thing wouldn’t compile - and would die on
configure: error: Either use deprecated dom or new dom5 extension.

Now the only useful page with this error message was in german
luckily enough I did quite a bit of german at high school so between my fragmenting memory and google
I managed to get the gist of the post which was - I had the same error and fixed it by reinstalling libxml2. Unfortunately our libxml2 library had 48 dependencies so bugger that for a joke.

We’re now rewriting the part of our app that uses domxml.

Empty form action in safari

Wednesday, August 1st, 2007

Interesting cross browser compatibility problem with safari last night. If the form action was left blank then normally the form should submit to the current page it is on - this worked fine in IE and firefox but wouldn’t work in safari. I suspect this had something to do with the base href meta tag - changing the action to the filename of the current page as a relative path fixed the problem.

Just one more thing to add to the growing list of checks we need to do when building sites for multiple browsers - don’t use empty form actions!