[PHPEngine] bug fixes and tests;