FIx php error in some cases. closes #2614