gburton / CE-Phoenix

WE KEPT OSCOMMERCE ALIVE, but now this Repo is defunct, please see the new Repo URL listed below.
https://github.com/CE-PhoenixCart/PhoenixCart
131 stars 202 forks source link

insertOrder hook requires a change to hooks class #1033

Closed BrockleyJohn closed 3 years ago

BrockleyJohn commented 3 years ago

The insert order hook lets you manipulate the sql_data before an order is inserted.

In order to do this I receive the parameter into my hook method by reference. function listen_insertOrder(&$params) {

This works but generates a warning

Warning: Parameter 1 to long_class_name::listen_insertOrder() expected to be a reference, value given in …

Suggested fix is a change in the call method of the hooks class, from $result .= call_user_func($callback, $parameters); to $result .= call_user_func_array($callback, [&$parameters]);

This disappears the problem and doesn't obviously break anything - I assume screwing up this method should be in-your-face!

ecartz commented 3 years ago
function listen_insertOrder(&$params) {

This is incorrect and unnecessary. Just remove the & and it should work with no other changes. If not, please post the actual code. Because you should not need $parameters to be a reference there, just sql_data.

BrockleyJohn commented 3 years ago

Ok - as you were - it works fine on a clean install; there must be something squiffy in that dev store. Back to the code I had 5 hours ago!