While using wrong value for existing table field in criteria parameter for
getObject(), my local Apache server crashes, instead of retrieving null.
For example:
I need to get `id` of modx table `users` where `username`=`smi_23`
$obj = $modx->getObject('modUser',array('username'=>'smi_23'));
$res = $obj->get('id');
That works fine, but if `username` equals to not existing value `smi` - the crush comes:
$obj = $modx->getObject('modUser',array('username'=>'smi'));
$res = $obj->get('id');
The same problem appears when I using xPDOQuery:
$q = $modx->newQuery('modUser');
$q->where(array(
'username'=>'smi'
));
$obj = $modx->getObject('modUser',$q);
$res = $obj->get('id');
Function
getCollection() retrieves correct empty array.
If anyone have the solution or knows the reason of crash, please answer.
Local server: Denwer 3:
Apache 2 + SSL, PHP 5.3.1, MySQL 5.1
[ed. note: smi_23 last edited this post 15 years, 1 month ago.]