Zend Framework

ZF using intval() when db datatype is int?

Details

  • Type: Bug Bug
  • Status: Resolved Resolved
  • Priority: N/A N/A
  • Resolution: Won't Fix
  • Affects Version/s: None
  • Fix Version/s: 1.9.3
  • Component/s: Zend_Db_Table
  • Labels:
    None

Description

If the data type of my primary key is an integer, the find() method returns all records where the primary key equals the intval of my parameter. For example, when using find('3abc') while my primary key is an integer, find() returns all records where primary_key = '3'. However, I think it should return false or throw an exception as ZF already knows which datatype is used for my primary key, and my input simply isn't correct if I enter anything else than an integer.

Activity

Hide
wanlei added a comment -

It is your responsibility to do this job...

Show
wanlei added a comment - It is your responsibility to do this job...
Hide
Dimitri van Hees added a comment -

I think it's my responsibility to decide whether '3abc' should be converted to '3' instead. If I want to find a record by it's primary key, I suggest the record with the given find() value is being returned.

find('3abc') returning the record with primary key '3' doesn't make any sense to me. I'm sure this isn't the right place to discuss this, so if anyone can tell me where, I am glad to continue this discussion on the right place

Show
Dimitri van Hees added a comment - I think it's my responsibility to decide whether '3abc' should be converted to '3' instead. If I want to find a record by it's primary key, I suggest the record with the given find() value is being returned. find('3abc') returning the record with primary key '3' doesn't make any sense to me. I'm sure this isn't the right place to discuss this, so if anyone can tell me where, I am glad to continue this discussion on the right place
Hide
Wil Sinclair added a comment -

Have you tried discussing this on fw-general? I'm assigning this to Ralph so at least he can jump in on the discussion.

Show
Wil Sinclair added a comment - Have you tried discussing this on fw-general? I'm assigning this to Ralph so at least he can jump in on the discussion.
Hide
Ralph Schindler added a comment -

Im pretty sure this is related to these:

ZF-220, ZF-300, ZF-583, ZF-1457, (maybe ZF-3191), ZF-3221

Show
Ralph Schindler added a comment - Im pretty sure this is related to these: ZF-220, ZF-300, ZF-583, ZF-1457, (maybe ZF-3191), ZF-3221
Hide
Ralph Schindler added a comment -

Described is misuse of find() method. You should know the datatype of the primary key when using find() and as such, should at least do some validation prior to calling find()

Show
Ralph Schindler added a comment - Described is misuse of find() method. You should know the datatype of the primary key when using find() and as such, should at least do some validation prior to calling find()

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: