There are two calls to ereg_replace() which is deprecated from PHP5.3.

Comments

xurizaemon’s picture

Status: Active » Needs review
StatusFileSize
new1.38 KB
new1.23 KB

Tested against my 7.x-1.x sandbox of uc_pma.

adbs-ah’s picture

Hi, I'm new on the Drupal forum, so I don't know if this is the right place to leave this comment.

I'm getting a load of error messages saying
Warning: number_format() expects parameter 1 to be double, string given in _payment_method_adjustment() (line 271 of /home/adbs/public_html/sites/all/modules/uc_pma/uc_pma.module).

After inspecting the patches posted more than a year ago it seems to me that there is a mistake in it.
The patches show two similar peaces of code of which I will discuss only one.

-  $adjustment = @ereg_replace('[^-0-9'. variable_get('uc_currency_dec', '.') .'%]+', '', $adjustment);
+  $adjustment = preg_replace('/[^-0-9'. variable_get('uc_currency_dec', '.') .']+%/', '', $adjustment);

In my opinion the new statement should read:

+  $adjustment = preg_replace('/[^-0-9'. variable_get('uc_currency_dec', '.') .'%]+/', '', $adjustment);

in order to remove all characters except digits, minus, decimal-point and percent.

ñull’s picture

Issue summary: View changes
Status: Needs review » Fixed

Very confusing to include the fix for 7.x-1.x-dev here, were this patch got submitted already. Apparently that is not the case for 6.x-1.x-dev?

I took the liberty to at least hide the unnecessary patch for 7.x-1.x-dev although I cannot hide it in the comment.

ñull’s picture

Status: Fixed » Needs review

Sorry, should not have marked it fixed.

xurizaemon’s picture

ñull, if you can review / RTBC the 6.x patch I'll commit it.

I don't use this module, looks like I ended up as maintainer when I tried to get this committed a few years back, have just set "Seeking new maintainer" on the project.

ñull’s picture

I don't have time to set up an D6 UC for this. But soon I will migrate / upgrade a old D6 production site and as soon as it goes off line, I'll try your patch there.

xurizaemon’s picture

Cool. I'm not fussed, was just trying to help ... maybe i misunderstood your comment?

I probably filed this patch for 7.x, got commit rights, committed it, and left the 6.x patch for the next person. (& there it sat for 3 yrs ...) If you have no need for UC PMA, leave it for someone who actually does ... sounds like there's not a huge need for it anyway, esp since old PHP goes so well with old Drupal :)