Added Spl classes to systemlib and fixed errors

Added classes to systemlib.php and fixed various errors revealed
by zend tests.