Remove unecessary call to msInitExpression().
Fixed cut and paste error in queryByAttribute method.
Apply changes to queryObj, etc... to PHP/MapScript.