I encountered the following problem:
I have a simple order form for wine bottles and I calculate the amount to be paid in a JS-script:
http://www.weinbauverein-muttenz.ch/weinbezug/bestellung.html
On my life site everything works perfect. On a XAMPP localhost (running in windows XP) I get the following error:
« MODx Parse Error »
MODx encountered the following error while attempting to parse the requested resource:
« PHP Parse Error »
PHP error debug
Error: number_format() expects parameter 1 to be double, string given
Error type/ Nr.: Warning - 2
File: C:\xampplite\htdocs\WBV_Test\assets\snippets\eform\eform.inc.php
Line: 302
Line 302 source: $value = number_format($value);
Parser timing
MySQL: 0.0029 s (6 Requests)
PHP: 0.0361 s
Total: 0.0390 s
Digging somewhat deeper into this, a noticed that
a) The live site is running php 5.2, whereas the localsite is on 5.3
b) The form on the local site is also running perfect, if I fill in all empty fields in "Anzahl Flaschen" with a zero. These fields are defined in the form chunk as
<td><input name="M2" size="5" type="text" eform="Anzahl Flaschen:integer:0" onBlur="berechnen()"></td>
c) The form on the local site also works, when I comment line number 302 in assets\snippets\eform\eform.inc.php.
To me it looks as if number_format($value) has a different behaviour in php 5.2 and 5.3: In 5.2 it handles empty values by inserting a zero (which is what I get in the report) whereas in 5.3 it generates an error.
Is this a known issue? Or do I misunderstand something?
Is there a way to implement a workaraound in the eform.inc.php code?
I’m well prepared to submit the code, if anybody is interested.
Kind regards
rscha