When opening ecommerce in phpeclipse, there are several warnings and one error (see other issue). Warnings are mostly uninitialsied variables:

  • e.g. a $counter that isn't defined
  • there is a foreach ( as $nid => $item) that later in the code calls a function with an undefined $key (ec_checkout.module line 194)

and many, many more.

HnLn

Comments

gordon’s picture

Status: Active » Postponed (maintainer needs more info)

Thanks for the information, but I use and IDE, so unless I see if in the logs or I see errors being displayed in the testing they will not be fixed.

If you can please either provide a patch or more specifics on where the patches are.

I do try to find all the bugs and have all errors displayed, but also a lot of IDE's are over picky sometimes and display errors that are not there.

Thanks for the information.
Gordon.

hnln’s picture

Hey,

tnx for the reply and my apologies for maybe being a bit crude.

Below a list of the yellow explanation marks I get when opening ecommerce 6.x-4.dev (05/12). Note most of these might not have any effects and I'm just providing them FYI (as normally I don't get these when opening drupal modules). As this is not a real case, this can be closed.

No effect (I think)

  • ec_address.module line 129 (inside ec_address_autocomplete): een undefined $counter variable (guess it won't break anything as php probably defaults it to 0)
  • ec_address.views.inc line 145 (at the end of ec_address_views_handlers): an undefined variable (won't break anything as the return statement is already done, but should be removed)

Might have undesired effects:

  • ec_buynow.module line 105 (inside ec_buynow_checkout_init): $txn->items[$nid] = $node;, $nid isn't defined inside the function and isn't defined as a function parameter
  • ec_cart.module
    • line 94 (ec_cart_theme): 'arguments' => array('item_count' => NULL, $text => NULL), I guess $text should be 'text' and otherwise it's not defined
    • line 340 (ec_cart_checkout_init): in the loop a validate function is called, with $item_data as arg, it's not defined, might be $item->data ?
    • line 383 (ec_cart_view_form): ec_cart_view_cart_to_move($form, $node); $node is not defined
    • line 589 and 593 (ec_cart_ajax_load): $item_count en $block aren't defined (maybe $block should be declared first as StdObj, but guess it won't have an effect)
  • ec_checkout.module line 197 inside ec_checkout_product_form_validate there is a loop that calls ec_checkout_validate_item with $key as one of the arguments, is not defined and guess it should be $nid as defined in the loop
  • ec_paypal.module
    • line 402 inside ec_paypal_express_receipt_payment_form: this array('%erid' => $ids['erid'] is a function argument but $ids is not defined
    • line 678 inside ec_paypal_ipn: use of undefined $ids
    • line 704 inside ec_paypal_return: $the use of $return in the parsestr function, nothing wrong here I guess (maybe defined it first as array ...
    • line 750 inside ec_paypal_get_status: ec_paypal_wd($response, ... $response is undefined, not sure if it has implications
    • line 769 inside ec_paypal_update_response: parse_str($response['custom'], $ids); $ids is undefined
    • line 750 inside ec_paypal_update_response: parse_str($response['custom'], $ids); $ids is undefined
    • line 869 inside ec_paypal_api_comms: parse_str(str_replace("\n", '', $ret->data), $response); $response is undefined, not sure if it has implications
hnln’s picture

Two more :-)

ec_store.module

  • line 210 inside ec_store.module ( 'access arguments' => $view_transaction,)
  • line 412 inside ec_store_transaction_save (ec_store_invoke_ec_transactionapi($txn, 'update', $paid);), $paid is undefined
recidive’s picture

Title: please open your code in phpeclipse or another ide » Code cleanup
Category: bug » task
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new3.9 KB

Attached patch fixes issues above, but ec_paypal.module ones, and the ones listed bellow:

line 589 and 593 (ec_cart_ajax_load): $item_count en $block aren't defined (maybe $block should be declared first as StdObj, but guess it won't have an effect)

theme_ec_cart_display_block_title() doesn't use $item_count at all, this should be removed.

ec_checkout.module line 197 inside ec_checkout_product_form_validate there is a loop that calls ec_checkout_validate_item with $key as one of the arguments, is not defined and guess it should be $nid as defined in the loop

Yes, this is wrong, $key is not defined, but this argument in ec_checkout_validate_item() is $type (Purchase type). Don't know where to get this argument from yet.

line 210 inside ec_store.module ( 'access arguments' => $view_transaction,)

$view_transaction is not defined, not sure what this should be.

gordon’s picture

Status: Needs review » Needs work

Hi,

This patch no longer applies.

Gordon.

recidive’s picture

Status: Needs work » Needs review
StatusFileSize
new2.52 KB

Sorry, I have checked out HEAD instead of 6.4 branch.

This one should apply now.

gordon’s picture

Status: Needs review » Fixed

Thanks, this has now been committed

darren oh’s picture

Status: Fixed » Needs review
StatusFileSize
new18.2 KB

A lot got missed. Marked issue 375755 as duplicate.

gordon’s picture

Status: Needs review » Fixed

Thanks I have now committed this.

Phillip Mc’s picture

Status: Fixed » Active

just wondering if this patch has anything to do with all the error messages from today's dev version? I'm unable to install it. Lots of constant errors. Like this:

notice: Constant SAVED_NEW already defined in ec_common.module on line 14.
notice: Constant SAVED_UPDATED already defined in ec_common.module on line 15.
notice: Constant SAVED_NEW already defined in ec_common.module on line 14.
notice: Constant SAVED_UPDATED already defined in ec_common.module on line 15.

I'm using drupal 6.10 and the 6.x-4.x-dev

Philk.

darren oh’s picture

Status: Active » Fixed

No need to change the status just to ask a question. The problem you mention was reported in issue 375744.

dublin drupaller’s picture

I'm getting the same error messages Philk. I think it's related to this http://drupal.org/node/375744

darren oh’s picture

Status: Fixed » Active
StatusFileSize
new2.95 KB

I found more. It appears that constants defined in the module file aren't available while it is being installed, and theme_textfield() require #autocomplete_path to be defined.

gordon’s picture

Status: Active » Needs work

I don't like the fact that the constants are being removed in the .install file.

darren oh’s picture

Defining the constants in the install file causes duplicate constant definition errors on the module administration page.

gordon’s picture

But shouldn't the .module file be loaded at the time of installation anyway, so shouldn't the system know about these contants?

darren oh’s picture

Maybe it should be loaded, but it isn't. I haven't had time to investigate.

darren oh’s picture

Status: Needs work » Reviewed & tested by the community
StatusFileSize
new3.38 KB

OK: the module is not loaded during hook_install(), but it is loaded during hook_enable().

gordon’s picture

Status: Reviewed & tested by the community » Fixed

I have now committed. I did replace one more with the constant that was missed.

darren oh’s picture

Status: Fixed » Reviewed & tested by the community
StatusFileSize
new4.41 KB

Found more bad variables.

gordon’s picture

Status: Reviewed & tested by the community » Needs work

I just committed some more stuff so it doesn't apply anymore.

darren oh’s picture

Status: Needs work » Reviewed & tested by the community

Re-rolled patch. I've found more in the checkout process, but I'm making sure I understand the code before I make a patch.

darren oh’s picture

StatusFileSize
new1.66 KB

Forgot to attach file.

gordon’s picture

Status: Reviewed & tested by the community » Fixed

Thanks. I have committed this, Please open a new issue if you find any more.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.