uc_order_delete

Project: 
Ubercart
Category: 
bug report
Priority: 
normal
Status: 
fixed

uc_order_delete calls this function:

$func('delete', $order, $null, NULL);

...but $null is undefined. Doesn't seem to do any harm, but sends us through the error reporting system each loop through...

Re: uc_order_delete

Not sure what error reporting system you're talking about... it's undefined intentionally. I guess it would be the same as:

<?php
  $null
= NULL;
 
$func('delete', $order, $null, NULL);
?>

It's just that hook_order() receives the second argument by reference, so we have to pass in the NULL value as a variable. PHP should initialize it as a NULL value.

Can you explain the error reporting you're using?

Re: Re: uc_order_delete

I'm just stepping through this in my debugger and every time $func('delete', $order, $null, NULL); is called, drupal's function error_handler($errno, $message, $filename, $line) in common.inc is called with $message = 'Undefined variable: null'

I don't think this is a big deal, I just noticed this when I was debugging that issue about the line items not getting deleted from the database. Going through the error_handler function on each loop makes stepping through the code a bit harder and wastes a few cycles, but other than that I don't see any harm. Defining $null = NULL should fix it though.

Re: Re: Re: uc_order_delete

Surely that's just an E_NOTICE, which Drupal 5 has plenty of in its code. In your PHP settings you should be able to specify E_ALL & ~E_NOTICE error reporting. I'm using E_ALL & ~E_NOTICE & ~E_STRICT on my test site, so you may want to try that one too.

Re: Re: Re: Re: uc_order_delete

I was just gonna leave this since it's really not critical, but I found precedent in user.module for explicitly defining $null. I've updated the core modules to do this, so it should disappear after the next release.

Sounds good. Thanks for the

Sounds good.

Thanks for the background Lyle - that makes sense too.