uc_order_delete

Project:Ubercart Contributions
Component:Code
Category:
Priority:normal
Assigned:Unassigned
Status:active
Description
Project: 
Ubercart

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...

Version: 
beta7
Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
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?

chadcrew's picture
Offline
Bug FinderGetting busy with the Ubercode.
Joined: 12/28/2007
Juice: 195
Re: Re: uc_order_delete
Assigned to:Ryan» chadcrew

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.

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Re: Re: uc_order_delete
Assigned to:chadcrew» Lyle

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.

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: Re: Re: Re: uc_order_delete
Assigned to:Lyle» Ryan

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.

chadcrew's picture
Offline
Bug FinderGetting busy with the Ubercode.
Joined: 12/28/2007
Juice: 195
Sounds good. Thanks for the
Assigned to:Ryan» chadcrew

Sounds good.

Thanks for the background Lyle - that makes sense too.