Something About Findbyattributes

I have a table named user like below:

id || email


1  ||


2  ||


When I search:

$userId = 2;

User::model()->findByAttributes(array('email' => $userId))->email;

result of the search is:

"Because MySQL decides to convert the email to an integer. The rules are to convert leading characters to a number, until the characters are not valid numbers."

I think the SQL code generating by findByAttributes should change from

SELECT * FROM user WHERE email = 1


SELECT * FROM user WHERE email = '1'

this is a problem of php where (1 == ‘1’) evaluates to true.