Prevent double resource free
Prevent crash in case of SQL error
Merge branch 'phpng' of git.php.net:php-src into phpng

* 'phpng' of git.php.net:php-src:
  Fixed memleak (3 tests fails now)
  Fixed resources apply_dtor
  It's a zend_array not Hashtable (fixed segfault)
  Fixed segfault
  Refactoring ext/pgsql (incompleted, only compilable)