#3533 (ok 4.0) JSON unescaped for allegedly numeric columns

fixed
1
2013-06-11
2012-03-18
Anonymous
No

if there is a varchar-column with the value 04 the json export will not be escaped.

Example :

--
-- Table structure for table `test`
--

CREATE TABLE IF NOT EXISTS `test` (
`testcolumn` varchar(255) NOT NULL
);

--
-- Dumping data for table `test`
--

INSERT INTO `test` (`testcolumn`) VALUES
('test'),
('04'),
('4');

the

var_dump(is_numeric("04")); => true
var_dump(is_numeric("4")); => true
var_dump(is_numeric(4)); => true

Discussion

  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-03-18

    an example database

     
    Attachments
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-03-18

    json export

     
    Attachments
  • Comment has been marked as spam. 
    Undo

    You can see all pending comments posted by this user  here

    Anonymous - 2012-03-18

    sry, for messing this one up.

    in /libraries/export/json.php

    the line 165: "} elseif (is_numeric($record[$i]))"
    will catch also strings like "04" as numeric.

    So either cast to an real integer if you want to loose the " or check the type of the column first

     
  • Ann + J.M.

    Ann + J.M. - 2012-04-08

    Moving to bugs.

     
  • Ann + J.M.

    Ann + J.M. - 2012-04-08
    • labels: 559488 --> Data Export
     
  • Ann + J.M.

    Ann + J.M. - 2012-04-08
    • assigned_to: nobody --> mynetx
     
  • Ann + J.M.

    Ann + J.M. - 2012-04-08

    This bug was fixed in repository and will be part of a future release; thanks for reporting.

     
  • Ann + J.M.

    Ann + J.M. - 2012-04-08
    • priority: 5 --> 1
    • summary: unescaped values --> (ok 4.0) JSON unescaped for allegedly numeric columns
    • status: open --> open-fixed
     
  • Marc Delisle

    Marc Delisle - 2013-05-03
    • Status: open-fixed --> closed-fixed
     
  • Michal Čihař

    Michal Čihař - 2013-06-11
    • Status: closed-fixed --> fixed
     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks