Active
Project:
Location
Version:
7.x-3.x-dev
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
1 Dec 2012 at 06:21 UTC
Updated:
1 Dec 2012 at 06:21 UTC
In a situation when location saving attempt is performed on behalf of uid=0 (anonymous user), location_save_instance() deletes contents of location_instance table (since the module can't discern between anonymous user and node type, both are identified with the same 0 value (module architecture flaw?).
Something like this should be inserted to prevent table destruction:
if(
!isset($criteria['nid'])
&& !isset($criteria['genid'])
&& !isset($criteria['lid']) &&
isset($criteria['uid'])
&& $criteria['uid'] == 0
) {
watchdog(
'location',
'location_save_locations: trap #1: attempt to setup location for anonymous user: @locations, @criteria',
array(
'@locations' => print_r($locations, TRUE),
'@criteria' => print_r($criteria, TRUE)
),
WATCHDOG_EMERGENCY);
trigger_error(
t(
'location_save_locations: trap #1: attempt to setup location for anonymous user: @locations, @criteria',
array(
'@locations' => print_r($locations, TRUE),
'@criteria' => print_r($criteria, TRUE)
)
)
);
return;
}
Review required.