php, log errors and warnings, declare static functions static / remove new object by reference

php, log errors and warnings, declare static functions static / remove new object by reference