Edit report at https://bugs.php.net/bug.php?id=65955&edit=1
ID: 65955 Updated by: yohg...@php.net Reported by: aaatoja at o2 dot pl Summary: Invalid Json response Status: Closed Type: Bug Package: PDO related Operating System: Linux Ubuntu PHP Version: 5.4.21 -Assigned To: +Assigned To: yohgaki Block user comment: N Private report: N New Comment: Do you mean fixed in 5.5, but not 5.4? Then this should be re-opened. Previous Comments: ------------------------------------------------------------------------ [2013-10-24 10:26:29] aaatoja at o2 dot pl I see bug is fixed in v5.5. ------------------------------------------------------------------------ [2013-10-24 07:31:37] aaatoja at o2 dot pl Description: ------------ I have a Postgresql (v9.3) view which contains column made from json_agg() function (array_agg works fine). My response looks like: array(5) { [0] => array(2) { ["aggcolumn"] => NULL [0] => NULL } [1] => array(2) { ["aggcolumn"] => string(14) "["test"]]" [0] => string(14) "["test"]]" } [2] => array(2) { ["aggcolumn"] => string(34) "["test", "test2"]]]" [0] => string(34) "["test", "test2"]]]" } [3] => array(2) { ["aggcolumn"] => string(26) "["test3"]]]]" [0] => string(26) "["test3"]]]]" } [4] => array(2) { ["aggcolumn"] => string(46) "["test2", "test3"]]]]]" [0] => string(46) "["test2", "test3"]]]]]" } } Test script: --------------- try { $dbh = new PDO($dsn, $user, $password); $sth = $dbh->prepare('SELECT aggcolumn FROM view_test WHERE company_id = ? AND active_flag IS TRUE'); $sth->execute(array(10)); $res = $sth->fetchAll(); var_dump($res); } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); } Expected result: ---------------- Response should be valid JSON string. Actual result: -------------- As You may notice every row has a value with an extra ']' at the end, based on current iteration count. That makes string invalid JSON response ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65955&edit=1