PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_Javascript » Bug #7877

Javascript Arrays generated with bad syntax

Details

Submitted2006-06-12 18:24 UTC
Fromno at no dot com
StatusNo Feedback
PackageHTML_Javascript
PHP Version5.1.2
OSGentoo Linux
Roadmaps(Not assigned)

Comments

[2006-06-12 18:24 UTC] no at no dot com

Description:
------------
I have an array that's being converted from PHP, which has fields which may contain null values. When it's converted to Javascript by Flexy, I get the following output from Flexy:

.. array gen code above ..

tmp5["Id"] = "5"
tmp5["Caption"] =
tmp5["Description"] =
tmp5["Position"] = "4"

.. array gen code below ..

This causes the caption and description to take on the value of position.

Expected result:
----------------
.. array gen code above ..

tmp5["Id"] = "5";
tmp5["Caption"] = "";
tmp5["Description"] = "";
tmp5["Position"] = "4";

.. array gen code below ..

[2006-06-12 19:06 UTC] yeppy at nope dot nowhere dot net

Are you saying that you were hoping for intelligent parsing of null values? Ludicrous, my friend. Surely no better default behaviour can be envisioned than automatic suckage in of the next quoted value. This, of course, being the most reasonable potential default handling of such scenarios. Really, you might as easily convince me that all integer values should not be automatically multiplied by a random number, as sway me to this ridiculous argument in favour of sensible null value handling.

Tidings of excellence,

Yeppy Faiggueson
King of Spain in Exile