{"action":"created","issue":{"url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/75","labels_url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/75/labels{/name}","comments_url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/75/comments","events_url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/75/events","html_url":"https://github.com/greenlion/PHP-SQL-Parser/issues/75","id":88966556,"number":75,"title":"Patch for /trunk/php-sql-parser.php","user":{"login":"witchi","id":5766508,"avatar_url":"https://avatars.githubusercontent.com/u/5766508?v=3","gravatar_id":"","url":"https://api.github.com/users/witchi","html_url":"https://github.com/witchi","followers_url":"https://api.github.com/users/witchi/followers","following_url":"https://api.github.com/users/witchi/following{/other_user}","gists_url":"https://api.github.com/users/witchi/gists{/gist_id}","starred_url":"https://api.github.com/users/witchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/witchi/subscriptions","organizations_url":"https://api.github.com/users/witchi/orgs","repos_url":"https://api.github.com/users/witchi/repos","events_url":"https://api.github.com/users/witchi/events{/privacy}","received_events_url":"https://api.github.com/users/witchi/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/labels/imported","name":"imported","color":"FFFFFF"},{"url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/labels/Type-Patch","name":"Type-Patch","color":"FFFFFF"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-17T09:27:31Z","updated_at":"2015-06-17T09:27:38Z","closed_at":null,"body":"_From [nderm...@adequasys.com](https://code.google.com/u/106332238576395959219/) on April 23, 2012 08:52:59_\n\nfixes issue #45 .\r\n\r\nHere is a test :\r\n\r\ntestsuite/tests/parser/ issue45 .php :\r\n\r\n//////////////////////////////////////\r\n\\<?php\r\nrequire_once(dirname(__FILE__) . '/../../../php-sql-parser.php');\r\nrequire_once(dirname(__FILE__) . '/../../test-more.php');\r\n\r\n$parser = new PHPSQLParser();\r\n\r\n$sql = \"SELECT a from b left join c on c.a = b.a and (c.b. = b.b) where b.a > 1\";\r\n$parser->parse($sql, true);\r\n$p = $parser->parsed;\r\n$expected = getExpectedValue(dirname(__FILE__), ' issue45 .serialized');\r\neq_array($p, $expected, 'does not die if subtree in join condition');\r\n\r\n//////////////////////////////////////\r\n\r\nand file with the serialized array :\r\n\r\ntestsuite/expected/parser/ issue45 .serialized :\r\n\r\na:3:{s:6:\"SELECT\";a:1:{i:0;a:5:{s:9:\"expr_type\";s:6:\"colref\";s:5:\"alias\";b:0;s:9:\"base_expr\";s:1:\"a\";s:8:\"sub_tree\";b:0;s:8:\"position\";i:7;}}s:4:\"FROM\";a:2:{i:0;a:9:{s:9:\"expr_type\";s:5:\"table\";s:5:\"table\";s:1:\"b\";s:5:\"alias\";b:0;s:9:\"join_type\";s:4:\"JOIN\";s:8:\"ref_type\";b:0;s:10:\"ref_clause\";b:0;s:9:\"base_expr\";s:1:\"b\";s:8:\"sub_tree\";b:0;s:8:\"position\";i:14;}i:1;a:9:{s:9:\"expr_type\";s:5:\"table\";s:5:\"table\";s:1:\"c\";s:5:\"alias\";b:0;s:9:\"join_type\";s:4:\"LEFT\";s:8:\"ref_type\";s:2:\"ON\";s:10:\"ref_clause\";a:5:{i:0;a:4:{s:9:\"expr_type\";s:6:\"colref\";s:9:\"base_expr\";s:3:\"c.a\";s:8:\"sub_tree\";b:0;s:8:\"position\";i:31;}i:1;a:4:{s:9:\"expr_type\";s:8:\"operator\";s:9:\"base_expr\";s:1:\"=\";s:8:\"sub_tree\";b:0;s:8:\"position\";i:35;}i:2;a:4:{s:9:\"expr_type\";s:6:\"colref\";s:9:\"base_expr\";s:3:\"b.a\";s:8:\"sub_tree\";b:0;s:8:\"position\";i:37;}i:3;a:4:{s:9:\"expr_type\";s:8:\"operator\";s:9:\"base_expr\";s:3:\"and\";s:8:\"sub_tree\";b:0;s:8:\"position\";i:41;}i:4;a:4:{s:9:\"expr_type\";s:10:\"expression\";s:9:\"base_expr\";s:12:\"(c.b. = b.b)\";s:8:\"sub_tree\";a:3:{i:0;a:4:{s:9:\"expr_type\";s:6:\"colref\";s:9:\"base_expr\";s:4:\"c.b.\";s:8:\"sub_tree\";b:0;s:8:\"position\";i:46;}i:1;a:4:{s:9:\"expr_type\";s:8:\"operator\";s:9:\"base_expr\";s:1:\"=\";s:8:\"sub_tree\";b:0;s:8:\"position\";i:51;}i:2;a:4:{s:9:\"expr_type\";s:6:\"colref\";s:9:\"base_expr\";s:3:\"b.b\";s:8:\"sub_tree\";b:0;s:8:\"position\";i:53;}}s:8:\"position\";i:45;}}s:9:\"base_expr\";s:31:\"c on c.a = b.a and (c.b. = b.b)\";s:8:\"sub_tree\";b:0;s:8:\"position\";i:26;}}s:5:\"WHERE\";a:3:{i:0;a:4:{s:9:\"expr_type\";s:6:\"colref\";s:9:\"base_expr\";s:3:\"b.a\";s:8:\"sub_tree\";b:0;s:8:\"position\";i:64;}i:1;a:4:{s:9:\"expr_type\";s:8:\"operator\";s:9:\"base_expr\";s:1:\">\";s:8:\"sub_tree\";b:0;s:8:\"position\";i:68;}i:2;a:4:{s:9:\"expr_type\";s:5:\"const\";s:9:\"base_expr\";s:1:\"1\";s:8:\"sub_tree\";b:0;s:8:\"position\";i:70;}}}\n\n**Attachment:** [php-sql-parser.php.patch](http://code.google.com/p/php-sql-parser/issues/detail?id=49)\n\n_Original issue: http://code.google.com/p/php-sql-parser/issues/detail?id=49_"},"comment":{"url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/comments/112733753","html_url":"https://github.com/greenlion/PHP-SQL-Parser/issues/75#issuecomment-112733753","issue_url":"https://api.github.com/repos/greenlion/PHP-SQL-Parser/issues/75","id":112733753,"user":{"login":"witchi","id":5766508,"avatar_url":"https://avatars.githubusercontent.com/u/5766508?v=3","gravatar_id":"","url":"https://api.github.com/users/witchi","html_url":"https://github.com/witchi","followers_url":"https://api.github.com/users/witchi/followers","following_url":"https://api.github.com/users/witchi/following{/other_user}","gists_url":"https://api.github.com/users/witchi/gists{/gist_id}","starred_url":"https://api.github.com/users/witchi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/witchi/subscriptions","organizations_url":"https://api.github.com/users/witchi/orgs","repos_url":"https://api.github.com/users/witchi/repos","events_url":"https://api.github.com/users/witchi/events{/privacy}","received_events_url":"https://api.github.com/users/witchi/received_events","type":"User","site_admin":false},"created_at":"2015-06-17T09:27:38Z","updated_at":"2015-06-17T09:27:38Z","body":"_From [pho...@gmx.de](https://code.google.com/u/109317404671582518013/) on May 02, 2012 05:35:13_\n\nI have checked the patch again and I couldn't create a wrong test. So it is now integrated into the codebase, thank you.\n\n**Status:** Fixed  \n"}}