Ticket #865 (closed defect: fixed)

Opened 10 months ago

Last modified 10 months ago

JavaScriptHelper::toJsObject Bug

Reported by: what4893 Owned by: somebody
Priority: minor Milestone:
Component: Javascript Version: 2.1.0 Stable
Keywords: JavaScriptHelper Cc:

Description

There is a bad assumption on line 110 of the JavaScriptHelper? class. When converting a PHP array beginning with a zero (i.e. array(0,3,5)) this function uses if($strList) in which case 0 will evaluate to false generating the incorrect comma sequence and lumping the first two elements together as 03. A simple fix would be to use strlen() around $strList or some other check.

Attachments

Fix_for_JavaScriptHelper_Class.patch Download (0.7 KB) - added by vaibhav 10 months ago.
Fix for JavaScriptHelper? class by using strlen function

Change History

Changed 10 months ago by vaibhav

Thanks for point the problem out. I think that using strlen is the 'only' way to fix this without changing other things :) Please apply the patch and test if it works fine and let us know if it is okay. We shall then commit it.

Changed 10 months ago by vaibhav

Fix for JavaScriptHelper? class by using strlen function

Changed 10 months ago by what4893

Patch worked perfect for me. Thanks!

Changed 10 months ago by vaibhav

Thanks a lot for the feedback. I would be committing it soon then.

Changed 10 months ago by vaibhav

  • status changed from new to closed
  • resolution set to fixed

(In [1497]) Fixes #865

Note: See TracTickets for help on using tickets.