Page 1 of 1

2.0.1.1 non-numeric value Error

Posted: Tue May 21, 2019 4:26 am
by supak111
Hi could anyone tell me what this error could mean?

Code: Select all

PHP Warning:  A non-numeric value encountered in /vqmod/vqcache/vq2-system_library_currency.php on line 119
here is system_library_currency.php line 106-120, this: return $value * ($to / $from); being line 119 in question

Code: Select all

	public function convert($value, $from, $to) {
		if (isset($this->currencies[$from])) {
			$from = $this->currencies[$from]['value'];
		} else {
			$from = 1;
		}

		if (isset($this->currencies[$to])) {
			$to = $this->currencies[$to]['value'];
		} else {
			$to = 1;
		}

		return $value * ($to / $from);
	}

Re: 2.0.1.1 non-numeric value Error

Posted: Tue May 21, 2019 6:07 am
by IP_CAM
Fixed Stripe checkout non-numeric value error
Single (not range) Subtotal value returns non-numeric value error, when currency is converted.


It's most likely related to PHP v.7.x, and some Themes and Extensions
seemengly had a Problem with that. Search Google for:
"non-numeric value" Opencart
And you have shown the Code above from the
Vq/Oc-Modded Cache Version File, and that makes no
sense, because that Code might have been changed
by some Extension, unknown to others ... :'(

Ernie

Re: 2.0.1.1 non-numeric value Error

Posted: Tue May 21, 2019 7:37 am
by supak111
Ok so I disabled all VQmod extensions having anything to do with currency.php, and now I get:

Code: Select all

PHP Warning:  A non-numeric value encountered in /system/library/currency.php on line 114
here is the code from sys/lib/currncy.php lines 101-115 again: return $value * ($to / $from); being line 114 in question

Code: Select all

	public function convert($value, $from, $to) {
		if (isset($this->currencies[$from])) {
			$from = $this->currencies[$from]['value'];
		} else {
			$from = 1;
		}

		if (isset($this->currencies[$to])) {
			$to = $this->currencies[$to]['value'];
		} else {
			$to = 1;
		}

		return $value * ($to / $from);
	}

Re: 2.0.1.1 non-numeric value Error

Posted: Tue May 21, 2019 9:37 am
by IP_CAM
Well, that Code is still the same, up to OC-3, it must therefore
be something else, leading to that Error.
As a wild guess, did you already update your Code, to make
Currency Exchange Rate work ?
https://www.opencart.com/index.php?rout ... n_id=32694
Ernie

Re: 2.0.1.1 non-numeric value Error

Posted: Tue May 21, 2019 4:38 pm
by supak111
No I didn't add any extension to make the currency exchange work after yahoo stopped until just now. Perhaps it will stop happening now that I have an extension that makes it work again.

I can't even figure out when the error happens. If I go play around with the exchange on my front end I can't get the error to happen. Just happens at random times to random visitors, not sure which visitor nor why. Could it be browser dependent?

Re: 2.0.1.1 non-numeric value Error

Posted: Wed May 22, 2019 4:37 pm
by supak111
For anyone in the future: I wasn't able to fix the issue on 7.2 php but lowering the php version in your cPanel to 7.0 seems to resolve the error.

.

Re: 2.0.1.1 non-numeric value Error

Posted: Thu May 23, 2019 6:52 am
by IP_CAM
Well, that might work, but PHP v.7.0x is already planned to be removed from
Servers again, and your Problem needs to be solved sooner or later anyway.
You better install the Currency Mod, as mentioned abobe, to find out, if it
then works, since that was a problem solver in another Topic of this Place.
Good Luck!
Ernie