Entity::search doesn't use type conversions

Bug #316730 reported by e.mortoray
2
Affects Status Importance Assigned to Milestone
Persephone
Fix Committed
Undecided
Unassigned

Bug Description

Using Entity search, and the query parameters, seems to assume the values are of the correct type. This leads to errors, and unexpected PHP errors.

For example passing an Integer value to a DateTime field (or Date I suppose) causes PHP to generate a 500 error without any error log entry or exception of any kind.

The TypeDescriptor should be used where possible to convert the types (or at least check them for correctness).

e.mortoray (e-mortoray)
Changed in persephone:
status: New → Confirmed
Revision history for this message
e.mortoray (e-mortoray) wrote :

quote/decode in MDB2 helper class, and other DB classes, also have a similar problem. They should check the type.

Revision history for this message
e.mortoray (e-mortoray) wrote :

Note this applies to setting the values int he query object itself, the assumption of correctness is done in the _dbs_dbsource_where function, which directly calls the conversion from Entity to DB.

That is, the values in the entity are correctly converted in where clauses.

However, we can't make the DBS_Query do type conversions since it doesn't know the entity which it is matching. Thus we have to do it in _where, which would also be the most universal.

But, then we just need to call "check" and not actually do the conversion (which is already done)

Revision history for this message
e.mortoray (e-mortoray) wrote :

Hmm, this also applies to find methods.

Revision history for this message
e.mortoray (e-mortoray) wrote :

Hmm, the "with" syntax should be doing the check for Find, but for some reason my simple testcase bypasses it.

e.mortoray (e-mortoray)
Changed in persephone:
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.