- Posts: 8
- Thank you received: 0
$element is modified after onBeforeOrderDelete
13 years 10 months ago - 13 years 10 months ago #74839
by tommytom
$element is modified after onBeforeOrderDelete was created by tommytom
Hello,
I am using the latest Hikashop (2.0) and I just stumbled on a problem with the onBeforeOrderDelete and onAfterOrderDelete plugin callbacks.
The $element array containing the keys of the deleted order is modified by the helper class between the before and the after callback. This array is passed by reference in the subfunctions and is modified by it causing changes of content in the before and after callback. Check the following lines:
com_hikashop/classes/order.php (hikashopOrderClass->delete) line 682: $result=parent::delete($elements);
com_hikashop/helper/helper.php (hikashopClass->delete) line 1281: $elements[$key] = $this->database->Quote($val);
In this last line, the $element which is passed by reference is modified by the database->quote() function, which is adding single quotes around the order key in the array. So after returning from the helper->delete(function) the $element array is passed to the onAfterOrderDelete callback, but this time, the order keys have quotes around it.
-Tom.
I am using the latest Hikashop (2.0) and I just stumbled on a problem with the onBeforeOrderDelete and onAfterOrderDelete plugin callbacks.
The $element array containing the keys of the deleted order is modified by the helper class between the before and the after callback. This array is passed by reference in the subfunctions and is modified by it causing changes of content in the before and after callback. Check the following lines:
com_hikashop/classes/order.php (hikashopOrderClass->delete) line 682: $result=parent::delete($elements);
com_hikashop/helper/helper.php (hikashopClass->delete) line 1281: $elements[$key] = $this->database->Quote($val);
In this last line, the $element which is passed by reference is modified by the database->quote() function, which is adding single quotes around the order key in the array. So after returning from the helper->delete(function) the $element array is passed to the onAfterOrderDelete callback, but this time, the order keys have quotes around it.
-Tom.
Last edit: 13 years 10 months ago by tommytom.
Please Log in or Create an account to join the conversation.
13 years 10 months ago #74873
by nicolas
Replied by nicolas on topic Re: $element is modified after onBeforeOrderDelete
Hi,
Thank you for the report. We've changed that on our end so that the elements in the $elements passed to onAfterOrderDelete are not quoted.
Thank you for the report. We've changed that on our end so that the elements in the $elements passed to onAfterOrderDelete are not quoted.
Please Log in or Create an account to join the conversation.
13 years 10 months ago #74874
by tommytom
Replied by tommytom on topic Re: $element is modified after onBeforeOrderDelete
Great !
When will that be available ?
-T
When will that be available ?
-T
Please Log in or Create an account to join the conversation.
13 years 10 months ago #74875
by nicolas
Replied by nicolas on topic Re: $element is modified after onBeforeOrderDelete
It has already been fixed on our end.
Please redownload HikaShop on our website and update it on yours and it will work.
Please redownload HikaShop on our website and update it on yours and it will work.
Please Log in or Create an account to join the conversation.
Time to create page: 0.263 seconds