browser icon
You are using an insecure version of your web browser. Please update your browser!
Using an outdated browser makes your computer unsafe. For a safer, faster, more enjoyable user experience, please update your browser today or try a newer browser.

php

SQL Injection with added magic_quotes assistance (the joys of legacy code maintenance)

  Sometimes you really have to laugh (or shoot yourself) when you come across legacy code / the mess some other developer(s) left behind. (Names slightly changed to protect the innocent) class RocketShip { function rahrah() { $sql = “insert into foo (rah,rahrah,…) values ( ‘” . $this->escape_str($this->meh) . “‘, …… )”; mysqli_query($this->db_link, $sql) or … Continue reading »

Categories: development, php | Leave a comment

Zend_Cache – automatic cache cleaning can be bad, mmkay?

$customer uses Zend_Cache in their codebase – and I noticed that every so often a page request would take ~5 seeconds (for no apparent reason), while normally they take < 1 second … Some rummaging and profiling with xdebug showed that some requests looked like : Note how there are 25,000 or so calls for … Continue reading »

Categories: development, performance, php | Tags: , , , | Leave a comment

A caching PHP autoloader

This is probably of little use to normal people, or even many PHP programmers – unless you have more than a handful of directories to rummage through when __autoload()’ing PHP class files. I’ve sometimes found myself rummaging through 10-15, and this has a performance impact. Some random code which uses APC to cache a lookup … Continue reading »

Categories: development, performance, php | Tags: , , , , | 2 Comments

PHP Serialization & igbinary

Recently I’ve been trying to cache more and more stuff – mostly to speed things up. All was well, while I was storing relatively small numbers of data – because (as you’ll see below) my approach was a little flawed. Random background – I use Zend_Cache, in a sort of wrapped up local ‘Cache’ object, … Continue reading »

Categories: development, php | Tags: , , , | Leave a comment

Gregynog

Once a year, Aberystwyth’s Computer Science department take their second year students to Gregynog, for the purpose of preparing them for job interviews (mostly for the upcoming industrial year placements many students take between years 2 and 3). I’ve attended this for the last few years as an ‘Industrialist’ and help run mock interviews. Initially … Continue reading »

Categories: php | Tags: , , , | 4 Comments

Late to the performance party

Everyone else probably already knows this, but $project is/was doing two queries on the MySQL database every time the end user typed in something to search on to get the data between a set range (SELECT x,y….. LIMIT n, OFFSET m or whatever) and another to get the total count of records (SELECT count(field) ….). … Continue reading »

Categories: development, php | Tags: , , , | Leave a comment

Logging … and how not to do it.

Grumpy man, back from battling with some legacy code, has a rant. Continue reading »

Categories: development, php, python | Leave a comment

Adventures in Continuous Integration (PHP, Xinc, Phing etc)

I’ve had cron’ed unit tests running for ages which happily spam me when stuff breaks – and likewise adding e.g. phpdoc generation and so on into the mix wouldn’t be too hard. Anyway, for want of something better to do with my time I thought I’d look into CI in a bit more depth for … Continue reading »

Categories: development, php | 1 Comment

Google News Sitemap + WordPress

Annoyingly the current version of the google-news-sitemap plugin for WordPress (v1.4) doesn’t work with some silly XML namespace error reported by google. See http://wordpress.org/support/topic/364929 and effectively the ‘patch’ on the Google Support forum thing which works fine (there are two bits of the plugin which need updating – whcih correlate to the two parts mentioned … Continue reading »

Categories: php | Tags: , , , | Leave a comment

Silly SoapClient

Sam made some changes to a SOAP service one customer has – and suddenly our automated tests kept failing. “WTF?” we thought. We persistently got the same error (e.g. Fatal error: SOAP-ERROR: Encoding: object hasn’t ‘SortResults’ property in ….) yet the generated WSDL file (when viewed through a web browser etc) no longer has SortResults in … Continue reading »

Categories: development, php | Tags: , , , | 2 Comments