PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Authentication » LiveUser_Admin » Bug #4638

createWhere dont work correctly with null value

Details

Submitted2005-06-20 13:18 UTC
Fromfabio at bs2 dot com dot br
Assignedlsmith
StatusClosed
PackageLiveUser_Admin
PHP VersionIrrelevant
Roadmaps(Not assigned)

Comments

[2005-06-20 13:18 UTC] fabio at bs2 dot com dot br

Description:
------------
I'm trying to get all users that not have group. The SQL that I need is some like these:

SELECT LU_perm_users.auth_user_id AS auth_user_id
FROM LU_perm_users
LEFT JOIN LU_groupusers ON LU_perm_users.perm_user_id = LU_groupusers.perm_user_id
WHERE LU_groupusers.group_id IS null

And in function createWhere in LiveUser_Admin_Storage_SQL class on line 457-458 have this code:

if (is_array($value)) {
if (isset($value['value'])) {

I suggest change the isset($value['value']) to array_key_exists('value',$value) because if I have null in the $value['value'], code will do the expected.

this change will not do the query that I have to do but is an begin.

Reproduce code:
---------------
$luAdmin =& LiveUser_Admin::singleton($LuConf);
$luAdmin->setAdminContainers();

$luAdmin->getUsers('perm', array('group_id' => array('op' => 'IS', 'value' => 'null', 'cond' => ''))
);

[2005-06-20 14:02 UTC] smith at backendmedia dot com

This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pear.php.net.

In case this was a pear.php.net website problem, the change will show
up on the website in short time.

Thank you for the report, and for helping us make PEAR better.

I have tweaked the NULL handling so that you wouldnt even have to specify the 'op' anymore. However it will also work if you specify the 'op'. However note that in your example you need to remove the quotes from 'null' for any of this to work.