[PHP-CVS] cvs: php-src /ext/pcntl pcntl.c /ext/pcntl/tests pcntl_signal.phpt

2009-03-27 Thread Matteo Beccati
mbeccatiSat Mar 28 01:31:32 2009 UTC

  Modified files:  
/php-src/ext/pcntl  pcntl.c 
/php-src/ext/pcntl/testspcntl_signal.phpt 
  Log:
  - Fixed pcntl_signal() returning NULL when passing wrong parameters
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.75r2=1.76diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.75 php-src/ext/pcntl/pcntl.c:1.76
--- php-src/ext/pcntl/pcntl.c:1.75  Wed Mar 25 23:33:35 2009
+++ php-src/ext/pcntl/pcntl.c   Sat Mar 28 01:31:31 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.75 2009/03/25 23:33:35 lbarnaud Exp $ */
+/* $Id: pcntl.c,v 1.76 2009/03/28 01:31:31 mbeccati Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -757,7 +757,7 @@
zend_bool restart_syscalls = 1;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, lz|b, signo, 
handle, restart_syscalls) == FAILURE) {
-   return;
+   RETURN_FALSE;
}
 
if (!PCNTL_G(spares)) {
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/pcntl_signal.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/pcntl/tests/pcntl_signal.phpt
diff -u php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1 
php-src/ext/pcntl/tests/pcntl_signal.phpt:1.2
--- php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1   Fri Sep 12 19:49:38 2008
+++ php-src/ext/pcntl/tests/pcntl_signal.phpt   Sat Mar 28 01:31:31 2009
@@ -25,7 +25,7 @@
 signal dispatched
 
 Warning: pcntl_signal() expects at least 2 parameters, 0 given in %s
-NULL
+bool(false)
 bool(true)
 
 Warning: pcntl_signal(): Invalid value for handle argument specified in %s



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c /ext/pcntl/tests pcntl_signal.phpt

2009-03-27 Thread Matteo Beccati
mbeccatiSat Mar 28 01:32:51 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pcntl  pcntl.c 
/php-src/ext/pcntl/testspcntl_signal.phpt 
  Log:
  MFH:
  - Fixed pcntl_signal() returning NULL when passing wrong parameters
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.4.2.17r2=1.48.2.2.2.4.2.18diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.17 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.18
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.17 Wed Mar 25 23:34:08 2009
+++ php-src/ext/pcntl/pcntl.c   Sat Mar 28 01:32:50 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.17 2009/03/25 23:34:08 lbarnaud Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.4.2.18 2009/03/28 01:32:50 mbeccati Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -757,7 +757,7 @@
zend_bool restart_syscalls = 1;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, lz|b, signo, 
handle, restart_syscalls) == FAILURE) {
-   return;
+   RETURN_FALSE;
}
 
if (!PCNTL_G(spares)) {
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/pcntl_signal.phpt?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/pcntl/tests/pcntl_signal.phpt
diff -u php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1.2.2 
php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1.2.3
--- php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1.2.2   Fri Sep 12 19:49:46 2008
+++ php-src/ext/pcntl/tests/pcntl_signal.phpt   Sat Mar 28 01:32:51 2009
@@ -25,7 +25,7 @@
 signal dispatched
 
 Warning: pcntl_signal() expects at least 2 parameters, 0 given in %s
-NULL
+bool(false)
 bool(true)
 
 Warning: pcntl_signal(): Invalid value for handle argument specified in %s



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_pgsql pdo_pgsql.c

2009-03-27 Thread Matteo Beccati
mbeccatiSat Mar 28 01:58:49 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pdo_pgsql  pdo_pgsql.c 
  Log:
  MFH:
  - Added missing #undefs, fixing compile warnings
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pdo_pgsql.c?r1=1.7.2.11.2.1.2.3r2=1.7.2.11.2.1.2.4diff_format=u
Index: php-src/ext/pdo_pgsql/pdo_pgsql.c
diff -u php-src/ext/pdo_pgsql/pdo_pgsql.c:1.7.2.11.2.1.2.3 
php-src/ext/pdo_pgsql/pdo_pgsql.c:1.7.2.11.2.1.2.4
--- php-src/ext/pdo_pgsql/pdo_pgsql.c:1.7.2.11.2.1.2.3  Wed Dec 31 11:15:41 2008
+++ php-src/ext/pdo_pgsql/pdo_pgsql.c   Sat Mar 28 01:58:49 2009
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: pdo_pgsql.c,v 1.7.2.11.2.1.2.3 2008/12/31 11:15:41 sebastian Exp $ */
+/* $Id: pdo_pgsql.c,v 1.7.2.11.2.1.2.4 2009/03/28 01:58:49 mbeccati Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -31,6 +31,11 @@
 #include php_pdo_pgsql_int.h
 
 #ifdef HAVE_PG_CONFIG_H
+#undef PACKAGE_BUGREPORT
+#undef PACKAGE_NAME
+#undef PACKAGE_STRING
+#undef PACKAGE_TARNAME
+#undef PACKAGE_VERSION
 #include pg_config.h
 #endif
 
@@ -123,7 +128,7 @@
php_info_print_table_row(2, PostgreSQL(libpq) Version, PG_VERSION);
 #endif 
php_info_print_table_row(2, Module version, 
pdo_pgsql_module_entry.version);
-   php_info_print_table_row(2, Revision,  $Id: pdo_pgsql.c,v 
1.7.2.11.2.1.2.3 2008/12/31 11:15:41 sebastian Exp $ );
+   php_info_print_table_row(2, Revision,  $Id: pdo_pgsql.c,v 
1.7.2.11.2.1.2.4 2009/03/28 01:58:49 mbeccati Exp $ );
 
php_info_print_table_end();
 }



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/pdo_pgsql config.m4 config.w32 package.xml package2.xml pdo_pgsql.c pgsql_driver.c pgsql_statement.c php_pdo_pgsql.h php_pdo_pgsql_int.h /ext/pdo_pgsql/tests bug46274.phpt

2009-03-27 Thread Matteo Beccati
mbeccatiSat Mar 28 02:34:02 2009 UTC

  Removed files:   
/php-src/ext/pdo_pgsql  package.xml 

  Modified files:  
/php-src/ext/pdo_pgsql  package2.xml config.m4 config.w32 
pdo_pgsql.c pgsql_driver.c pgsql_statement.c 
php_pdo_pgsql.h php_pdo_pgsql_int.h 
/php-src/ext/pdo_pgsql/testsbug46274.phpt bug46274_2.phpt 
common.phpt 
  Log:
  MFB:
  - Updated pdo_pgsql from PHP_5_3
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/package2.xml?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/pdo_pgsql/package2.xml
diff -u /dev/null php-src/ext/pdo_pgsql/package2.xml:1.2
--- /dev/null   Sat Mar 28 02:34:02 2009
+++ php-src/ext/pdo_pgsql/package2.xml  Sat Mar 28 02:34:02 2009
@@ -0,0 +1,87 @@
+?xml version=1.0 encoding=UTF-8?
+package packagerversion=1.4.2 version=2.0 
xmlns=http://pear.php.net/dtd/package-2.0; 
xmlns:tasks=http://pear.php.net/dtd/tasks-1.0; 
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
xsi:schemaLocation=http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd;
+ namePDO_PGSQL/name
+ channelpecl.php.net/channel
+ summaryPostgreSQL driver for PDO/summary
+ descriptionThis extension provides an PostgreSQL driver for PDO.
+ /description
+ lead
+  nameEdin Kadribasic/name
+  useredink/user
+  emailed...@php.net/email
+  activeyes/active
+ /lead
+ lead
+  nameIlia Alshanetsky/name
+  useriliaa/user
+  emailil...@php.net/email
+  activeyes/active
+ /lead
+ lead
+  nameWez Furlong/name
+  userwez/user
+  emailw...@php.net/email
+  activeyes/active
+ /lead
+ date2006-05-01/date
+ version
+  release1.0.2/release
+  api1.0.2/api
+ /version
+ stability
+  releasestable/release
+  apistable/api
+ /stability
+ license uri=http://www.php.net/license;PHP/license
+ notes
+This PECL release corresponds to PHP 5.1.3.
+
+- Fixed bug #36727 (segfault in pdo_pgsql bindValue() when no parameters are
+  defined). (Tony)
+- Fixed bug #36382 (PDO/PgSQL's getColumnMeta() crashes). (Derick)
+- Fixed bug #36176 (PDO_PGSQL - PDO::exec() does not return number of rows
+  affected by the operation). (Ilia)
+- Fixed prepared statement name conflict handling in PDO_PGSQL. (Thies, Ilia)
+- repackage with package2.xml 
+- Added PDO::pgsqlLOBCreate(), PDO::pgsqlLOBOpen() and PDO::pgsqlLOBUnlink().
+
+You require PostgreSQL client libraries installed on the machine where you
+intend to build and/or use this package.
+
+If you are running on windows, you can download the binary from here:
+http://pecl4win.php.net/ext.php/php_pdo_pgsql.dll
+ /notes
+ contents
+  dir name=/
+   file name=config.m4 role=src /
+   file name=config.w32 role=src /
+   file name=CREDITS role=doc /
+   file name=pdo_pgsql.c role=src /
+   file name=pgsql_driver.c role=src /
+   file name=pgsql_statement.c role=src /
+   file name=php_pdo_pgsql.h role=src /
+   file name=php_pdo_pgsql_int.h role=src /
+  /dir !-- / --
+ /contents
+ dependencies
+  required
+   php
+min5.0.3/min
+   /php
+   pearinstaller
+min1.4.0/min
+   /pearinstaller
+   package
+namepdo/name
+channelpecl.php.net/channel
+min1.0.3/min
+providesextensionPDO/providesextension
+   /package
+  /required
+ /dependencies
+ providesextensionPDO_PGSQL/providesextension
+ extsrcrelease /
+/package
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/config.m4?r1=1.20r2=1.21diff_format=u
Index: php-src/ext/pdo_pgsql/config.m4
diff -u php-src/ext/pdo_pgsql/config.m4:1.20 
php-src/ext/pdo_pgsql/config.m4:1.21
--- php-src/ext/pdo_pgsql/config.m4:1.20Fri Jul 25 13:38:41 2008
+++ php-src/ext/pdo_pgsql/config.m4 Sat Mar 28 02:34:02 2009
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.20 2008/07/25 13:38:41 jani Exp $
+dnl $Id: config.m4,v 1.21 2009/03/28 02:34:02 mbeccati Exp $
 dnl config.m4 for extension pdo_pgsql
 dnl vim:et:sw=2:ts=2:
 
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/config.w32?r1=1.8r2=1.9diff_format=u
Index: php-src/ext/pdo_pgsql/config.w32
diff -u php-src/ext/pdo_pgsql/config.w32:1.8 
php-src/ext/pdo_pgsql/config.w32:1.9
--- php-src/ext/pdo_pgsql/config.w32:1.8Wed Oct 11 11:00:37 2006
+++ php-src/ext/pdo_pgsql/config.w32Sat Mar 28 02:34:02 2009
@@ -1,11 +1,11 @@
-// $Id: config.w32,v 1.8 2006/10/11 11:00:37 edink Exp $
+// $Id: config.w32,v 1.9 2009/03/28 02:34:02 mbeccati Exp $
 // vim:ft=javascript
 
 ARG_WITH(pdo-pgsql, PostgreSQL support for PDO, no);
 
 if (PHP_PDO_PGSQL != no) {
if (CHECK_LIB(libpq.lib, pdo_pgsql, PHP_PDO_PGSQL) 
-   CHECK_HEADER_ADD_INCLUDE(libpq-fe.h, 
CFLAGS_PDO_PGSQL, PHP_PDO_PGSQL + ; + PHP_PHP_BUILD + \\include\\pgsql)) {
+   CHECK_HEADER_ADD_INCLUDE(libpq-fe.h, 
CFLAGS_PDO_PGSQL, PHP_PDO_PGSQL + ; + PHP_PHP_BUILD + \\include\\pgsql; + 
PHP_PHP_BUILD + \\include\\libpq;)) {

[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/pdo_pgsql pgsql_driver.c pgsql_statement.c /ext/pdo_pgsql/tests bug44861.phpt

2009-03-27 Thread Matteo Beccati
mbeccatiSat Mar 28 02:58:05 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/pdo_pgsql/testsbug44861.phpt 

  Modified files:  
/php-srcNEWS 
/php-src/ext/pdo_pgsql  pgsql_driver.c pgsql_statement.c 
  Log:
  - Fixed bug #44861 (scrollable cursor don't work with pgsql)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.541r2=1.2027.2.547.2.965.2.542diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.541 
php-src/NEWS:1.2027.2.547.2.965.2.542
--- php-src/NEWS:1.2027.2.547.2.965.2.541   Sat Mar 28 01:29:14 2009
+++ php-src/NEWSSat Mar 28 02:58:04 2009
@@ -3,6 +3,7 @@
 ?? ??? 200?, PHP 5.3.0 RC 2
 - Undeprecated ticks. (Arnaud)
 
+- Fixed bug #44861 (scrollable cursor don't work with pgsql). (Matteo)
 - Fixed bug #47779 (Wrong value for SIG_UNBLOCK and SIG_SETMASK constants).
   (Matteo)
 - Fixed bug #47771 (Exception during object construction from arg call calls
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.53.2.14.2.9.2.4r2=1.53.2.14.2.9.2.5diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_driver.c
diff -u php-src/ext/pdo_pgsql/pgsql_driver.c:1.53.2.14.2.9.2.4 
php-src/ext/pdo_pgsql/pgsql_driver.c:1.53.2.14.2.9.2.5
--- php-src/ext/pdo_pgsql/pgsql_driver.c:1.53.2.14.2.9.2.4  Wed Dec 31 
11:15:41 2008
+++ php-src/ext/pdo_pgsql/pgsql_driver.cSat Mar 28 02:58:04 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pgsql_driver.c,v 1.53.2.14.2.9.2.4 2008/12/31 11:15:41 sebastian Exp $ 
*/
+/* $Id: pgsql_driver.c,v 1.53.2.14.2.9.2.5 2009/03/28 02:58:04 mbeccati Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -232,13 +232,13 @@
if (S-cursor_name) {
efree(S-cursor_name);
}
-   /* TODO: check how scrollable cursors related to prepared 
statements */
spprintf(S-cursor_name, 0, pdo_pgsql_cursor_%08x, (unsigned 
int) stmt);
+   emulate = 1;
}
 
 #if HAVE_PQPREPARE
 
-   if (driver_options) {
+   else if (driver_options) {
if (pdo_attr_lval(driver_options,

PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, 0 TSRMLS_CC) == 1) {
emulate = 1;
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_statement.c?r1=1.31.2.12.2.7.2.8r2=1.31.2.12.2.7.2.9diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_statement.c
diff -u php-src/ext/pdo_pgsql/pgsql_statement.c:1.31.2.12.2.7.2.8 
php-src/ext/pdo_pgsql/pgsql_statement.c:1.31.2.12.2.7.2.9
--- php-src/ext/pdo_pgsql/pgsql_statement.c:1.31.2.12.2.7.2.8   Wed Dec 31 
11:15:41 2008
+++ php-src/ext/pdo_pgsql/pgsql_statement.c Sat Mar 28 02:58:04 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pgsql_statement.c,v 1.31.2.12.2.7.2.8 2008/12/31 11:15:41 sebastian 
Exp $ */
+/* $Id: pgsql_statement.c,v 1.31.2.12.2.7.2.9 2009/03/28 02:58:04 mbeccati Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -129,6 +129,24 @@

S-current_row = 0;
 
+   if (S-cursor_name) {
+   char *q = NULL;
+   spprintf(q, 0, DECLARE %s SCROLL CURSOR WITH HOLD FOR %s, 
S-cursor_name, stmt-active_query_string);
+   S-result = PQexec(H-server, q);
+   efree(q);
+
+   /* check if declare failed */
+   status = PQresultStatus(S-result);
+   if (status != PGRES_COMMAND_OK  status != PGRES_TUPLES_OK) {
+   pdo_pgsql_error_stmt(stmt, status, 
pdo_pgsql_sqlstate(S-result));
+   return 0;
+   }
+
+   /* fetch to be able to get the number of tuples later, but 
don't advance the cursor pointer */
+   spprintf(q, 0, FETCH FORWARD 0 FROM %s, S-cursor_name);
+   S-result = PQexec(H-server, q);
+   efree(q);
+   } else
 #if HAVE_PQPREPARE
if (S-stmt_name) {
/* using a prepared statement */
@@ -182,12 +200,7 @@
0);
} else
 #endif
-   if (S-cursor_name) {
-   char *q = NULL;
-   spprintf(q, 0, DECLARE %s CURSOR FOR %s, S-cursor_name, 
stmt-active_query_string);
-   S-result = PQexec(H-server, q);
-   efree(q);
-   } else {
+   {
S-result = PQexec(H-server, stmt-active_query_string);
}
status = PQresultStatus(S-result);
@@ -350,19 +363,23 @@
pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt-driver_data;
 
if (S-cursor_name) {
-   char *ori_str;
+   char *ori_str = NULL;
char *q = NULL;
ExecStatusType status;
 
switch (ori) {
-   case PDO_FETCH_ORI_NEXT:ori_str = FORWARD; 

[PHP-CVS] cvs: php-src /ext/pdo_pgsql pgsql_driver.c pgsql_statement.c /ext/pdo_pgsql/tests bug44861.phpt

2009-03-27 Thread Matteo Beccati
mbeccatiSat Mar 28 03:01:38 2009 UTC

  Modified files:  
/php-src/ext/pdo_pgsql  pgsql_driver.c pgsql_statement.c 
/php-src/ext/pdo_pgsql/testsbug44861.phpt 
  Log:
  MFB:
  - Fixed bug #44861 (scrollable cursor don't work with pgsql)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.71r2=1.72diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_driver.c
diff -u php-src/ext/pdo_pgsql/pgsql_driver.c:1.71 
php-src/ext/pdo_pgsql/pgsql_driver.c:1.72
--- php-src/ext/pdo_pgsql/pgsql_driver.c:1.71   Sat Mar 28 02:34:02 2009
+++ php-src/ext/pdo_pgsql/pgsql_driver.cSat Mar 28 03:01:38 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pgsql_driver.c,v 1.71 2009/03/28 02:34:02 mbeccati Exp $ */
+/* $Id: pgsql_driver.c,v 1.72 2009/03/28 03:01:38 mbeccati Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -232,13 +232,13 @@
if (S-cursor_name) {
efree(S-cursor_name);
}
-   /* TODO: check how scrollable cursors related to prepared 
statements */
spprintf(S-cursor_name, 0, pdo_pgsql_cursor_%08x, (unsigned 
int) stmt);
+   emulate = 1;
}
 
 #if HAVE_PQPREPARE
 
-   if (driver_options) {
+   else if (driver_options) {
if (pdo_attr_lval(driver_options,

PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, 0 TSRMLS_CC) == 1) {
emulate = 1;
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_statement.c?r1=1.51r2=1.52diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_statement.c
diff -u php-src/ext/pdo_pgsql/pgsql_statement.c:1.51 
php-src/ext/pdo_pgsql/pgsql_statement.c:1.52
--- php-src/ext/pdo_pgsql/pgsql_statement.c:1.51Sat Mar 28 02:34:02 2009
+++ php-src/ext/pdo_pgsql/pgsql_statement.c Sat Mar 28 03:01:38 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pgsql_statement.c,v 1.51 2009/03/28 02:34:02 mbeccati Exp $ */
+/* $Id: pgsql_statement.c,v 1.52 2009/03/28 03:01:38 mbeccati Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -129,6 +129,24 @@

S-current_row = 0;
 
+   if (S-cursor_name) {
+   char *q = NULL;
+   spprintf(q, 0, DECLARE %s SCROLL CURSOR WITH HOLD FOR %s, 
S-cursor_name, stmt-active_query_string);
+   S-result = PQexec(H-server, q);
+   efree(q);
+
+   /* check if declare failed */
+   status = PQresultStatus(S-result);
+   if (status != PGRES_COMMAND_OK  status != PGRES_TUPLES_OK) {
+   pdo_pgsql_error_stmt(stmt, status, 
pdo_pgsql_sqlstate(S-result));
+   return 0;
+   }
+
+   /* fetch to be able to get the number of tuples later, but 
don't advance the cursor pointer */
+   spprintf(q, 0, FETCH FORWARD 0 FROM %s, S-cursor_name);
+   S-result = PQexec(H-server, q);
+   efree(q);
+   } else
 #if HAVE_PQPREPARE
if (S-stmt_name) {
/* using a prepared statement */
@@ -182,12 +200,7 @@
0);
} else
 #endif
-   if (S-cursor_name) {
-   char *q = NULL;
-   spprintf(q, 0, DECLARE %s CURSOR FOR %s, S-cursor_name, 
stmt-active_query_string);
-   S-result = PQexec(H-server, q);
-   efree(q);
-   } else {
+   {
S-result = PQexec(H-server, stmt-active_query_string);
}
status = PQresultStatus(S-result);
@@ -350,19 +363,23 @@
pdo_pgsql_stmt *S = (pdo_pgsql_stmt*)stmt-driver_data;
 
if (S-cursor_name) {
-   char *ori_str;
+   char *ori_str = NULL;
char *q = NULL;
ExecStatusType status;
 
switch (ori) {
-   case PDO_FETCH_ORI_NEXT:ori_str = FORWARD; 
break;
-   case PDO_FETCH_ORI_PRIOR:   ori_str = BACKWARD; 
break;
-   case PDO_FETCH_ORI_REL: ori_str = RELATIVE; 
break;
+   case PDO_FETCH_ORI_NEXT:spprintf(ori_str, 0, 
NEXT); break;
+   case PDO_FETCH_ORI_PRIOR:   spprintf(ori_str, 0, 
BACKWARD); break;
+   case PDO_FETCH_ORI_FIRST:   spprintf(ori_str, 0, 
FIRST); break;
+   case PDO_FETCH_ORI_LAST:spprintf(ori_str, 0, 
LAST); break;
+   case PDO_FETCH_ORI_ABS: spprintf(ori_str, 0, 
ABSOLUTE %ld, offset); break;
+   case PDO_FETCH_ORI_REL: spprintf(ori_str, 0, 
RELATIVE %ld, offset); break;
default:
return 0;
}

-   spprintf(q, 0, FETCH 

[PHP-CVS] cvs: php-src /ext/pcntl pcntl.c /ext/pcntl/tests pcntl_signal.phpt

2009-03-27 Thread Matteo Beccati
mbeccatiSat Mar 28 03:11:39 2009 UTC

  Modified files:  
/php-src/ext/pcntl  pcntl.c 
/php-src/ext/pcntl/testspcntl_signal.phpt 
  Log:
  - Reverting: pcntl_signal() returning NULL when passing wrong parameters
  # Wow, my first commit and I broke something, sorry about that :(
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.76r2=1.77diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.76 php-src/ext/pcntl/pcntl.c:1.77
--- php-src/ext/pcntl/pcntl.c:1.76  Sat Mar 28 01:31:31 2009
+++ php-src/ext/pcntl/pcntl.c   Sat Mar 28 03:11:39 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.76 2009/03/28 01:31:31 mbeccati Exp $ */
+/* $Id: pcntl.c,v 1.77 2009/03/28 03:11:39 mbeccati Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -757,7 +757,7 @@
zend_bool restart_syscalls = 1;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, lz|b, signo, 
handle, restart_syscalls) == FAILURE) {
-   RETURN_FALSE;
+   return;
}
 
if (!PCNTL_G(spares)) {
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/pcntl_signal.phpt?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/pcntl/tests/pcntl_signal.phpt
diff -u php-src/ext/pcntl/tests/pcntl_signal.phpt:1.2 
php-src/ext/pcntl/tests/pcntl_signal.phpt:1.3
--- php-src/ext/pcntl/tests/pcntl_signal.phpt:1.2   Sat Mar 28 01:31:31 2009
+++ php-src/ext/pcntl/tests/pcntl_signal.phpt   Sat Mar 28 03:11:39 2009
@@ -25,7 +25,7 @@
 signal dispatched
 
 Warning: pcntl_signal() expects at least 2 parameters, 0 given in %s
-bool(false)
+NULL
 bool(true)
 
 Warning: pcntl_signal(): Invalid value for handle argument specified in %s



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/pcntl pcntl.c

2009-03-27 Thread Matteo Beccati
mbeccatiSat Mar 28 03:17:31 2009 UTC

  Modified files:  
/php-src/ext/pcntl  pcntl.c 
  Log:
  - Fixed bug #47816 (pcntl tests failing on NetBSD)
  # Tests will still fail until a few kernel bugs are fixed
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.77r2=1.78diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.77 php-src/ext/pcntl/pcntl.c:1.78
--- php-src/ext/pcntl/pcntl.c:1.77  Sat Mar 28 03:11:39 2009
+++ php-src/ext/pcntl/pcntl.c   Sat Mar 28 03:17:31 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.77 2009/03/28 03:11:39 mbeccati Exp $ */
+/* $Id: pcntl.c,v 1.78 2009/03/28 03:17:31 mbeccati Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -924,6 +924,14 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, 
strerror(errno));
}
 
+   /*
+* sigtimedwait and sigwaitinfo can return 0 on success on some 
+* platforms, e.g. NetBSD
+*/
+   if (!signo  siginfo.si_signo) {
+   signo = siginfo.si_signo;
+   }
+
if (signo  0  user_siginfo) {
if (Z_TYPE_P(user_siginfo) != IS_ARRAY) {
zval_dtor(user_siginfo);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/pcntl pcntl.c

2009-03-27 Thread Matteo Beccati
mbeccatiSat Mar 28 03:21:04 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-srcNEWS 
/php-src/ext/pcntl  pcntl.c 
  Log:
  MFH:
  - Fixed bug #47816 (pcntl tests failing on NetBSD)
  # Tests will still fail until a few kernel bugs are fixed
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.542r2=1.2027.2.547.2.965.2.543diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.542 
php-src/NEWS:1.2027.2.547.2.965.2.543
--- php-src/NEWS:1.2027.2.547.2.965.2.542   Sat Mar 28 02:58:04 2009
+++ php-src/NEWSSat Mar 28 03:21:04 2009
@@ -3,6 +3,7 @@
 ?? ??? 200?, PHP 5.3.0 RC 2
 - Undeprecated ticks. (Arnaud)
 
+- Fixed bug #47816 (pcntl tests failing on NetBSD). (Matteo)
 - Fixed bug #44861 (scrollable cursor don't work with pgsql). (Matteo)
 - Fixed bug #47779 (Wrong value for SIG_UNBLOCK and SIG_SETMASK constants).
   (Matteo)
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.4.2.19r2=1.48.2.2.2.4.2.20diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.19 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.20
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.19 Sat Mar 28 03:12:52 2009
+++ php-src/ext/pcntl/pcntl.c   Sat Mar 28 03:21:04 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.19 2009/03/28 03:12:52 mbeccati Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.4.2.20 2009/03/28 03:21:04 mbeccati Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -924,6 +924,14 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, %s, 
strerror(errno));
}
 
+   /*
+* sigtimedwait and sigwaitinfo can return 0 on success on some 
+* platforms, e.g. NetBSD
+*/
+   if (!signo  siginfo.si_signo) {
+   signo = siginfo.si_signo;
+   }
+
if (signo  0  user_siginfo) {
if (Z_TYPE_P(user_siginfo) != IS_ARRAY) {
zval_dtor(user_siginfo);



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c /ext/pcntl/tests pcntl_signal.phpt

2009-03-27 Thread Matteo Beccati
mbeccatiSat Mar 28 03:12:52 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pcntl  pcntl.c 
/php-src/ext/pcntl/testspcntl_signal.phpt 
  Log:
  MFH:
  - Reverting: pcntl_signal() returning NULL when passing wrong parameters
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/pcntl.c?r1=1.48.2.2.2.4.2.18r2=1.48.2.2.2.4.2.19diff_format=u
Index: php-src/ext/pcntl/pcntl.c
diff -u php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.18 
php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.19
--- php-src/ext/pcntl/pcntl.c:1.48.2.2.2.4.2.18 Sat Mar 28 01:32:50 2009
+++ php-src/ext/pcntl/pcntl.c   Sat Mar 28 03:12:52 2009
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: pcntl.c,v 1.48.2.2.2.4.2.18 2009/03/28 01:32:50 mbeccati Exp $ */
+/* $Id: pcntl.c,v 1.48.2.2.2.4.2.19 2009/03/28 03:12:52 mbeccati Exp $ */
 
 #define PCNTL_DEBUG 0
 
@@ -757,7 +757,7 @@
zend_bool restart_syscalls = 1;
 
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, lz|b, signo, 
handle, restart_syscalls) == FAILURE) {
-   RETURN_FALSE;
+   return;
}
 
if (!PCNTL_G(spares)) {
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/pcntl_signal.phpt?r1=1.1.2.3r2=1.1.2.4diff_format=u
Index: php-src/ext/pcntl/tests/pcntl_signal.phpt
diff -u php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1.2.3 
php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1.2.4
--- php-src/ext/pcntl/tests/pcntl_signal.phpt:1.1.2.3   Sat Mar 28 01:32:51 2009
+++ php-src/ext/pcntl/tests/pcntl_signal.phpt   Sat Mar 28 03:12:52 2009
@@ -25,7 +25,7 @@
 signal dispatched
 
 Warning: pcntl_signal() expects at least 2 parameters, 0 given in %s
-bool(false)
+NULL
 bool(true)
 
 Warning: pcntl_signal(): Invalid value for handle argument specified in %s



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl pcntl.c /ext/pcntl/tests pcntl_signal.phpt

2009-03-28 Thread Matteo Beccati

Antony Dovgal ha scritto:

On 28.03.2009 04:32, Matteo Beccati wrote:

mbeccatiSat Mar 28 01:32:51 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pcntl	pcntl.c 
/php-src/ext/pcntl/tests	pcntl_signal.phpt 
  Log:

  MFH:
  - Fixed pcntl_signal() returning NULL when passing wrong parameters


Fixed? Since when standard behavior is broken? 
What's wrong with that?


Sorry about that. I've reverted a few minutes later after Arnaud pointed 
me to the standard behaviour.



Cheers

--
Matteo Beccati

OpenX - http://www.openx.org

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/pcntl/tests 002.phpt

2009-03-29 Thread Matteo Beccati
mbeccatiSun Mar 29 16:42:49 2009 UTC

  Modified files:  
/php-src/ext/pcntl/tests002.phpt 
  Log:
  - Fixed pcntl test for platforms not accepting a very large timeout in 
sigtimedwait()
  # It isn't really necessary for the child to wait for PHP_INT_MAX seconds
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/002.phpt?r1=1.6r2=1.7diff_format=u
Index: php-src/ext/pcntl/tests/002.phpt
diff -u php-src/ext/pcntl/tests/002.phpt:1.6 
php-src/ext/pcntl/tests/002.phpt:1.7
--- php-src/ext/pcntl/tests/002.phpt:1.6Wed Mar 25 23:33:36 2009
+++ php-src/ext/pcntl/tests/002.phptSun Mar 29 16:42:49 2009
@@ -68,7 +68,7 @@
var_dump(pcntl_sigtimedwait(array(SIGTERM), $signo, PHP_INT_MAX, 
PHP_INT_MAX));
 } else {
$siginfo = NULL;
-   pcntl_sigtimedwait(array(SIGINT), $siginfo, PHP_INT_MAX, 9);
+   pcntl_sigtimedwait(array(SIGINT), $siginfo, 3600, 0);
exit;
 }
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pcntl/tests 002.phpt

2009-03-29 Thread Matteo Beccati
mbeccatiSun Mar 29 16:43:47 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pcntl/tests002.phpt 
  Log:
  MFH:
  - Fixed pcntl test for platforms not accepting a very large timeout in 
sigtimedwait()
  # It isn't really necessary for the child to wait for PHP_INT_MAX seconds
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcntl/tests/002.phpt?r1=1.1.2.7r2=1.1.2.8diff_format=u
Index: php-src/ext/pcntl/tests/002.phpt
diff -u php-src/ext/pcntl/tests/002.phpt:1.1.2.7 
php-src/ext/pcntl/tests/002.phpt:1.1.2.8
--- php-src/ext/pcntl/tests/002.phpt:1.1.2.7Wed Mar 25 23:34:08 2009
+++ php-src/ext/pcntl/tests/002.phptSun Mar 29 16:43:47 2009
@@ -68,7 +68,7 @@
var_dump(pcntl_sigtimedwait(array(SIGTERM), $signo, PHP_INT_MAX, 
PHP_INT_MAX));
 } else {
$siginfo = NULL;
-   pcntl_sigtimedwait(array(SIGINT), $siginfo, PHP_INT_MAX, 9);
+   pcntl_sigtimedwait(array(SIGINT), $siginfo, 3600, 0);
exit;
 }
 



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/pdo pdo_dbh.c pdo_stmt.c /ext/pdo/tests bug_44173.phpt

2009-04-02 Thread Matteo Beccati
mbeccatiThu Apr  2 16:40:33 2009 UTC

  Added files: 
/php-src/ext/pdo/tests  bug_44173.phpt 

  Modified files:  
/php-src/ext/pdopdo_dbh.c pdo_stmt.c 
  Log:
  - Fixed bug #44173 (PDO-query() parameter parsing/checking needs an
update)
  # The changeset is longer than really needed because pdo_stmt.c was
  # refactored to remove the goto
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_dbh.c?r1=1.167r2=1.168diff_format=u
Index: php-src/ext/pdo/pdo_dbh.c
diff -u php-src/ext/pdo/pdo_dbh.c:1.167 php-src/ext/pdo/pdo_dbh.c:1.168
--- php-src/ext/pdo/pdo_dbh.c:1.167 Thu Mar 26 20:01:57 2009
+++ php-src/ext/pdo/pdo_dbh.c   Thu Apr  2 16:40:33 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pdo_dbh.c,v 1.167 2009/03/26 20:01:57 felipe Exp $ */
+/* $Id: pdo_dbh.c,v 1.168 2009/04/02 16:40:33 mbeccati Exp $ */
 
 /* The PDO Database Handle Class */
 
@@ -1066,6 +1066,12 @@
char *statement;
int statement_len;
 
+   /* Return a meaningful error when no parameters were passed */
+   if (!ZEND_NUM_ARGS()) {
+   zend_parse_parameters(0 TSRMLS_CC, z|z, NULL, NULL);
+   RETURN_FALSE;
+   }
+   
if (FAILURE == zend_parse_parameters(1 TSRMLS_CC, s, statement,
statement_len)) {
RETURN_FALSE;
@@ -1096,8 +1102,8 @@
ZVAL_NULL(stmt-lazy_object_ref);
 
if (dbh-methods-preparer(dbh, statement, statement_len, stmt, NULL 
TSRMLS_CC)) {
+   PDO_STMT_CLEAR_ERR();
if (ZEND_NUM_ARGS() == 1 || SUCCESS == 
pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAM_PASSTHRU, stmt, 1)) {
-   PDO_STMT_CLEAR_ERR();
 
/* now execute the statement */
PDO_STMT_CLEAR_ERR();
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.220r2=1.221diff_format=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.220 php-src/ext/pdo/pdo_stmt.c:1.221
--- php-src/ext/pdo/pdo_stmt.c:1.220Thu Mar 26 20:01:57 2009
+++ php-src/ext/pdo/pdo_stmt.c  Thu Apr  2 16:40:33 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pdo_stmt.c,v 1.220 2009/03/26 20:01:57 felipe Exp $ */
+/* $Id: pdo_stmt.c,v 1.221 2009/04/02 16:40:33 mbeccati Exp $ */
 
 /* The PDO Statement Handle Class */
 
@@ -1945,6 +1945,7 @@
int flags, argc = ZEND_NUM_ARGS() - skip;
zval ***args;
zend_class_entry **cep;
+   int retval;

do_fetch_opt_finish(stmt, 1 TSRMLS_CC);
 
@@ -1967,21 +1968,27 @@
 
args = safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval*), 0);
 
-   if (FAILURE == zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args)) {
-fail_out:
-   efree(args);
-   return FAILURE;
-   }
+   retval = zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args);

-   convert_to_long_ex(args[skip]);
-   mode = Z_LVAL_PP(args[skip]);
-   flags = mode  PDO_FETCH_FLAGS;
+   if (SUCCESS == retval) {
+   if (Z_TYPE_PP(args[skip]) != IS_LONG) {
+   pdo_raise_impl_error(stmt-dbh, stmt, HY000, mode 
must be an integer TSRMLS_CC);
+   retval = FAILURE;
+   } else {
+   mode = Z_LVAL_PP(args[skip]);
+   flags = mode  PDO_FETCH_FLAGS;

-   if (!pdo_stmt_verify_mode(stmt, mode, 0 TSRMLS_CC)) {
+   retval = pdo_stmt_verify_mode(stmt, mode, 0 TSRMLS_CC);
+   }
+   }
+   
+   if (FAILURE == retval) {
+   PDO_STMT_CLEAR_ERR();
efree(args);
return FAILURE;
}
 
+   retval = FAILURE;
switch (mode  ~PDO_FETCH_FLAGS) {
case PDO_FETCH_USE_DEFAULT:
case PDO_FETCH_LAZY:
@@ -1992,93 +1999,122 @@
case PDO_FETCH_BOUND:
case PDO_FETCH_NAMED:
case PDO_FETCH_KEY_PAIR:
+   if (argc != 1) {
+   pdo_raise_impl_error(stmt-dbh, stmt, HY000, 
fetch mode doesn't allow any extra arguments TSRMLS_CC);
+   } else {
+   retval = SUCCESS;
+   }
break;
 
case PDO_FETCH_COLUMN:
if (argc != 2) {
-   goto fail_out;
+   pdo_raise_impl_error(stmt-dbh, stmt, HY000, 
fetch mode requires the colno argument TSRMLS_CC);
+   } else  if (Z_TYPE_PP(args[skip+1]) != IS_LONG) {
+   pdo_raise_impl_error(stmt-dbh, stmt, HY000, 
colno must be an integer TSRMLS_CC);
+   } else {
+   stmt-fetch.column = 

[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/pdo pdo_dbh.c pdo_stmt.c /ext/pdo/tests bug_44173.phpt

2009-04-02 Thread Matteo Beccati
mbeccatiThu Apr  2 16:41:24 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/pdo/tests  bug_44173.phpt 

  Modified files:  
/php-srcNEWS 
/php-src/ext/pdopdo_dbh.c pdo_stmt.c 
  Log:
  MFH:
  - Fixed bug #44173 (PDO-query() parameter parsing/checking needs an
update)
  # The changeset is longer than really needed because pdo_stmt.c was
  # refactored to remove the goto
  
  http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.550r2=1.2027.2.547.2.965.2.551diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.550 
php-src/NEWS:1.2027.2.547.2.965.2.551
--- php-src/NEWS:1.2027.2.547.2.965.2.550   Thu Apr  2 09:56:33 2009
+++ php-src/NEWSThu Apr  2 16:41:23 2009
@@ -25,6 +25,8 @@
 - Fixed bug #47038 (Memory leak in include). (Dmitry)
 - Fixed bug #44861 (scrollable cursor don't work with pgsql). (Matteo)
 - Fixed bug #44409 (PDO::FETCH_SERIALIZE calls __construct()). (Matteo)
+- Fixed bug #44173 (PDO-query() parameter parsing/checking needs an 
+  update). (Matteo)
 - Fixed bug #42362 (HTTP status codes 204 and 304 should not be gzipped).
   (Scott, Edward Z. Yang)
 
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_dbh.c?r1=1.82.2.31.2.17.2.23r2=1.82.2.31.2.17.2.24diff_format=u
Index: php-src/ext/pdo/pdo_dbh.c
diff -u php-src/ext/pdo/pdo_dbh.c:1.82.2.31.2.17.2.23 
php-src/ext/pdo/pdo_dbh.c:1.82.2.31.2.17.2.24
--- php-src/ext/pdo/pdo_dbh.c:1.82.2.31.2.17.2.23   Thu Mar 26 12:53:39 2009
+++ php-src/ext/pdo/pdo_dbh.c   Thu Apr  2 16:41:23 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pdo_dbh.c,v 1.82.2.31.2.17.2.23 2009/03/26 12:53:39 felipe Exp $ */
+/* $Id: pdo_dbh.c,v 1.82.2.31.2.17.2.24 2009/04/02 16:41:23 mbeccati Exp $ */
 
 /* The PDO Database Handle Class */
 
@@ -1065,6 +1065,12 @@
char *statement;
int statement_len;
 
+   /* Return a meaningful error when no parameters were passed */
+   if (!ZEND_NUM_ARGS()) {
+   zend_parse_parameters(0 TSRMLS_CC, z|z, NULL, NULL);
+   RETURN_FALSE;
+   }
+   
if (FAILURE == zend_parse_parameters(1 TSRMLS_CC, s, statement,
statement_len)) {
RETURN_FALSE;
@@ -1095,8 +1101,8 @@
ZVAL_NULL(stmt-lazy_object_ref);
 
if (dbh-methods-preparer(dbh, statement, statement_len, stmt, NULL 
TSRMLS_CC)) {
+   PDO_STMT_CLEAR_ERR();
if (ZEND_NUM_ARGS() == 1 || SUCCESS == 
pdo_stmt_setup_fetch_mode(INTERNAL_FUNCTION_PARAM_PASSTHRU, stmt, 1)) {
-   PDO_STMT_CLEAR_ERR();
 
/* now execute the statement */
PDO_STMT_CLEAR_ERR();
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.118.2.38.2.24.2.44r2=1.118.2.38.2.24.2.45diff_format=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.24.2.44 
php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.24.2.45
--- php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.24.2.44 Mon Mar 23 23:15:02 2009
+++ php-src/ext/pdo/pdo_stmt.c  Thu Apr  2 16:41:23 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pdo_stmt.c,v 1.118.2.38.2.24.2.44 2009/03/23 23:15:02 felipe Exp $ */
+/* $Id: pdo_stmt.c,v 1.118.2.38.2.24.2.45 2009/04/02 16:41:23 mbeccati Exp $ */
 
 /* The PDO Statement Handle Class */
 
@@ -1951,6 +1951,7 @@
int flags, argc = ZEND_NUM_ARGS() - skip;
zval ***args;
zend_class_entry **cep;
+   int retval;

do_fetch_opt_finish(stmt, 1 TSRMLS_CC);
 
@@ -1973,21 +1974,27 @@
 
args = safe_emalloc(ZEND_NUM_ARGS(), sizeof(zval*), 0);
 
-   if (FAILURE == zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args)) {
-fail_out:
-   efree(args);
-   return FAILURE;
-   }
+   retval = zend_get_parameters_array_ex(ZEND_NUM_ARGS(), args);

-   convert_to_long_ex(args[skip]);
-   mode = Z_LVAL_PP(args[skip]);
-   flags = mode  PDO_FETCH_FLAGS;
+   if (SUCCESS == retval) {
+   if (Z_TYPE_PP(args[skip]) != IS_LONG) {
+   pdo_raise_impl_error(stmt-dbh, stmt, HY000, mode 
must be an integer TSRMLS_CC);
+   retval = FAILURE;
+   } else {
+   mode = Z_LVAL_PP(args[skip]);
+   flags = mode  PDO_FETCH_FLAGS;

-   if (!pdo_stmt_verify_mode(stmt, mode, 0 TSRMLS_CC)) {
+   retval = pdo_stmt_verify_mode(stmt, mode, 0 TSRMLS_CC);
+   }
+   }
+   
+   if (FAILURE == retval) {
+   PDO_STMT_CLEAR_ERR();
efree(args);
return FAILURE;
}
 
+   retval = FAILURE;
switch (mode  ~PDO_FETCH_FLAGS) {
case PDO_FETCH_USE_DEFAULT:
case 

[PHP-CVS] cvs: php-src /ext/pdo pdo_stmt.c /ext/pdo_oci/tests bug46274.phpt bug46274_2.phpt /ext/pdo_pgsql pgsql_statement.c /ext/pdo_pgsql/tests bug46274_2.phpt

2009-04-23 Thread Matteo Beccati
mbeccatiThu Apr 23 13:22:12 2009 UTC

  Added files: 
/php-src/ext/pdo_oci/tests  bug46274.phpt bug46274_2.phpt 

  Modified files:  
/php-src/ext/pdopdo_stmt.c 
/php-src/ext/pdo_pgsql  pgsql_statement.c 
/php-src/ext/pdo_pgsql/testsbug46274_2.phpt 
  Log:
  - Reverted previous fix for bug #46274 and properly fixed it
  - Fixed bug #48060
  # Also added tests for pdo_oci as it's the only other driver currently
  # using streams: no regression found
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.221r2=1.222diff_format=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.221 php-src/ext/pdo/pdo_stmt.c:1.222
--- php-src/ext/pdo/pdo_stmt.c:1.221Thu Apr  2 16:40:33 2009
+++ php-src/ext/pdo/pdo_stmt.c  Thu Apr 23 13:22:12 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pdo_stmt.c,v 1.221 2009/04/02 16:40:33 mbeccati Exp $ */
+/* $Id: pdo_stmt.c,v 1.222 2009/04/23 13:22:12 mbeccati Exp $ */
 
 /* The PDO Statement Handle Class */
 
@@ -583,6 +583,7 @@
if (value == NULL) {
ZVAL_NULL(dest);
} else if (value_len == 0) {
+   /* Warning, empty strings need to be passed as 
stream */
if (stmt-dbh-stringify || new_type == 
PDO_PARAM_STR) {
char *buf = NULL;
size_t len;
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_statement.c?r1=1.52r2=1.53diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_statement.c
diff -u php-src/ext/pdo_pgsql/pgsql_statement.c:1.52 
php-src/ext/pdo_pgsql/pgsql_statement.c:1.53
--- php-src/ext/pdo_pgsql/pgsql_statement.c:1.52Sat Mar 28 03:01:38 2009
+++ php-src/ext/pdo_pgsql/pgsql_statement.c Thu Apr 23 13:22:12 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pgsql_statement.c,v 1.52 2009/03/28 03:01:38 mbeccati Exp $ */
+/* $Id: pgsql_statement.c,v 1.53 2009/04/23 13:22:12 mbeccati Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -619,8 +619,14 @@
return 0;
} else {
*ptr = 
php_pdo_pgsql_unescape_bytea(*ptr, tmp_len);
-   *len = tmp_len;
-   *caller_frees = 1;
+   if (!tmp_len) {
+   /* Empty string, return as 
empty stream */
+   *ptr = (char 
*)php_stream_memory_open(TEMP_STREAM_READONLY, , 0);
+   *len = 0;
+   } else {
+   *len = tmp_len;
+   *caller_frees = 1;
+   }
}
break;
case PDO_PARAM_NULL:
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/tests/bug46274_2.phpt?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/pdo_pgsql/tests/bug46274_2.phpt
diff -u php-src/ext/pdo_pgsql/tests/bug46274_2.phpt:1.2 
php-src/ext/pdo_pgsql/tests/bug46274_2.phpt:1.3
--- php-src/ext/pdo_pgsql/tests/bug46274_2.phpt:1.2 Sat Mar 28 02:34:02 2009
+++ php-src/ext/pdo_pgsql/tests/bug46274_2.phpt Thu Apr 23 13:22:12 2009
@@ -47,11 +47,13 @@
 var_dump($x = $res-fetch());
 var_dump(fread($x['blob1'], 10));
 
-// Empty string
+// Resource
 var_dump($res-fetch());
+var_dump(fread($x['blob1'], 10));
 
-// Empty string
+// Resource
 var_dump($res-fetch());
+var_dump(fread($x['blob1'], 10));
 
 // NULL
 var_dump($res-fetch());
@@ -69,16 +71,18 @@
 string(3) foo
 array(2) {
   [blob1]=
-  string(0) 
+  resource(%d) of type (stream)
   [0]=
-  string(0) 
+  resource(%d) of type (stream)
 }
+string(0) 
 array(2) {
   [blob1]=
-  string(0) 
+  resource(%d) of type (stream)
   [0]=
-  string(0) 
+  resource(%d) of type (stream)
 }
+string(0) 
 array(2) {
   [blob1]=
   NULL

http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_oci/tests/bug46274.phpt?view=markuprev=1.1
Index: php-src/ext/pdo_oci/tests/bug46274.phpt
+++ php-src/ext/pdo_oci/tests/bug46274.phpt
--TEST--
Bug #46274 (pdo_pgsql - Segfault when using PDO::ATTR_STRINGIFY_FETCHES and 
blob)
--SKIPIF--
?php
if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) 
die('skip not loaded');
require dirname(__FILE__).'/../../pdo/tests/pdo_test.inc';
PDOTest::skip();
?
--FILE--
?php
require 'ext/pdo/tests/pdo_test.inc';
$db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt');
$db-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

$db-setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);

try 

[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/pdo pdo_stmt.c /ext/pdo_oci/tests bug46274.phpt bug46274_2.phpt /ext/pdo_pgsql pgsql_statement.c /ext/pdo_pgsql/tests bug46274_2.phpt

2009-04-23 Thread Matteo Beccati
mbeccatiThu Apr 23 13:26:10 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/pdo_oci/tests  bug46274.phpt bug46274_2.phpt 

  Modified files:  
/php-srcNEWS 
/php-src/ext/pdopdo_stmt.c 
/php-src/ext/pdo_pgsql  pgsql_statement.c 
/php-src/ext/pdo_pgsql/testsbug46274_2.phpt 
  Log:
  MFH:
  - Reverted previous fix for bug #46274 and properly fixed it
  - Fixed bug #48060
  # Also added tests for pdo_oci as it's the only other driver currently
  # using streams: no regression found
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.566r2=1.2027.2.547.2.965.2.567diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.566 
php-src/NEWS:1.2027.2.547.2.965.2.567
--- php-src/NEWS:1.2027.2.547.2.965.2.566   Tue Apr 21 08:12:07 2009
+++ php-src/NEWSThu Apr 23 13:26:09 2009
@@ -12,6 +12,7 @@
   disable this behaviour using http=array(auto_decode=0) in stream
   context. (Dmitry)
 
+- Fixed bug #48060 (pdo_pgsql - large objects are returned as empty). (Matteo)
 - Fixed bug #48023 (spl_autoload_register didn't store closures). (Etienne)
 - Fixed bug #48004 (Error handler prevents creation of default object).
   (Dmitry)
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.118.2.38.2.24.2.45r2=1.118.2.38.2.24.2.46diff_format=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.24.2.45 
php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.24.2.46
--- php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.24.2.45 Thu Apr  2 16:41:23 2009
+++ php-src/ext/pdo/pdo_stmt.c  Thu Apr 23 13:26:09 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pdo_stmt.c,v 1.118.2.38.2.24.2.45 2009/04/02 16:41:23 mbeccati Exp $ */
+/* $Id: pdo_stmt.c,v 1.118.2.38.2.24.2.46 2009/04/23 13:26:09 mbeccati Exp $ */
 
 /* The PDO Statement Handle Class */
 
@@ -589,9 +589,8 @@
case PDO_PARAM_LOB:
if (value == NULL) {
ZVAL_NULL(dest);
-   } else if (value[0] == '\0') {
-   ZVAL_EMPTY_STRING(dest);
} else if (value_len == 0) {
+   /* Warning, empty strings need to be passed as 
stream */
if (stmt-dbh-stringify || new_type == 
PDO_PARAM_STR) {
char *buf = NULL;
size_t len;
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_statement.c?r1=1.31.2.12.2.7.2.9r2=1.31.2.12.2.7.2.10diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_statement.c
diff -u php-src/ext/pdo_pgsql/pgsql_statement.c:1.31.2.12.2.7.2.9 
php-src/ext/pdo_pgsql/pgsql_statement.c:1.31.2.12.2.7.2.10
--- php-src/ext/pdo_pgsql/pgsql_statement.c:1.31.2.12.2.7.2.9   Sat Mar 28 
02:58:04 2009
+++ php-src/ext/pdo_pgsql/pgsql_statement.c Thu Apr 23 13:26:10 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pgsql_statement.c,v 1.31.2.12.2.7.2.9 2009/03/28 02:58:04 mbeccati Exp 
$ */
+/* $Id: pgsql_statement.c,v 1.31.2.12.2.7.2.10 2009/04/23 13:26:10 mbeccati 
Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -619,8 +619,14 @@
return 0;
} else {
*ptr = 
php_pdo_pgsql_unescape_bytea(*ptr, tmp_len);
-   *len = tmp_len;
-   *caller_frees = 1;
+   if (!tmp_len) {
+   /* Empty string, return as 
empty stream */
+   *ptr = (char 
*)php_stream_memory_open(TEMP_STREAM_READONLY, , 0);
+   *len = 0;
+   } else {
+   *len = tmp_len;
+   *caller_frees = 1;
+   }
}
break;
case PDO_PARAM_NULL:
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/tests/bug46274_2.phpt?r1=1.1.2.1r2=1.1.2.2diff_format=u
Index: php-src/ext/pdo_pgsql/tests/bug46274_2.phpt
diff -u php-src/ext/pdo_pgsql/tests/bug46274_2.phpt:1.1.2.1 
php-src/ext/pdo_pgsql/tests/bug46274_2.phpt:1.1.2.2
--- php-src/ext/pdo_pgsql/tests/bug46274_2.phpt:1.1.2.1 Sun Oct 12 13:01:31 2008
+++ php-src/ext/pdo_pgsql/tests/bug46274_2.phpt Thu Apr 23 13:26:10 2009
@@ -47,11 +47,13 @@
 var_dump($x = $res-fetch());
 var_dump(fread($x['blob1'], 10));
 
-// Empty string
+// Resource
 var_dump($res-fetch());
+var_dump(fread($x['blob1'], 10));
 
-// Empty string
+// Resource
 var_dump($res-fetch());

[PHP-CVS] cvs: php-src /ext/pdo_pgsql config.m4 config.w32 pgsql_driver.c pgsql_statement.c php_pdo_pgsql_int.h

2009-04-30 Thread Matteo Beccati
mbeccatiThu Apr 30 12:35:36 2009 UTC

  Modified files:  
/php-src/ext/pdo_pgsql  config.m4 config.w32 pgsql_driver.c 
pgsql_statement.c php_pdo_pgsql_int.h 
  Log:
  - Changed PDO_PGSQL configure script to require libpq 7.4
  - Cleaned up usage of HAVE_PQ* defines
  - Fixed compiler warnings
  - Removed custom implementation of PQunescapeByte
  # Rationale:
  # - PDO_PGSQL couldn't even compile when using libpq 7.3
  # - PostgreSQL 7.3 is unsupported since a long time
  # - Got consensus from pgsql devs on freenode
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/config.m4?r1=1.21r2=1.22diff_format=u
Index: php-src/ext/pdo_pgsql/config.m4
diff -u php-src/ext/pdo_pgsql/config.m4:1.21 
php-src/ext/pdo_pgsql/config.m4:1.22
--- php-src/ext/pdo_pgsql/config.m4:1.21Sat Mar 28 02:34:02 2009
+++ php-src/ext/pdo_pgsql/config.m4 Thu Apr 30 12:35:36 2009
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.21 2009/03/28 02:34:02 mbeccati Exp $
+dnl $Id: config.m4,v 1.22 2009/04/30 12:35:36 mbeccati Exp $
 dnl config.m4 for extension pdo_pgsql
 dnl vim:et:sw=2:ts=2:
 
@@ -82,23 +82,18 @@
 
   old_LIBS=$LIBS
   old_LDFLAGS=$LDFLAGS
-  LDFLAGS=$LDFLAGS -L$PGSQL_LIBDIR
-  AC_CHECK_LIB(pq, PQescapeString,AC_DEFINE(HAVE_PQESCAPE,1,[PostgreSQL 7.2.0 
or later]))
+  LDFLAGS=-L$PGSQL_LIBDIR $LDFLAGS
+  AC_CHECK_LIB(pq, 
PQparameterStatus,AC_DEFINE(HAVE_PQPARAMETERSTATUS,1,[PostgreSQL 7.4 or 
later]), [
+echo Unable to build the PDO PostgreSQL driver: libpq 7.4+ is required
+exit 1
+  ])
+
+  AC_CHECK_LIB(pq, PQprepare,AC_DEFINE(HAVE_PQPREPARE,1,[PostgreSQL 8.0 or 
later]))
   AC_CHECK_LIB(pq, PQescapeStringConn, 
AC_DEFINE(HAVE_PQESCAPE_CONN,1,[PostgreSQL 8.1.4 or later]))
   AC_CHECK_LIB(pq, PQescapeByteaConn, 
AC_DEFINE(HAVE_PQESCAPE_BYTEA_CONN,1,[PostgreSQL 8.1.4 or later]))
-  AC_CHECK_LIB(pq, 
PQsetnonblocking,AC_DEFINE(HAVE_PQSETNONBLOCKING,1,[PostgreSQL 7.0.x or later]))
-  AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[Broken libpq 
under windows]))
-  AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[Older PostgreSQL]))
-  AC_CHECK_LIB(pq, 
PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[PostgreSQL 7.0.x or later]))
-  AC_CHECK_LIB(pq, 
PQparameterStatus,AC_DEFINE(HAVE_PQPARAMETERSTATUS,1,[PostgreSQL 7.4 or later]))
-  AC_CHECK_LIB(pq, 
PQprotocolVersion,AC_DEFINE(HAVE_PQPROTOCOLVERSION,1,[PostgreSQL 7.4 or later]))
-  AC_CHECK_LIB(pq, 
PQtransactionStatus,AC_DEFINE(HAVE_PGTRANSACTIONSTATUS,1,[PostgreSQL 7.4 or 
later]))
-  AC_CHECK_LIB(pq, 
PQunescapeBytea,AC_DEFINE(HAVE_PQUNESCAPEBYTEA,1,[PostgreSQL 7.4 or later]))
-  AC_CHECK_LIB(pq, PQExecParams,AC_DEFINE(HAVE_PQEXECPARAMS,1,[PostgreSQL 7.4 
or later]))
-  AC_CHECK_LIB(pq, 
PQresultErrorField,AC_DEFINE(HAVE_PQRESULTERRORFIELD,1,[PostgreSQL 7.4 or 
later]))
+
   AC_CHECK_LIB(pq, 
pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether 
libpq is compiled with --enable-multibyte]))
   
-  AC_CHECK_LIB(pq, PQprepare,AC_DEFINE(HAVE_PQPREPARE,1,[prepared statements]))
 
   LIBS=$old_LIBS
   LDFLAGS=$old_LDFLAGS
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/config.w32?r1=1.10r2=1.11diff_format=u
Index: php-src/ext/pdo_pgsql/config.w32
diff -u php-src/ext/pdo_pgsql/config.w32:1.10 
php-src/ext/pdo_pgsql/config.w32:1.11
--- php-src/ext/pdo_pgsql/config.w32:1.10   Wed Apr  1 16:16:20 2009
+++ php-src/ext/pdo_pgsql/config.w32Thu Apr 30 12:35:36 2009
@@ -1,4 +1,4 @@
-// $Id: config.w32,v 1.10 2009/04/01 16:16:20 pajoye Exp $
+// $Id: config.w32,v 1.11 2009/04/30 12:35:36 mbeccati Exp $
 // vim:ft=javascript
 
 ARG_WITH(pdo-pgsql, PostgreSQL support for PDO, no);
@@ -12,8 +12,11 @@
ADD_FLAG('CFLAGS_PDO_PGSQL', /D HAVE_PG_CONFIG_H);
}
 
-   AC_DEFINE('HAVE_PQPREPARE', 1, 'Have PqPrepare');
-   AC_DEFINE('HAVE_PDO_PGSQL', 1, 'Have PostgreSQL library');
+   AC_DEFINE('HAVE_PDO_PGSQL', 1, 'Have PostgreSQL 
library');
+   AC_DEFINE('HAVE_PQESCAPE_BYTEA_CONN',   1, 'Have 
PQescapeByteaConn');
+   AC_DEFINE('HAVE_PQESCAPE_CONN', 1, 'Have PQescapeConn');
+   AC_DEFINE('HAVE_PQEXECPARAMS',  1, 'Have PQexecParams');
+   AC_DEFINE('HAVE_PQPREPARE', 1, 'Have PQprepare');
ADD_FLAG('CFLAGS_PDO_PGSQL', /D HAVE_PQPARAMETERSTATUS=1 /D 
HAVE_PQPROTOCOLVERSION=1 /D HAVE_PGTRANSACTIONSTATUS=1 /D 
HAVE_PQUNESCAPEBYTEA=1 /D HAVE_PQRESULTERRORFIELD=1 /D HAVE_PQESCAPE_CONN=1 /D 
HAVE_PQESCAPE_BYTEA_CONN=1);
ADD_EXTENSION_DEP('pdo_pgsql', 'pdo');
} else {
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.73r2=1.74diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_driver.c
diff -u php-src/ext/pdo_pgsql/pgsql_driver.c:1.73 
php-src/ext/pdo_pgsql/pgsql_driver.c:1.74
--- php-src/ext/pdo_pgsql/pgsql_driver.c:1.73   Wed Apr  1 16:14:50 2009
+++ 

[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_pgsql config.m4 config.w32 pgsql_driver.c pgsql_statement.c php_pdo_pgsql_int.h

2009-04-30 Thread Matteo Beccati
mbeccatiThu Apr 30 12:38:43 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pdo_pgsql  config.m4 config.w32 pgsql_driver.c 
pgsql_statement.c php_pdo_pgsql_int.h 
  Log:
  MFH:
  - Changed PDO_PGSQL configure script to require libpq 7.4
  - Cleaned up usage of HAVE_PQ* defines
  - Fixed compiler warnings
  - Removed custom implementation of PQunescapeByte
  # Rationale:
  # - PDO_PGSQL couldn't even compile when using libpq 7.3
  # - PostgreSQL 7.3 is unsupported since a long time
  # - Got consensus from pgsql devs on freenode
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/config.m4?r1=1.13.4.6.2.1r2=1.13.4.6.2.2diff_format=u
Index: php-src/ext/pdo_pgsql/config.m4
diff -u php-src/ext/pdo_pgsql/config.m4:1.13.4.6.2.1 
php-src/ext/pdo_pgsql/config.m4:1.13.4.6.2.2
--- php-src/ext/pdo_pgsql/config.m4:1.13.4.6.2.1Fri Jul 25 13:46:24 2008
+++ php-src/ext/pdo_pgsql/config.m4 Thu Apr 30 12:38:43 2009
@@ -1,4 +1,4 @@
-dnl $Id: config.m4,v 1.13.4.6.2.1 2008/07/25 13:46:24 jani Exp $
+dnl $Id: config.m4,v 1.13.4.6.2.2 2009/04/30 12:38:43 mbeccati Exp $
 dnl config.m4 for extension pdo_pgsql
 dnl vim:et:sw=2:ts=2:
 
@@ -82,23 +82,18 @@
 
   old_LIBS=$LIBS
   old_LDFLAGS=$LDFLAGS
-  LDFLAGS=$LDFLAGS -L$PGSQL_LIBDIR
-  AC_CHECK_LIB(pq, PQescapeString,AC_DEFINE(HAVE_PQESCAPE,1,[PostgreSQL 7.2.0 
or later]))
+  LDFLAGS=-L$PGSQL_LIBDIR $LDFLAGS
+  AC_CHECK_LIB(pq, 
PQparameterStatus,AC_DEFINE(HAVE_PQPARAMETERSTATUS,1,[PostgreSQL 7.4 or 
later]), [
+echo Unable to build the PDO PostgreSQL driver: libpq 7.4+ is required
+exit 1
+  ])
+
+  AC_CHECK_LIB(pq, PQprepare,AC_DEFINE(HAVE_PQPREPARE,1,[PostgreSQL 8.0 or 
later]))
   AC_CHECK_LIB(pq, PQescapeStringConn, 
AC_DEFINE(HAVE_PQESCAPE_CONN,1,[PostgreSQL 8.1.4 or later]))
   AC_CHECK_LIB(pq, PQescapeByteaConn, 
AC_DEFINE(HAVE_PQESCAPE_BYTEA_CONN,1,[PostgreSQL 8.1.4 or later]))
-  AC_CHECK_LIB(pq, 
PQsetnonblocking,AC_DEFINE(HAVE_PQSETNONBLOCKING,1,[PostgreSQL 7.0.x or later]))
-  AC_CHECK_LIB(pq, PQcmdTuples,AC_DEFINE(HAVE_PQCMDTUPLES,1,[Broken libpq 
under windows]))
-  AC_CHECK_LIB(pq, PQoidValue,AC_DEFINE(HAVE_PQOIDVALUE,1,[Older PostgreSQL]))
-  AC_CHECK_LIB(pq, 
PQclientEncoding,AC_DEFINE(HAVE_PQCLIENTENCODING,1,[PostgreSQL 7.0.x or later]))
-  AC_CHECK_LIB(pq, 
PQparameterStatus,AC_DEFINE(HAVE_PQPARAMETERSTATUS,1,[PostgreSQL 7.4 or later]))
-  AC_CHECK_LIB(pq, 
PQprotocolVersion,AC_DEFINE(HAVE_PQPROTOCOLVERSION,1,[PostgreSQL 7.4 or later]))
-  AC_CHECK_LIB(pq, 
PQtransactionStatus,AC_DEFINE(HAVE_PGTRANSACTIONSTATUS,1,[PostgreSQL 7.4 or 
later]))
-  AC_CHECK_LIB(pq, 
PQunescapeBytea,AC_DEFINE(HAVE_PQUNESCAPEBYTEA,1,[PostgreSQL 7.4 or later]))
-  AC_CHECK_LIB(pq, PQExecParams,AC_DEFINE(HAVE_PQEXECPARAMS,1,[PostgreSQL 7.4 
or later]))
-  AC_CHECK_LIB(pq, 
PQresultErrorField,AC_DEFINE(HAVE_PQRESULTERRORFIELD,1,[PostgreSQL 7.4 or 
later]))
+
   AC_CHECK_LIB(pq, 
pg_encoding_to_char,AC_DEFINE(HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT,1,[Whether 
libpq is compiled with --enable-multibyte]))
   
-  AC_CHECK_LIB(pq, PQprepare,AC_DEFINE(HAVE_PQPREPARE,1,[prepared statements]))
 
   LIBS=$old_LIBS
   LDFLAGS=$old_LDFLAGS
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/config.w32?r1=1.4.2.1.2.3.2.3r2=1.4.2.1.2.3.2.4diff_format=u
Index: php-src/ext/pdo_pgsql/config.w32
diff -u php-src/ext/pdo_pgsql/config.w32:1.4.2.1.2.3.2.3 
php-src/ext/pdo_pgsql/config.w32:1.4.2.1.2.3.2.4
--- php-src/ext/pdo_pgsql/config.w32:1.4.2.1.2.3.2.3Wed Apr  1 16:16:49 2009
+++ php-src/ext/pdo_pgsql/config.w32Thu Apr 30 12:38:43 2009
@@ -1,4 +1,4 @@
-// $Id: config.w32,v 1.4.2.1.2.3.2.3 2009/04/01 16:16:49 pajoye Exp $
+// $Id: config.w32,v 1.4.2.1.2.3.2.4 2009/04/30 12:38:43 mbeccati Exp $
 // vim:ft=javascript
 
 ARG_WITH(pdo-pgsql, PostgreSQL support for PDO, no);
@@ -12,8 +12,11 @@
ADD_FLAG('CFLAGS_PDO_PGSQL', /D HAVE_PG_CONFIG_H);
}
 
-   AC_DEFINE('HAVE_PQPREPARE', 1, 'Have PqPrepare');
-   AC_DEFINE('HAVE_PDO_PGSQL', 1, 'Have PostgreSQL library');
+   AC_DEFINE('HAVE_PDO_PGSQL', 1, 'Have PostgreSQL 
library');
+   AC_DEFINE('HAVE_PQESCAPE_BYTEA_CONN',   1, 'Have 
PQescapeByteaConn');
+   AC_DEFINE('HAVE_PQESCAPE_CONN', 1, 'Have PQescapeConn');
+   AC_DEFINE('HAVE_PQEXECPARAMS',  1, 'Have PQexecParams');
+   AC_DEFINE('HAVE_PQPREPARE', 1, 'Have PQprepare');
ADD_FLAG('CFLAGS_PDO_PGSQL', /D HAVE_PQPARAMETERSTATUS=1 /D 
HAVE_PQPROTOCOLVERSION=1 /D HAVE_PGTRANSACTIONSTATUS=1 /D 
HAVE_PQUNESCAPEBYTEA=1 /D HAVE_PQRESULTERRORFIELD=1 /D HAVE_PQESCAPE_CONN=1 /D 
HAVE_PQESCAPE_BYTEA_CONN=1);
ADD_EXTENSION_DEP('pdo_pgsql', 'pdo');
} else {
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.53.2.14.2.9.2.6r2=1.53.2.14.2.9.2.7diff_format=u
Index: 

[PHP-CVS] cvs: php-src /ext/pdo_pgsql config.w32 pgsql_driver.c

2009-04-30 Thread Matteo Beccati
mbeccatiThu Apr 30 12:55:43 2009 UTC

  Modified files:  
/php-src/ext/pdo_pgsql  config.w32 pgsql_driver.c 
  Log:
  - Removed HAVE_PQEXECPARAMS which was left out during the previous commit
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/config.w32?r1=1.11r2=1.12diff_format=u
Index: php-src/ext/pdo_pgsql/config.w32
diff -u php-src/ext/pdo_pgsql/config.w32:1.11 
php-src/ext/pdo_pgsql/config.w32:1.12
--- php-src/ext/pdo_pgsql/config.w32:1.11   Thu Apr 30 12:35:36 2009
+++ php-src/ext/pdo_pgsql/config.w32Thu Apr 30 12:55:43 2009
@@ -1,4 +1,4 @@
-// $Id: config.w32,v 1.11 2009/04/30 12:35:36 mbeccati Exp $
+// $Id: config.w32,v 1.12 2009/04/30 12:55:43 mbeccati Exp $
 // vim:ft=javascript
 
 ARG_WITH(pdo-pgsql, PostgreSQL support for PDO, no);
@@ -15,7 +15,6 @@
AC_DEFINE('HAVE_PDO_PGSQL', 1, 'Have PostgreSQL 
library');
AC_DEFINE('HAVE_PQESCAPE_BYTEA_CONN',   1, 'Have 
PQescapeByteaConn');
AC_DEFINE('HAVE_PQESCAPE_CONN', 1, 'Have PQescapeConn');
-   AC_DEFINE('HAVE_PQEXECPARAMS',  1, 'Have PQexecParams');
AC_DEFINE('HAVE_PQPREPARE', 1, 'Have PQprepare');
ADD_FLAG('CFLAGS_PDO_PGSQL', /D HAVE_PQPARAMETERSTATUS=1 /D 
HAVE_PQPROTOCOLVERSION=1 /D HAVE_PGTRANSACTIONSTATUS=1 /D 
HAVE_PQUNESCAPEBYTEA=1 /D HAVE_PQRESULTERRORFIELD=1 /D HAVE_PQESCAPE_CONN=1 /D 
HAVE_PQESCAPE_BYTEA_CONN=1);
ADD_EXTENSION_DEP('pdo_pgsql', 'pdo');
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.74r2=1.75diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_driver.c
diff -u php-src/ext/pdo_pgsql/pgsql_driver.c:1.74 
php-src/ext/pdo_pgsql/pgsql_driver.c:1.75
--- php-src/ext/pdo_pgsql/pgsql_driver.c:1.74   Thu Apr 30 12:35:36 2009
+++ php-src/ext/pdo_pgsql/pgsql_driver.cThu Apr 30 12:55:43 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pgsql_driver.c,v 1.74 2009/04/30 12:35:36 mbeccati Exp $ */
+/* $Id: pgsql_driver.c,v 1.75 2009/04/30 12:55:43 mbeccati Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -356,25 +356,9 @@
} else {
PGresult *res;
ExecStatusType status;
-#ifdef HAVE_PQEXECPARAMS
const char *q[1];
q[0] = name;
res = PQexecParams(H-server, SELECT CURRVAL($1), 1, NULL, q, 
NULL, NULL, 0);
-#else
-   char *name_escaped, *q;
-   size_t l = strlen(name);
-
-   name_escaped = safe_emalloc(l, 2, 1);
-#ifndef HAVE_PQESCAPE_CONN
-   PQescapeString(name_escaped, name, l);
-#else
-   PQescapeStringConn(H-server, name_escaped, name, l, NULL);
-#endif
-   spprintf(q, 0, SELECT CURRVAL('%s'), name_escaped);
-   res = PQexec(H-server, q);
-   efree(name_escaped); 
-   efree(q);
-#endif
status = PQresultStatus(res);
 
if (res  (status == PGRES_TUPLES_OK)) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_pgsql config.w32 pgsql_driver.c

2009-04-30 Thread Matteo Beccati
mbeccatiThu Apr 30 12:56:00 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pdo_pgsql  config.w32 pgsql_driver.c 
  Log:
  MFH:
  - Removed HAVE_PQEXECPARAMS which was left out during the previous commit
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/config.w32?r1=1.4.2.1.2.3.2.4r2=1.4.2.1.2.3.2.5diff_format=u
Index: php-src/ext/pdo_pgsql/config.w32
diff -u php-src/ext/pdo_pgsql/config.w32:1.4.2.1.2.3.2.4 
php-src/ext/pdo_pgsql/config.w32:1.4.2.1.2.3.2.5
--- php-src/ext/pdo_pgsql/config.w32:1.4.2.1.2.3.2.4Thu Apr 30 12:38:43 2009
+++ php-src/ext/pdo_pgsql/config.w32Thu Apr 30 12:56:00 2009
@@ -1,4 +1,4 @@
-// $Id: config.w32,v 1.4.2.1.2.3.2.4 2009/04/30 12:38:43 mbeccati Exp $
+// $Id: config.w32,v 1.4.2.1.2.3.2.5 2009/04/30 12:56:00 mbeccati Exp $
 // vim:ft=javascript
 
 ARG_WITH(pdo-pgsql, PostgreSQL support for PDO, no);
@@ -15,7 +15,6 @@
AC_DEFINE('HAVE_PDO_PGSQL', 1, 'Have PostgreSQL 
library');
AC_DEFINE('HAVE_PQESCAPE_BYTEA_CONN',   1, 'Have 
PQescapeByteaConn');
AC_DEFINE('HAVE_PQESCAPE_CONN', 1, 'Have PQescapeConn');
-   AC_DEFINE('HAVE_PQEXECPARAMS',  1, 'Have PQexecParams');
AC_DEFINE('HAVE_PQPREPARE', 1, 'Have PQprepare');
ADD_FLAG('CFLAGS_PDO_PGSQL', /D HAVE_PQPARAMETERSTATUS=1 /D 
HAVE_PQPROTOCOLVERSION=1 /D HAVE_PGTRANSACTIONSTATUS=1 /D 
HAVE_PQUNESCAPEBYTEA=1 /D HAVE_PQRESULTERRORFIELD=1 /D HAVE_PQESCAPE_CONN=1 /D 
HAVE_PQESCAPE_BYTEA_CONN=1);
ADD_EXTENSION_DEP('pdo_pgsql', 'pdo');
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_driver.c?r1=1.53.2.14.2.9.2.7r2=1.53.2.14.2.9.2.8diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_driver.c
diff -u php-src/ext/pdo_pgsql/pgsql_driver.c:1.53.2.14.2.9.2.7 
php-src/ext/pdo_pgsql/pgsql_driver.c:1.53.2.14.2.9.2.8
--- php-src/ext/pdo_pgsql/pgsql_driver.c:1.53.2.14.2.9.2.7  Thu Apr 30 
12:38:43 2009
+++ php-src/ext/pdo_pgsql/pgsql_driver.cThu Apr 30 12:56:00 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pgsql_driver.c,v 1.53.2.14.2.9.2.7 2009/04/30 12:38:43 mbeccati Exp $ 
*/
+/* $Id: pgsql_driver.c,v 1.53.2.14.2.9.2.8 2009/04/30 12:56:00 mbeccati Exp $ 
*/
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -356,25 +356,9 @@
} else {
PGresult *res;
ExecStatusType status;
-#ifdef HAVE_PQEXECPARAMS
const char *q[1];
q[0] = name;
res = PQexecParams(H-server, SELECT CURRVAL($1), 1, NULL, q, 
NULL, NULL, 0);
-#else
-   char *name_escaped, *q;
-   size_t l = strlen(name);
-
-   name_escaped = safe_emalloc(l, 2, 1);
-#ifndef HAVE_PQESCAPE_CONN
-   PQescapeString(name_escaped, name, l);
-#else
-   PQescapeStringConn(H-server, name_escaped, name, l, NULL);
-#endif
-   spprintf(q, 0, SELECT CURRVAL('%s'), name_escaped);
-   res = PQexec(H-server, q);
-   efree(name_escaped); 
-   efree(q);
-#endif
status = PQresultStatus(res);
 
if (res  (status == PGRES_TUPLES_OK)) {



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/sqlite3 sqlite3.c

2009-05-07 Thread Matteo Beccati
Hi Scott,

 scottmac  Thu May  7 16:49:27 2009 UTC
 
   Modified files:  (Branch: PHP_5_3)
 /php-src/ext/sqlite3  sqlite3.c 
   Log:
   Print warning when using loadExtension on non cli, cgi and embeded

Just did a cvs up of my local PHP_5_3 copy and got a compile failure:

/root/compile/php-5.3/ext/sqlite3/sqlite3.c:312: error: `sapi_module'
undeclared

Adding an #include SAPI.h as suggested by Philip on IRC fixed the issue.


Cheers
--
M.

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/pdo_sqlite sqlite_statement.c

2009-05-07 Thread Matteo Beccati
mbeccatiThu May  7 23:04:02 2009 UTC

  Modified files:  
/php-src/ext/pdo_sqlite sqlite_statement.c 
  Log:
  - Fixed bug #48185 removing no-op code
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/sqlite_statement.c?r1=1.31r2=1.32diff_format=u
Index: php-src/ext/pdo_sqlite/sqlite_statement.c
diff -u php-src/ext/pdo_sqlite/sqlite_statement.c:1.31 
php-src/ext/pdo_sqlite/sqlite_statement.c:1.32
--- php-src/ext/pdo_sqlite/sqlite_statement.c:1.31  Wed Apr  1 14:34:21 2009
+++ php-src/ext/pdo_sqlite/sqlite_statement.c   Thu May  7 23:04:02 2009
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: sqlite_statement.c,v 1.31 2009/04/01 14:34:21 indeyets Exp $ */
+/* $Id: sqlite_statement.c,v 1.32 2009/05/07 23:04:02 mbeccati Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -265,11 +265,6 @@
case SQLITE3_TEXT:
*ptr = (char*)sqlite3_column_text(S-stmt, colno);
*len = sqlite3_column_bytes(S-stmt, colno);
-   if (*len) {
-   /* sqlite3.h says the NUL terminator is 
included in the byte count
-* for TEXT values */
-   *len--;
-   }
return 1;

default:



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src /ext/pdo_sqlite sqlite_statement.c

2009-05-07 Thread Matteo Beccati
Ilia Alshanetsky ha scritto:
 That's not a NOP code, it actually needed, the length is a pointer to an
 integer that is being modified.

Shouldn't it be (*len)-- in that case?


Cheers
--
M.

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/pdo_sqlite sqlite_statement.c

2009-05-07 Thread Matteo Beccati
mbeccatiThu May  7 23:29:55 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pdo_sqlite sqlite_statement.c 
/php-srcNEWS 
  Log:
  MFH
  - Fixed bug #48185 removing no-op code
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/sqlite_statement.c?r1=1.18.2.4.2.3.2.6r2=1.18.2.4.2.3.2.7diff_format=u
Index: php-src/ext/pdo_sqlite/sqlite_statement.c
diff -u php-src/ext/pdo_sqlite/sqlite_statement.c:1.18.2.4.2.3.2.6 
php-src/ext/pdo_sqlite/sqlite_statement.c:1.18.2.4.2.3.2.7
--- php-src/ext/pdo_sqlite/sqlite_statement.c:1.18.2.4.2.3.2.6  Wed Apr  1 
14:35:24 2009
+++ php-src/ext/pdo_sqlite/sqlite_statement.c   Thu May  7 23:29:54 2009
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: sqlite_statement.c,v 1.18.2.4.2.3.2.6 2009/04/01 14:35:24 indeyets Exp 
$ */
+/* $Id: sqlite_statement.c,v 1.18.2.4.2.3.2.7 2009/05/07 23:29:54 mbeccati Exp 
$ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -265,11 +265,6 @@
case SQLITE3_TEXT:
*ptr = (char*)sqlite3_column_text(S-stmt, colno);
*len = sqlite3_column_bytes(S-stmt, colno);
-   if (*len) {
-   /* sqlite3.h says the NUL terminator is 
included in the byte count
-* for TEXT values */
-   *len--;
-   }
return 1;

default:
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.590r2=1.2027.2.547.2.965.2.591diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.590 
php-src/NEWS:1.2027.2.547.2.965.2.591
--- php-src/NEWS:1.2027.2.547.2.965.2.590   Thu May  7 16:56:18 2009
+++ php-src/NEWSThu May  7 23:29:54 2009
@@ -33,6 +33,8 @@
 - Added ability to throw exceptions from SQLite3 instead of warnings. (Scott)
 - Added startup notices for deprecated ini settings. (Kalle)
 
+- Fixed bug #48185 (warning: value computed is not used in
+  pdo_sqlite_stmt_get_col line 271). (Matteo)
 - Fixed bug #48087 (call_user_method() invalid free of arguments). (Felipe)
 - Fixed bug #48060 (pdo_pgsql - large objects are returned as empty). (Matteo)
 - Fixed bug #48034 (PHP crashes when script is 8192 (8KB) bytes long). (Dmitry)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/pdo_sqlite sqlite_statement.c

2009-05-08 Thread Matteo Beccati
Antony Dovgal ha scritto:
 On 08.05.2009 03:29, Matteo Beccati wrote:
  #ifdef HAVE_CONFIG_H
  #include config.h
 @@ -265,11 +265,6 @@
  case SQLITE3_TEXT:
  *ptr = (char*)sqlite3_column_text(S-stmt, colno);
  *len = sqlite3_column_bytes(S-stmt, colno);
 -if (*len) {
 -/* sqlite3.h says the NUL terminator is 
 included in the byte count
 - * for TEXT values */
 -*len--;
 -}
  return 1;
 
 It doesn't look like no-op to me, but it's not clear what's being decremented.
 I'd say it should do (*len)-- if the comment in sqlite3.h is correct.

By no-op I meant that it's not doing anything in a broader context,
i.e. it's not decreasing the length integer used by the caller function.

I've been pointed to the compiler warning (see bug topic of
http://bugs.php.net/bug.php?id=48185) and propery fixed it. When I ran
the test suite lots of test cases were failing because the output was
truncated.

I think that this by itself is the proof that sqlite3_column_bytes() is
not including the NULL terminator. To be sure I've also checked
sqlite3.h and couldn't find any reference to that behaviour.

The comment is wrong and the code is not doing what the comment tells,
so I thought that a clean up was required, both for consistency and to
fix the compiler warning.


Cheers
--
M.

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/pdo_oci oci_driver.c oci_statement.c package.xml package2.xml pdo_oci.c php_pdo_oci.h php_pdo_oci_int.h /ext/pdo_oci/tests bug41996.phpt bug_33707.phpt pdo_oci_attr_case.p

2009-05-12 Thread Matteo Beccati
mbeccatiTue May 12 21:35:22 2009 UTC

  Removed files:   
/php-src/ext/pdo_ocipackage.xml 

  Modified files:  
/php-src/ext/pdo_ocipackage2.xml oci_driver.c oci_statement.c 
pdo_oci.c php_pdo_oci.h php_pdo_oci_int.h 
/php-src/ext/pdo_oci/tests  bug_33707.phpt bug41996.phpt 
pdo_oci_attr_case.phpt 
pdo_oci_attr_client.phpt 
pdo_oci_attr_drivername.phpt 
pdo_oci_attr_nulls_1.phpt 
pdo_oci_attr_server.phpt 
pdo_oci_quote1.phpt pecl_bug_6364.phpt 
  Log:
  MFB
  - Updated PDO_OCI to the latest version (from PHP_5_3 branch)
  # This commit reverts some changes to the tests. Given the very high
  # failure ratio of the current tests on HEAD I'm not going to fix them
  # now. Keeping ext/pdo_oci in sync with 5.3 will be much more helpful when
  # merging. The effort to fix the tests can start when 5.3 is out.
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_oci/package2.xml?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/pdo_oci/package2.xml
diff -u /dev/null php-src/ext/pdo_oci/package2.xml:1.2
--- /dev/null   Tue May 12 21:35:21 2009
+++ php-src/ext/pdo_oci/package2.xmlTue May 12 21:35:20 2009
@@ -0,0 +1,72 @@
+?xml version=1.0 encoding=UTF-8?
+package packagerversion=1.4.2 version=2.0 
xmlns=http://pear.php.net/dtd/package-2.0; 
xmlns:tasks=http://pear.php.net/dtd/tasks-1.0; 
xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; 
xsi:schemaLocation=http://pear.php.net/dtd/tasks-1.0
+http://pear.php.net/dtd/tasks-1.0.xsd
+http://pear.php.net/dtd/package-2.0
+http://pear.php.net/dtd/package-2.0.xsd;
+ namePDO_OCI/name
+ channelpecl.php.net/channel
+ summaryOracle Call Interface driver for PDO/summary
+ descriptionThis extension provides an Oracle driver for PDO.
+ /description
+ lead
+  nameWez Furlong/name
+  userwez/user
+  emailw...@php.net/email
+  activeyes/active
+ /lead
+ date2006-05-01/date
+ version
+  release1.0.1/release
+  api1.0.1/api
+ /version
+ stability
+  releasestable/release
+  apistable/api
+ /stability
+ license uri=http://www.php.net/license;PHP/license
+ notes
+- Added support for BINARY_DOUBLE and BINARY_FLOAT to PDO_OCI and OCI8
+  (also fixes bug #36764). (Tony)
+- Fixed bug #35907 (PDO_OCI uses hardcoded lib path $ORACLE_HOME/lib). (Tony)
+- Repackage with package2.xml
+- Improved handling of long columns
+- Fixed PECL Bug #5722; implemented LOB support.
+
+You require Oracle OCI 8 or higher client libraries (instantclient is also
+supported) installed on the machine where you intend to build and/or use this
+package.
+   
+If you are running on windows, you can download the binary from here:
+http://pecl4win.php.net/ext.php/php_pdo_oci.dll
+ /notes
+ contents
+  dir name=/
+   file name=config.m4 role=src /
+   file name=config.w32 role=src /
+   file name=CREDITS role=doc /
+   file name=oci_driver.c role=src /
+   file name=oci_statement.c role=src /
+   file name=pdo_oci.c role=src /
+   file name=php_pdo_oci.h role=src /
+   file name=php_pdo_oci_int.h role=src /
+  /dir !-- / --
+ /contents
+ dependencies
+  required
+   php
+min5.0.3/min
+   /php
+   pearinstaller
+min1.4.0/min
+   /pearinstaller
+   package
+namepdo/name
+channelpecl.php.net/channel
+min1.0.3/min
+providesextensionPDO/providesextension
+   /package
+  /required
+ /dependencies
+ providesextensionPDO_OCI/providesextension
+ extsrcrelease /
+/package
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_oci/oci_driver.c?r1=1.39r2=1.40diff_format=u
Index: php-src/ext/pdo_oci/oci_driver.c
diff -u php-src/ext/pdo_oci/oci_driver.c:1.39 
php-src/ext/pdo_oci/oci_driver.c:1.40
--- php-src/ext/pdo_oci/oci_driver.c:1.39   Tue Mar 10 23:39:28 2009
+++ php-src/ext/pdo_oci/oci_driver.cTue May 12 21:35:20 2009
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: oci_driver.c,v 1.39 2009/03/10 23:39:28 helly Exp $ */
+/* $Id: oci_driver.c,v 1.40 2009/05/12 21:35:20 mbeccati Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -65,7 +65,7 @@
pdo_oci_error_info *einfo;
pdo_oci_stmt *S = NULL;
pdo_error_type *pdo_err = dbh-error_code;
-   
+
if (stmt) {
S = (pdo_oci_stmt*)stmt-driver_data;
einfo = S-einfo;
@@ -80,12 +80,12 @@
pefree(einfo-errmsg, dbh-is_persistent);
}
}
-   
+
einfo-errmsg = NULL;
einfo-errcode = 0;
einfo-file = file;
einfo-line = line;
-   
+
if (isinit) { /* Initialization error */
strcpy(*pdo_err, HY000);
slprintf(tmp_buf, sizeof(tmp_buf), %s (%s:%d), what, file, 
line);
@@ -98,45 +98,52 @@
break;
  

[PHP-CVS] cvs: php-src /ext/pdo_oci oci_driver.c

2009-05-12 Thread Matteo Beccati
mbeccatiTue May 12 21:52:55 2009 UTC

  Modified files:  
/php-src/ext/pdo_ocioci_driver.c 
  Log:
  - Fixed bug #48070
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_oci/oci_driver.c?r1=1.40r2=1.41diff_format=u
Index: php-src/ext/pdo_oci/oci_driver.c
diff -u php-src/ext/pdo_oci/oci_driver.c:1.40 
php-src/ext/pdo_oci/oci_driver.c:1.41
--- php-src/ext/pdo_oci/oci_driver.c:1.40   Tue May 12 21:35:20 2009
+++ php-src/ext/pdo_oci/oci_driver.cTue May 12 21:52:54 2009
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: oci_driver.c,v 1.40 2009/05/12 21:35:20 mbeccati Exp $ */
+/* $Id: oci_driver.c,v 1.41 2009/05/12 21:52:54 mbeccati Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -70,15 +70,13 @@
S = (pdo_oci_stmt*)stmt-driver_data;
einfo = S-einfo;
pdo_err = stmt-error_code;
-   if (einfo-errmsg) {
-   efree(einfo-errmsg);
-   }
}
else {
einfo = H-einfo;
-   if (einfo-errmsg) {
-   pefree(einfo-errmsg, dbh-is_persistent);
-   }
+   }
+
+   if (einfo-errmsg) {
+   pefree(einfo-errmsg, dbh-is_persistent);
}
 
einfo-errmsg = NULL;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_oci oci_driver.c

2009-05-12 Thread Matteo Beccati
mbeccatiTue May 12 21:53:19 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/pdo_ocioci_driver.c 
  Log:
  MFH
  - Fixed bug #48070
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_oci/oci_driver.c?r1=1.24.2.4.2.7.2.4r2=1.24.2.4.2.7.2.5diff_format=u
Index: php-src/ext/pdo_oci/oci_driver.c
diff -u php-src/ext/pdo_oci/oci_driver.c:1.24.2.4.2.7.2.4 
php-src/ext/pdo_oci/oci_driver.c:1.24.2.4.2.7.2.5
--- php-src/ext/pdo_oci/oci_driver.c:1.24.2.4.2.7.2.4   Wed Dec 31 11:15:41 2008
+++ php-src/ext/pdo_oci/oci_driver.cTue May 12 21:53:18 2009
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: oci_driver.c,v 1.24.2.4.2.7.2.4 2008/12/31 11:15:41 sebastian Exp $ */
+/* $Id: oci_driver.c,v 1.24.2.4.2.7.2.5 2009/05/12 21:53:18 mbeccati Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -70,15 +70,13 @@
S = (pdo_oci_stmt*)stmt-driver_data;
einfo = S-einfo;
pdo_err = stmt-error_code;
-   if (einfo-errmsg) {
-   efree(einfo-errmsg);
-   }
}
else {
einfo = H-einfo;
-   if (einfo-errmsg) {
-   pefree(einfo-errmsg, dbh-is_persistent);
-   }
+   }
+
+   if (einfo-errmsg) {
+   pefree(einfo-errmsg, dbh-is_persistent);
}
 
einfo-errmsg = NULL;



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS /ext/pdo_oci oci_driver.c oci_statement.c /ext/pdo_oci/tests bug44301.phpt

2009-05-12 Thread Matteo Beccati
mbeccatiTue May 12 21:57:42 2009 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/pdo_oci/tests  bug44301.phpt 

  Modified files:  
/php-srcNEWS 
/php-src/ext/pdo_ocioci_driver.c oci_statement.c 
  Log:
  MFH
  - Backported fix for #44301
  - Fixed bug #48070
  # The backport was required to also fix #48070
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1499r2=1.2027.2.547.2.1500diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1499 php-src/NEWS:1.2027.2.547.2.1500
--- php-src/NEWS:1.2027.2.547.2.1499Tue May 12 12:35:45 2009
+++ php-src/NEWSTue May 12 21:57:40 2009
@@ -23,6 +23,8 @@
   bindto). (Ilia)
 - Fixed bug #48132 (configure check for curl ssl support fails with
   --disable-rpath). (Jani)
+- Fixed bug #48070 (PDO_OCI: Segfault when using persistent connection).
+  (Pierre, Matteo)
 - Fixed bug #48058 (Year formatter goes wrong with out-of-int range). (Derick)
 - Fixed bug #48038 (odbc_execute changes variables used to form params array).
   (Felipe)
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_oci/oci_driver.c?r1=1.24.2.4.2.11r2=1.24.2.4.2.12diff_format=u
Index: php-src/ext/pdo_oci/oci_driver.c
diff -u php-src/ext/pdo_oci/oci_driver.c:1.24.2.4.2.11 
php-src/ext/pdo_oci/oci_driver.c:1.24.2.4.2.12
--- php-src/ext/pdo_oci/oci_driver.c:1.24.2.4.2.11  Wed Dec 31 11:17:42 2008
+++ php-src/ext/pdo_oci/oci_driver.cTue May 12 21:57:40 2009
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: oci_driver.c,v 1.24.2.4.2.11 2008/12/31 11:17:42 sebastian Exp $ */
+/* $Id: oci_driver.c,v 1.24.2.4.2.12 2009/05/12 21:57:40 mbeccati Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -70,15 +70,13 @@
S = (pdo_oci_stmt*)stmt-driver_data;
einfo = S-einfo;
pdo_err = stmt-error_code;
-   if (einfo-errmsg) {
-   efree(einfo-errmsg);
-   }
}
else {
einfo = H-einfo;
-   if (einfo-errmsg) {
-   pefree(einfo-errmsg, dbh-is_persistent);
-   }
+   }
+
+   if (einfo-errmsg) {
+   pefree(einfo-errmsg, dbh-is_persistent);
}
 
einfo-errmsg = NULL;
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_oci/oci_statement.c?r1=1.16.2.10.2.9r2=1.16.2.10.2.10diff_format=u
Index: php-src/ext/pdo_oci/oci_statement.c
diff -u php-src/ext/pdo_oci/oci_statement.c:1.16.2.10.2.9 
php-src/ext/pdo_oci/oci_statement.c:1.16.2.10.2.10
--- php-src/ext/pdo_oci/oci_statement.c:1.16.2.10.2.9   Wed Dec 31 11:17:42 2008
+++ php-src/ext/pdo_oci/oci_statement.c Tue May 12 21:57:41 2009
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: oci_statement.c,v 1.16.2.10.2.9 2008/12/31 11:17:42 sebastian Exp $ */
+/* $Id: oci_statement.c,v 1.16.2.10.2.10 2009/05/12 21:57:41 mbeccati Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -87,7 +87,7 @@
}
 
if (S-einfo.errmsg) {
-   efree(S-einfo.errmsg);
+   pefree(S-einfo.errmsg, stmt-dbh-is_persistent);
S-einfo.errmsg = NULL;
}
 

http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_oci/tests/bug44301.phpt?view=markuprev=1.1
Index: php-src/ext/pdo_oci/tests/bug44301.phpt
+++ php-src/ext/pdo_oci/tests/bug44301.phpt
--TEST--
PDO OCI Bug #44301 (Segfault when an exception is thrown on persistent 
connections)
--SKIPIF--
?php
if (!extension_loaded('pdo') || !extension_loaded('pdo_oci')) die('skip not 
loaded');
require dirname(__FILE__).'/../../pdo/tests/pdo_test.inc';
PDOTest::skip();
?
--FILE--
?php
putenv(PDO_OCI_TEST_ATTR= . serialize(array(PDO::ATTR_PERSISTENT = true)));
require 'ext/pdo/tests/pdo_test.inc';
$db = PDOTest::test_factory('ext/pdo_oci/tests/common.phpt');
$db-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

try {
$stmt = $db-prepare('SELECT * FROM no_table');
$stmt-execute();
} catch (PDOException $e) {
print $e-getMessage();
}
$db = null;
--EXPECTF--
SQLSTATE[HY000]: General error: 942 OCIStmtExecute: ORA-00942: table or view 
does not exist
 (%s/ext/pdo_oci/oci_statement.c:%d)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_2) / NEWS

2009-05-12 Thread Matteo Beccati
mbeccatiTue May 12 22:01:57 2009 UTC

  Modified files:  (Branch: PHP_5_2)
/php-srcNEWS 
  Log:
  Added proper credits for the last commit
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1500r2=1.2027.2.547.2.1501diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1500 php-src/NEWS:1.2027.2.547.2.1501
--- php-src/NEWS:1.2027.2.547.2.1500Tue May 12 21:57:40 2009
+++ php-src/NEWSTue May 12 22:01:55 2009
@@ -24,7 +24,7 @@
 - Fixed bug #48132 (configure check for curl ssl support fails with
   --disable-rpath). (Jani)
 - Fixed bug #48070 (PDO_OCI: Segfault when using persistent connection).
-  (Pierre, Matteo)
+  (Pierre, Matteo, jarismar dot php at gmail dot com)
 - Fixed bug #48058 (Year formatter goes wrong with out-of-int range). (Derick)
 - Fixed bug #48038 (odbc_execute changes variables used to form params array).
   (Felipe)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/pdo_pgsql pgsql_statement.c php_pdo_pgsql_int.h /ext/pdo_pgsql/tests bug44861.phpt

2009-05-12 Thread Matteo Beccati
mbeccatiTue May 12 22:17:50 2009 UTC

  Modified files:  
/php-src/ext/pdo_pgsql  pgsql_statement.c php_pdo_pgsql_int.h 
/php-src/ext/pdo_pgsql/testsbug44861.phpt 
  Log:
  - Fixed bug #48188
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_statement.c?r1=1.54r2=1.55diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_statement.c
diff -u php-src/ext/pdo_pgsql/pgsql_statement.c:1.54 
php-src/ext/pdo_pgsql/pgsql_statement.c:1.55
--- php-src/ext/pdo_pgsql/pgsql_statement.c:1.54Thu Apr 30 12:35:36 2009
+++ php-src/ext/pdo_pgsql/pgsql_statement.c Tue May 12 22:17:50 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pgsql_statement.c,v 1.54 2009/04/30 12:35:36 mbeccati Exp $ */
+/* $Id: pgsql_statement.c,v 1.55 2009/05/12 22:17:50 mbeccati Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -131,6 +131,13 @@
 
if (S-cursor_name) {
char *q = NULL;
+
+   if (S-is_prepared) {
+   spprintf(q, 0, CLOSE %s, S-cursor_name);
+   S-result = PQexec(H-server, q);
+   efree(q);
+   }
+
spprintf(q, 0, DECLARE %s SCROLL CURSOR WITH HOLD FOR %s, 
S-cursor_name, stmt-active_query_string);
S-result = PQexec(H-server, q);
efree(q);
@@ -142,6 +149,9 @@
return 0;
}
 
+   /* the cursor was declared correctly */
+   S-is_prepared = 1;
+
/* fetch to be able to get the number of tuples later, but 
don't advance the cursor pointer */
spprintf(q, 0, FETCH FORWARD 0 FROM %s, S-cursor_name);
S-result = PQexec(H-server, q);
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h?r1=1.20r2=1.21diff_format=u
Index: php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h
diff -u php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h:1.20 
php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h:1.21
--- php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h:1.20  Thu Apr 30 12:35:36 2009
+++ php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h   Tue May 12 22:17:50 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: php_pdo_pgsql_int.h,v 1.20 2009/04/30 12:35:36 mbeccati Exp $ */
+/* $Id: php_pdo_pgsql_int.h,v 1.21 2009/05/12 22:17:50 mbeccati Exp $ */
 
 #ifndef PHP_PDO_PGSQL_INT_H
 #define PHP_PDO_PGSQL_INT_H
@@ -65,8 +65,8 @@
int *param_lengths;
int *param_formats;
Oid *param_types;
-   zend_bool is_prepared;
 #endif
+   zend_bool is_prepared;
 } pdo_pgsql_stmt;
 
 typedef struct {
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/tests/bug44861.phpt?r1=1.2r2=1.3diff_format=u
Index: php-src/ext/pdo_pgsql/tests/bug44861.phpt
diff -u php-src/ext/pdo_pgsql/tests/bug44861.phpt:1.2 
php-src/ext/pdo_pgsql/tests/bug44861.phpt:1.3
--- php-src/ext/pdo_pgsql/tests/bug44861.phpt:1.2   Sat Mar 28 03:01:38 2009
+++ php-src/ext/pdo_pgsql/tests/bug44861.phpt   Tue May 12 22:17:50 2009
@@ -38,6 +38,12 @@
 $res-execute(array(it's working));
 var_dump($res-fetch(PDO::FETCH_NUM));
 
+
+// Test bug #48188, trying to execute again
+$res-execute(array(try again));
+var_dump($res-fetchColumn());
+var_dump($res-fetchColumn());
+
 ?
 --EXPECT--
 string(4) row1
@@ -76,3 +82,5 @@
   [0]=
   string(12) it's working
 }
+string(9) try again
+bool(false)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) / NEWS /ext/pdo_pgsql pgsql_statement.c php_pdo_pgsql_int.h /ext/pdo_pgsql/tests bug44861.phpt

2009-05-12 Thread Matteo Beccati
mbeccatiTue May 12 22:18:15 2009 UTC

  Modified files:  (Branch: PHP_5_3)
/php-srcNEWS 
/php-src/ext/pdo_pgsql  pgsql_statement.c php_pdo_pgsql_int.h 
/php-src/ext/pdo_pgsql/testsbug44861.phpt 
  Log:
  MFH
  - Fixed bug #48188
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.965.2.598r2=1.2027.2.547.2.965.2.599diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.598 
php-src/NEWS:1.2027.2.547.2.965.2.599
--- php-src/NEWS:1.2027.2.547.2.965.2.598   Mon May 11 12:35:19 2009
+++ php-src/NEWSTue May 12 22:18:14 2009
@@ -9,6 +9,8 @@
 - Fixed bug #48227 (NumberFormatter::format leaks memory). (Felipe)
 - Fixed bug #48200 (compile failure with mbstring.c when 
   --enable-zend-multibyte is used). (Jani)
+- Fixed bug #48188 (Cannot execute a scrollable cursors twice with
+  PDO_PGSQL). (Matteo)
 
 
 07 May 2009, PHP 5.3.0 RC 2
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/pgsql_statement.c?r1=1.31.2.12.2.7.2.11r2=1.31.2.12.2.7.2.12diff_format=u
Index: php-src/ext/pdo_pgsql/pgsql_statement.c
diff -u php-src/ext/pdo_pgsql/pgsql_statement.c:1.31.2.12.2.7.2.11 
php-src/ext/pdo_pgsql/pgsql_statement.c:1.31.2.12.2.7.2.12
--- php-src/ext/pdo_pgsql/pgsql_statement.c:1.31.2.12.2.7.2.11  Thu Apr 30 
12:38:43 2009
+++ php-src/ext/pdo_pgsql/pgsql_statement.c Tue May 12 22:18:14 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pgsql_statement.c,v 1.31.2.12.2.7.2.11 2009/04/30 12:38:43 mbeccati 
Exp $ */
+/* $Id: pgsql_statement.c,v 1.31.2.12.2.7.2.12 2009/05/12 22:18:14 mbeccati 
Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -131,6 +131,13 @@
 
if (S-cursor_name) {
char *q = NULL;
+
+   if (S-is_prepared) {
+   spprintf(q, 0, CLOSE %s, S-cursor_name);
+   S-result = PQexec(H-server, q);
+   efree(q);
+   }
+
spprintf(q, 0, DECLARE %s SCROLL CURSOR WITH HOLD FOR %s, 
S-cursor_name, stmt-active_query_string);
S-result = PQexec(H-server, q);
efree(q);
@@ -142,6 +149,9 @@
return 0;
}
 
+   /* the cursor was declared correctly */
+   S-is_prepared = 1;
+
/* fetch to be able to get the number of tuples later, but 
don't advance the cursor pointer */
spprintf(q, 0, FETCH FORWARD 0 FROM %s, S-cursor_name);
S-result = PQexec(H-server, q);
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h?r1=1.13.2.4.2.1.2.3r2=1.13.2.4.2.1.2.4diff_format=u
Index: php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h
diff -u php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h:1.13.2.4.2.1.2.3 
php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h:1.13.2.4.2.1.2.4
--- php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h:1.13.2.4.2.1.2.3  Thu Apr 30 
12:38:43 2009
+++ php-src/ext/pdo_pgsql/php_pdo_pgsql_int.h   Tue May 12 22:18:14 2009
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: php_pdo_pgsql_int.h,v 1.13.2.4.2.1.2.3 2009/04/30 12:38:43 mbeccati 
Exp $ */
+/* $Id: php_pdo_pgsql_int.h,v 1.13.2.4.2.1.2.4 2009/05/12 22:18:14 mbeccati 
Exp $ */
 
 #ifndef PHP_PDO_PGSQL_INT_H
 #define PHP_PDO_PGSQL_INT_H
@@ -65,8 +65,8 @@
int *param_lengths;
int *param_formats;
Oid *param_types;
-   zend_bool is_prepared;
 #endif
+   zend_bool is_prepared;
 } pdo_pgsql_stmt;
 
 typedef struct {
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_pgsql/tests/bug44861.phpt?r1=1.1.2.1r2=1.1.2.2diff_format=u
Index: php-src/ext/pdo_pgsql/tests/bug44861.phpt
diff -u php-src/ext/pdo_pgsql/tests/bug44861.phpt:1.1.2.1 
php-src/ext/pdo_pgsql/tests/bug44861.phpt:1.1.2.2
--- php-src/ext/pdo_pgsql/tests/bug44861.phpt:1.1.2.1   Sat Mar 28 02:58:04 2009
+++ php-src/ext/pdo_pgsql/tests/bug44861.phpt   Tue May 12 22:18:15 2009
@@ -38,6 +38,12 @@
 $res-execute(array(it's working));
 var_dump($res-fetch(PDO::FETCH_NUM));
 
+
+// Test bug #48188, trying to execute again
+$res-execute(array(try again));
+var_dump($res-fetchColumn());
+var_dump($res-fetchColumn());
+
 ?
 --EXPECT--
 string(4) row1
@@ -76,3 +82,5 @@
   [0]=
   string(12) it's working
 }
+string(9) try again
+bool(false)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src /ext/pdo/tests bug_44861.phpt /ext/pdo_pgsql/tests bug44861.phpt

2009-05-12 Thread Matteo Beccati
mbeccatiTue May 12 23:39:57 2009 UTC

  Added files: 
/php-src/ext/pdo/tests  bug_44861.phpt 

  Removed files:   
/php-src/ext/pdo_pgsql/testsbug44861.phpt 
  Log:
  - Moved test for bug #44861 to PDO commons and added support for pdo_oci
  # This allows scrollable cursors to be tested with all the drivers
  # that currently support them (pgsql and oci), ensuring a consistent
  # behaviour. The test is skipped when using other drivers.
  
  

http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/tests/bug_44861.phpt?view=markuprev=1.1
Index: php-src/ext/pdo/tests/bug_44861.phpt
+++ php-src/ext/pdo/tests/bug_44861.phpt
--TEST--
PDO Common: Bug #44861 (scrollable cursor don't work with pgsql)
--SKIPIF--
?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
$dir = getenv('REDIR_TEST_DIR');
if (false == $dir) die('skip no driver');
$allowed = array('oci', 'pgsql');
$ok = false;
foreach ($allowed as $driver) {
if (!strncasecmp(getenv('PDOTEST_DSN'), $driver, strlen($driver))) {
$ok = true;
}
}
if (!$ok) {
die(skip Scrollable cursors not supported);
}
require_once $dir . 'pdo_test.inc';
PDOTest::skip();
?
--FILE--
?php
if (getenv('REDIR_TEST_DIR') === false) 
putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();

$db-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

if ($db-getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') {
$from = 'FROM DUAL';
} else {
$from = '';
}

$query = SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 
'row3' $from UNION SELECT 'row4' $from;
$aParams = array(PDO::ATTR_CURSOR = PDO::CURSOR_SCROLL);

$res = $db-prepare($query, $aParams);
$res-execute();
var_dump($res-fetchColumn());
var_dump($res-fetchColumn());
var_dump($res-fetchColumn());
var_dump($res-fetchColumn());
var_dump($res-fetchColumn());

var_dump($res-fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_ABS, 3));
var_dump($res-fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_PRIOR));
var_dump($res-fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_FIRST));
var_dump($res-fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_LAST));
var_dump($res-fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_REL, -1));

var_dump($res-fetchAll(PDO::FETCH_ASSOC));

// Test binding params via emulated prepared query
$res = $db-prepare(SELECT ? $from, $aParams);
$res-execute(array(it's working));
var_dump($res-fetch(PDO::FETCH_NUM));


// Test bug #48188, trying to execute again
$res-execute(array(try again));
var_dump($res-fetchColumn());
var_dump($res-fetchColumn());

?
--EXPECT--
string(4) row1
string(4) row2
string(4) row3
string(4) row4
bool(false)
array(1) {
  [0]=
  string(4) row3
}
array(1) {
  [0]=
  string(4) row2
}
array(1) {
  [0]=
  string(4) row1
}
array(1) {
  [0]=
  string(4) row4
}
array(1) {
  [0]=
  string(4) row3
}
array(1) {
  [0]=
  array(1) {
[r]=
string(4) row4
  }
}
array(1) {
  [0]=
  string(12) it's working
}
string(9) try again
bool(false)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo/tests bug_44861.phpt /ext/pdo_pgsql/tests bug44861.phpt

2009-05-12 Thread Matteo Beccati
mbeccatiTue May 12 23:40:32 2009 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/pdo/tests  bug_44861.phpt 

  Removed files:   
/php-src/ext/pdo_pgsql/testsbug44861.phpt 
  Log:
  MFH
  - Moved test for bug #44861 to PDO commons and added support for pdo_oci
  # This allows scrollable cursors to be tested with all the drivers
  # that currently support them (pgsql and oci), ensuring a consistent
  # behaviour. The test is skipped when using other drivers.
  
  

http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/tests/bug_44861.phpt?view=markuprev=1.1
Index: php-src/ext/pdo/tests/bug_44861.phpt
+++ php-src/ext/pdo/tests/bug_44861.phpt
--TEST--
PDO Common: Bug #44861 (scrollable cursor don't work with pgsql)
--SKIPIF--
?php # vim:ft=php
if (!extension_loaded('pdo')) die('skip');
$dir = getenv('REDIR_TEST_DIR');
if (false == $dir) die('skip no driver');
$allowed = array('oci', 'pgsql');
$ok = false;
foreach ($allowed as $driver) {
if (!strncasecmp(getenv('PDOTEST_DSN'), $driver, strlen($driver))) {
$ok = true;
}
}
if (!$ok) {
die(skip Scrollable cursors not supported);
}
require_once $dir . 'pdo_test.inc';
PDOTest::skip();
?
--FILE--
?php
if (getenv('REDIR_TEST_DIR') === false) 
putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/');
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();

$db-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

if ($db-getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') {
$from = 'FROM DUAL';
} else {
$from = '';
}

$query = SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 
'row3' $from UNION SELECT 'row4' $from;
$aParams = array(PDO::ATTR_CURSOR = PDO::CURSOR_SCROLL);

$res = $db-prepare($query, $aParams);
$res-execute();
var_dump($res-fetchColumn());
var_dump($res-fetchColumn());
var_dump($res-fetchColumn());
var_dump($res-fetchColumn());
var_dump($res-fetchColumn());

var_dump($res-fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_ABS, 3));
var_dump($res-fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_PRIOR));
var_dump($res-fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_FIRST));
var_dump($res-fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_LAST));
var_dump($res-fetch(PDO::FETCH_NUM, PDO::FETCH_ORI_REL, -1));

var_dump($res-fetchAll(PDO::FETCH_ASSOC));

// Test binding params via emulated prepared query
$res = $db-prepare(SELECT ? $from, $aParams);
$res-execute(array(it's working));
var_dump($res-fetch(PDO::FETCH_NUM));


// Test bug #48188, trying to execute again
$res-execute(array(try again));
var_dump($res-fetchColumn());
var_dump($res-fetchColumn());

?
--EXPECT--
string(4) row1
string(4) row2
string(4) row3
string(4) row4
bool(false)
array(1) {
  [0]=
  string(4) row3
}
array(1) {
  [0]=
  string(4) row2
}
array(1) {
  [0]=
  string(4) row1
}
array(1) {
  [0]=
  string(4) row4
}
array(1) {
  [0]=
  string(4) row3
}
array(1) {
  [0]=
  array(1) {
[r]=
string(4) row4
  }
}
array(1) {
  [0]=
  string(12) it's working
}
string(9) try again
bool(false)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_sqlite sqlite_statement.c

2009-05-19 Thread Matteo Beccati
Hi Ilia,

 + if (*len) {
 + /* sqlite3.h says the NUL terminator is 
 included in the byte count for TEXT values */
 + *len--; /* do not remove this, even though it 
 generates a warning */
 + }

Would you mind explaining me why the fix was faulty?


Cheers

-- 
Matteo Beccati

OpenX - http://www.openx.org

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_sqlite sqlite_statement.c

2009-05-19 Thread Matteo Beccati
Ilia Alshanetsky ha scritto:
 *len is a pointer to an integer, that is being decremented to reduce the
 overall length of the string to remove the NUL terminator. If you
 remove the operation you'll end up with 2 NULs at the end of the string.

As I said, I coulndn't find any reference to the fact that the NUL
terminator is included in the byte count for TEXT values in sqlite3.h.

I don't want to argue about this, but here's a small test case that
hopefully proves that the code you added back is just useless, as it
doesn't do what you'd expect by reading the comment.

$ cat len.c; gcc -Wall len.c; ./a.out
#include stdio.h
#include assert.h

void decrease_len(int *len)
{
*len--;
}

int main(int argc, char **argv)
{
int len = 10;

decrease_len(len);
assert(len == 9);

return 0;
}

len.c: In function ‘decrease_len’:
len.c:6: warning: value computed is not used
a.out: len.c:14: main: Assertion `len == 9' failed.
Aborted


Cheers

-- 
Matteo Beccati

OpenX - http://www.openx.org

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_3) /ext/pdo_sqlite sqlite_statement.c

2009-05-19 Thread Matteo Beccati
Ilia Alshanetsky ha scritto:
 iliaa Tue May 19 19:15:18 2009 UTC
 
   Modified files:  (Branch: PHP_5_3)
 /php-src/ext/pdo_sqlite   sqlite_statement.c 
   Log:
   The \0 removal is only needed prior to 3.4.0

I hate to do this (and as a php-src newbie I'm a bit afraid to), but
once again this is simply wrong. The commit breaks compatibility with
sqlite  3.4.0.

You are trying to fix something that has never been broken. The
sqlite3.h comment was wrong and the missing parens were leading you to
think that the issue existed and was being worked around in PHP.

Otherwise PDO_SQLITE would have been returning strings with trailing
'\0' since Feb 2005 to June 2007, which is quite unlikely. See:

http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/sqlite_statement.c?r1=1.12r2=1.13view=patch
http://www.sqlite.org/changes.html#version_3_4_0

I've verified the compatibility break by compiling PHP 5.3 with a cvs
checkout of sqlite 3.3.8 (-D 2007-01-01). Here's the result of one of
the many failing tests:

TEST 6/14 [ext/pdo_sqlite/tests/bug46139.phpt]
DIFF
002+ 'fo'
002- 'foo'
004+ 'fo'
004- 'foo'
006+ 'fo'
006- 'foo'
DONE

I hope this is enough proof to back up my theory and for you to revert
your latest changes.


Cheers
-- 
Matteo Beccati

OpenX - http://www.openx.org

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/pdo_sqlite sqlite_statement.c

2009-05-20 Thread Matteo Beccati
Antony Dovgal ha scritto:
 On 20.05.2009 17:38, Ilia Alshanetsky wrote:
 Tony,

 is this with the built-in lib or an external lib and if it is an  
 external lib can you please tell me the version.
 
 Built-in, I guess, since I don't have sqlite3 headers installed.

Which again confirms what I've been trying to tell, given that 5.2 is
still bundling 3.3.7:

http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/sqlite/VERSION?revision=1.3.2.3.2.7view=markuppathrev=PHP_5_2

FWIW, I also tested 5.3 compiled with a checkout of sqlite 3.0.8 (-D
2005-01-01). Same failures.


Cheers
-- 
Matteo Beccati

OpenX - http://www.openx.org

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/pdo_sqlite sqlite_statement.c

2009-05-20 Thread Matteo Beccati
Ilia Alshanetsky ha scritto:
 How did you manage to build 5.3 against 3.0.8, since the config requires
 version 3.3.9 or higher?

Good question... configure didn't complain:

checking for sqlite 3 support for PDO... yes
checking for PDO includes... (cached) /root/compile/php-5.3/ext
checking for sqlite3_open in -lsqlite3... yes
checking for sqlite3_key in -lsqlite3... no

but in fact php was built with the bundled version. Funny thing is that
it seemed to be using the old headers as tests are failing and gdb
confirms that the (*len)-- is executed.


Cheers

-- 
Matteo Beccati

OpenX - http://www.openx.org

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] cvs: php-src(PHP_5_2) /ext/pdo_sqlite sqlite_statement.c

2009-05-20 Thread Matteo Beccati
Ilia Alshanetsky wrote:
 Nice, it actually aborted configure when trying to compile against
 external 3.3.9 sources in 5.3. I wonder why it let 3.0.8 through...

No idea. It might even just be my FreeBSD box or the fact I installed
the external sqlite library and headers using a cvs checkout.

Please let me know if there's something I can go to help you figure it out.

 Btw, you were right, bad on my part. It seems Sqlite3 header is not
 entirely correct in saying \0 is included in the byte count, it returns
 a real length about 4 different version of sqlite 3.4.0 confirm it.
 Thanks for being so persistent ;-)

You're welcome ;)


Cheers

-- 
Matteo Beccati

OpenX - http://www.openx.org

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] svn: /php/php-src/branches/PHP_5_2/ NEWS ext/pdo/pdo_stmt.c ext/pdo_pgsql/pgsql_statement.c ext/pdo_pgsql/tests/bug46274_2.phpt

2009-09-03 Thread Matteo Beccati
mbeccati Thu, 03 Sep 2009 22:53:25 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=288013

Log:
MFH
- Fixed bug #48060 (pdo_pgsql - large objects are returned as empty)
# Backported from 5.3.0, per gripe from Konstantin Ryabitsev
# Permission granted by Ilia

Bug: http://bugs.php.net/48060 (Closed) pdo_pgsql -  large objects are returned 
as empty
  
Changed paths:
U   php/php-src/branches/PHP_5_2/NEWS
U   php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c
U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c
U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug46274_2.phpt

Modified: php/php-src/branches/PHP_5_2/NEWS
===
--- php/php-src/branches/PHP_5_2/NEWS   2009-09-03 22:19:34 UTC (rev 288012)
+++ php/php-src/branches/PHP_5_2/NEWS   2009-09-03 22:53:25 UTC (rev 288013)
@@ -1,6 +1,7 @@
 PHPNEWS
 |||
 0? Sep 2009, PHP 5.2.11
+- Fixed bug #48060 (pdo_pgsql - large objects are returned as empty). (Matteo)


 03 Sep 2009, PHP 5.2.11RC2

Modified: php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c
===
--- php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c 2009-09-03 22:19:34 UTC 
(rev 288012)
+++ php/php-src/branches/PHP_5_2/ext/pdo/pdo_stmt.c 2009-09-03 22:53:25 UTC 
(rev 288013)
@@ -587,9 +587,8 @@
case PDO_PARAM_LOB:
if (value == NULL) {
ZVAL_NULL(dest);
-   } else if (value[0] == '\0') {
-   ZVAL_EMPTY_STRING(dest);
} else if (value_len == 0) {
+   /* Warning, empty strings need to be passed as 
stream */
if (stmt-dbh-stringify || new_type == 
PDO_PARAM_STR) {
char *buf = NULL;
size_t len;

Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c
===
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c
2009-09-03 22:19:34 UTC (rev 288012)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c
2009-09-03 22:53:25 UTC (rev 288013)
@@ -599,8 +599,14 @@
return 0;
} else {
*ptr = 
php_pdo_pgsql_unescape_bytea(*ptr, tmp_len);
-   *len = tmp_len;
-   *caller_frees = 1;
+   if (!tmp_len) {
+   /* Empty string, return as 
empty stream */
+   *ptr = (char 
*)php_stream_memory_open(TEMP_STREAM_READONLY, , 0);
+   *len = 0;
+   } else {
+   *len = tmp_len;
+   *caller_frees = 1;
+   }
}
break;
case PDO_PARAM_NULL:

Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug46274_2.phpt
===
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug46274_2.phpt
2009-09-03 22:19:34 UTC (rev 288012)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug46274_2.phpt
2009-09-03 22:53:25 UTC (rev 288013)
@@ -47,11 +47,13 @@
 var_dump($x = $res-fetch());
 var_dump(fread($x['blob1'], 10));

-// Empty string
+// Resource
 var_dump($res-fetch());
+var_dump(fread($x['blob1'], 10));

-// Empty string
+// Resource
 var_dump($res-fetch());
+var_dump(fread($x['blob1'], 10));

 // NULL
 var_dump($res-fetch());
@@ -69,16 +71,18 @@
 string(3) foo
 array(2) {
   [blob1]=
-  string(0) 
+  resource(%d) of type (stream)
   [0]=
-  string(0) 
+  resource(%d) of type (stream)
 }
+string(0) 
 array(2) {
   [blob1]=
-  string(0) 
+  resource(%d) of type (stream)
   [0]=
-  string(0) 
+  resource(%d) of type (stream)
 }
+string(0) 
 array(2) {
   [blob1]=
   NULL

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/pdo_pgsql/pdo_pgsql.c branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c branches/PHP_5_2/ext/pdo_pgsql/php_pdo_pgsql_int.h branches/

2009-10-07 Thread Matteo Beccati
mbeccati Wed, 07 Oct 2009 17:40:16 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=289287

Log:
- Fixed bug #48764 (PDO_pgsql::query always uses implicit prepared statements 
if v3 proto available)

# original patch by Mark Kirkwood

Bug: http://bugs.php.net/48764 (Open) PDO_pgsql::query always uses implicit 
prepared statements if v3 proto available
  
Changed paths:
U   php/php-src/branches/PHP_5_2/NEWS
U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pdo_pgsql.c
U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c
U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/php_pdo_pgsql_int.h
A   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug48764.phpt
U   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/pdo_pgsql.c
U   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/pgsql_driver.c
U   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/php_pdo_pgsql_int.h
A   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug48764.phpt
U   php/php-src/trunk/ext/pdo_pgsql/pdo_pgsql.c
U   php/php-src/trunk/ext/pdo_pgsql/pgsql_driver.c
U   php/php-src/trunk/ext/pdo_pgsql/php_pdo_pgsql_int.h
A   php/php-src/trunk/ext/pdo_pgsql/tests/bug48764.phpt

Modified: php/php-src/branches/PHP_5_2/NEWS
===
--- php/php-src/branches/PHP_5_2/NEWS	2009-10-07 17:35:31 UTC (rev 289286)
+++ php/php-src/branches/PHP_5_2/NEWS	2009-10-07 17:40:16 UTC (rev 289287)
@@ -29,6 +29,8 @@
 - Fixed bug #49528 (UTF-16 strings prefixed by BOMs wrongly converted).
   (Moriyoshi)
 - Fixed bug #48805 (IPv6 socket transport is not working). (Ilia)
+- Fixed bug #48764 (PDO_pgsql::query always uses implicit prepared statements
+  if v3 proto available). (Matteo, Mark Kirkwood)


 17 Sep 2009, PHP 5.2.11

Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pdo_pgsql.c
===
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pdo_pgsql.c	2009-10-07 17:35:31 UTC (rev 289286)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pdo_pgsql.c	2009-10-07 17:40:16 UTC (rev 289287)
@@ -80,8 +80,8 @@
  */
 PHP_MINIT_FUNCTION(pdo_pgsql)
 {
+	REGISTER_PDO_CLASS_CONST_LONG(PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT);
 	php_pdo_register_driver(pdo_pgsql_driver);
-	REGISTER_PDO_CLASS_CONST_LONG(PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT);
 	return SUCCESS;
 }
 /* }}} */

Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c
===
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c	2009-10-07 17:35:31 UTC (rev 289286)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c	2009-10-07 17:40:16 UTC (rev 289287)
@@ -239,13 +239,12 @@
 #if HAVE_PQPREPARE

 	if (driver_options) {
-		if (pdo_attr_lval(driver_options,
-PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, 0 TSRMLS_CC) == 1) {
+		if (pdo_attr_lval(driver_options, PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT, H-disable_native_prepares TSRMLS_CC) == 1 ||
+			pdo_attr_lval(driver_options, PDO_ATTR_EMULATE_PREPARES, H-emulate_prepares TSRMLS_CC) == 1) {
 			emulate = 1;
-		} else if (pdo_attr_lval(driver_options, PDO_ATTR_EMULATE_PREPARES,
-0 TSRMLS_CC) == 1) {
-			emulate = 1;
 		}
+	} else {
+		emulate = H-disable_native_prepares || H-emulate_prepares;
 	}

 	if (!emulate  PQprotocolVersion(H-server)  2) {
@@ -646,7 +645,21 @@

 static int pdo_pgsql_set_attr(pdo_dbh_t *dbh, long attr, zval *val TSRMLS_DC)
 {
-	return 0;
+	pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh-driver_data;
+
+	switch (attr) {
+#if HAVE_PQPREPARE
+		case PDO_ATTR_EMULATE_PREPARES:
+			H-emulate_prepares = Z_LVAL_P(val);
+			return 1;
+		case PDO_PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT:
+			H-disable_native_prepares = Z_LVAL_P(val);
+			return 1;
+#endif
+
+		default:
+			return 0;
+	}
 }

 static struct pdo_dbh_methods pgsql_methods = {

Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/php_pdo_pgsql_int.h
===
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/php_pdo_pgsql_int.h	2009-10-07 17:35:31 UTC (rev 289286)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/php_pdo_pgsql_int.h	2009-10-07 17:40:16 UTC (rev 289287)
@@ -43,6 +43,13 @@
 	unsigned 	_reserved:31;
 	pdo_pgsql_error_info	einfo;
 	Oid 		pgoid;
+#if HAVE_PQPREPARE
+	/* The following two variables have the same purpose. Unfortunately we need
+	   to keep track of two different attributes having the same effect.
+	   It might be worth to deprecate the driver specific one soon. */
+	int		emulate_prepares;
+	int		disable_native_prepares;
+#endif
 } pdo_pgsql_db_handle;

 typedef struct {

Added: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug48764.phpt

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c branches/PHP_5_3/NEWS branches/PHP_5_3/ext/pdo_pgsql/pgsql_statement.c trunk/ext/pdo_pgsql/pgsql

2009-10-26 Thread Matteo Beccati
Hi Ilia,

 Revision: http://svn.php.net/viewvc?view=revisionrevision=289924
 
 Log:
 - Fixed bug #49985 (pdo_pgsql prepare() re-use previous aborted transaction).
 
 Bug: http://bugs.php.net/49985 (Open) pdo_pgsql prepare() re-use previous 
 aborted transaction

I've quickly review the bug report and the fix. I'm not really sure
savepoints are a good idea. I didn't do any benchmark, but my hunch is
that it will be a fairly high performance hit to any query to avoid a
corner case issue. Maybe we can find a better solution that doesn't
impact performance?


Cheers
-- 
Matteo Beccati

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c branches/PHP_5_3/NEWS branches/PHP_5_3/ext/pdo_pgsql/pgsql_statement.c trunk/ext/pdo_pgsql/pgsql

2009-10-26 Thread Matteo Beccati
Ilia Alshanetsky ha scritto:
 I did a quick test, and I don't see a significant reduction is
 performance after the patch.

That's cool. Maybe I'll try to perform some more benchmarking later
today... However, given that the problem here is that the
cursor/prepared statement name is generated using a memory address, how
about we use a different mechanism that prevents reusing the same name,
i.e. an internal counter?


Cheers
-- 
Matteo Beccati

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c branches/PHP_5_3/NEWS branches/PHP_5_3/ext/pdo_pgsql/pgsql_statement.c trunk/ext/pdo_pgsql/pgsql

2009-10-26 Thread Matteo Beccati
Ilia Alshanetsky ha scritto:
 Internal counter could work, or we could try to use a better random #
 generator

I'll try to make a patch that uses php_mt_rand, which seems to be the
less invasive approach. I guess it would be hard to get collisions,
still the fact it could happen makes me a bit uncomfortable. Anyway,
once a patch is ready, it would be just a matter of minutes to switch to
an internal counter.


Cheers
-- 
Matteo Beccati

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c branches/PHP_5_3/ext/pdo_pgsql/pgsql_statement.c trunk/ext/pdo_pgsql/pgsql_statement.c

2009-11-04 Thread Matteo Beccati
mbeccati Wed, 04 Nov 2009 19:16:39 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=290212

Log:
- Reverting previous fix for bug #49985
# Unmerged changes from revision 289924

Bug: http://bugs.php.net/49985 (Closed) pdo_pgsql prepare() re-use previous 
aborted transaction
  
Changed paths:
U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c
U   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/pgsql_statement.c
U   php/php-src/trunk/ext/pdo_pgsql/pgsql_statement.c

Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c
===
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c
2009-11-04 19:09:13 UTC (rev 290211)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c
2009-11-04 19:16:39 UTC (rev 290212)
@@ -134,14 +134,6 @@
/* using a prepared statement */

if (!S-is_prepared) {
-   /* don't break the whole current transaction when the 
first
-* prepare tentative fails (happens when the prepared 
statement
-* already exists). ignore those SAVEPOINT queries 
results because
-* we don't care (may be outside transaction?).
-*/
-   char buf[100]; /* stmt_name == pdo_pgsql_cursor_%08x 
*/
-   snprintf(buf, sizeof(buf), SAVEPOINT %s, 
S-stmt_name);
-   PQexec(H-server, buf);
 stmt_retry:
/* we deferred the prepare until now, because we didn't
 * know anything about the parameter types; now we do */
@@ -161,14 +153,12 @@
/* 42P05 means that the prepared 
statement already existed. this can happen if you use
 * a connection pooling software line 
pgpool which doesn't close the db-connection once
 * php disconnects. if php dies (no 
chance to run RSHUTDOWN) during execution it has no
-* chance to DEALLOCATE the prepared 
statements it has created. Also happens if we tried
-* to DEALLOCATE the same statement 
name in an aborted transaction. so, if we hit a 42P05
-* we deallocate it and retry ONCE 
(thies 2005.12.15)
+* chance to DEALLOCATE the prepared 
statements it has created. so, if we hit a 42P05 we
+* deallocate it and retry ONCE (thies 
2005.12.15)
 */
if (!strcmp(sqlstate, 42P05)) {
+   char buf[100]; /* stmt_name == 
pdo_pgsql_cursor_%08x */
PGresult *res;
-   snprintf(buf, sizeof(buf), 
ROLLBACK TO SAVEPOINT %s, S-stmt_name);
-   PQexec(H-server, buf);
snprintf(buf, sizeof(buf), 
DEALLOCATE %s, S-stmt_name);
res = PQexec(H-server, buf);
if (res) {
@@ -176,15 +166,11 @@
}
goto stmt_retry;
} else {
-   snprintf(buf, sizeof(buf), 
RELEASE SAVEPOINT %s, S-stmt_name);
-   PQexec(H-server, buf);
pdo_pgsql_error_stmt(stmt, 
status, sqlstate);
return 0;
}
}
}
-   snprintf(buf, sizeof(buf), RELEASE SAVEPOINT %s, 
S-stmt_name);
-   PQexec(H-server, buf);
}
S-result = PQexecPrepared(H-server, S-stmt_name,
stmt-bound_params ?

Modified: php/php-src/branches/PHP_5_3/ext/pdo_pgsql/pgsql_statement.c
===
--- php/php-src/branches/PHP_5_3/ext/pdo_pgsql/pgsql_statement.c
2009-11-04 19:09:13 UTC (rev 290211)
+++ php/php-src/branches/PHP_5_3/ext/pdo_pgsql/pgsql_statement.c
2009-11-04 19:16:39 UTC (rev 290212)
@@ -162,14 +162,6 @@
/* using a prepared statement */

if (!S-is_prepared) {
-   /* don't break the whole current transaction when the 
first
-* prepare tentative fails (happens when the prepared 
statement
- 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/NEWS branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c branches/PHP_5_2/ext/pdo_pgsql/php_pdo_pgsql_int.h bra

2009-11-04 Thread Matteo Beccati
mbeccati Wed, 04 Nov 2009 19:32:27 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=290214

Log:
- Properly fixed bug #49985 (pdo_pgsql prepare() re-use previous aborted 
transaction).
# Removed usage of the memory address when generating prepared statemend names
# as uniqueness can't be enforced. Used a statment counter instead.

Bug: http://bugs.php.net/49985 (Closed) pdo_pgsql prepare() re-use previous 
aborted transaction
  
Changed paths:
U   php/php-src/branches/PHP_5_2/NEWS
U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c
U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c
U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/php_pdo_pgsql_int.h
A   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_49985.phpt
U   php/php-src/branches/PHP_5_3/NEWS
U   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/pgsql_driver.c
U   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/pgsql_statement.c
U   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/php_pdo_pgsql_int.h
A   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_49985.phpt
U   php/php-src/trunk/ext/pdo_pgsql/pgsql_driver.c
U   php/php-src/trunk/ext/pdo_pgsql/pgsql_statement.c
U   php/php-src/trunk/ext/pdo_pgsql/php_pdo_pgsql_int.h
A   php/php-src/trunk/ext/pdo_pgsql/tests/bug_49985.phpt

Modified: php/php-src/branches/PHP_5_2/NEWS
===
--- php/php-src/branches/PHP_5_2/NEWS	2009-11-04 19:26:37 UTC (rev 290213)
+++ php/php-src/branches/PHP_5_2/NEWS	2009-11-04 19:32:27 UTC (rev 290214)
@@ -24,7 +24,7 @@
 - Fixed bug #49990 (SNMP3 warning message about security level printed twice).
   (Jani)
 - Fixed bug #49985 (pdo_pgsql prepare() re-use previous aborted
-  transaction). (ben dot pineau at gmail dot com, Ilia)
+  transaction). (ben dot pineau at gmail dot com, Ilia, Matteo)
 - Fixed bug #49921 (Curl post upload functions changed). (Ilia)
 - Fixed bug #49972 (AppendIterator undefined function crash). (Johannes)
 - Fixed bug #49855 (import_request_variables() always returns NULL). (Ilia,

Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c
===
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c	2009-11-04 19:26:37 UTC (rev 290213)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_driver.c	2009-11-04 19:32:27 UTC (rev 290214)
@@ -233,7 +233,7 @@
 			efree(S-cursor_name);
 		}
 		/* TODO: check how scrollable cursors related to prepared statements */
-		spprintf(S-cursor_name, 0, pdo_pgsql_cursor_%08x, (unsigned int) stmt);
+		spprintf(S-cursor_name, 0, pdo_crsr_%08x, ++H-stmt_counter);
 	}

 #if HAVE_PQPREPARE
@@ -261,7 +261,7 @@
 			return 0;
 		}

-		spprintf(S-stmt_name, 0, pdo_pgsql_stmt_%08x, (unsigned int)stmt);
+		spprintf(S-stmt_name, 0, pdo_stmt_%08x, ++H-stmt_counter);
 		/* that's all for now; we'll defer the actual prepare until the first execute call */

 		if (nsql) {

Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c
===
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c	2009-11-04 19:26:37 UTC (rev 290213)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c	2009-11-04 19:32:27 UTC (rev 290214)
@@ -157,7 +157,7 @@
 	 * deallocate it and retry ONCE (thies 2005.12.15)
 	 */
 	if (!strcmp(sqlstate, 42P05)) {
-		char buf[100]; /* stmt_name == pdo_pgsql_cursor_%08x */
+		char buf[100]; /* stmt_name == pdo_crsr_%08x */
 		PGresult *res;
 		snprintf(buf, sizeof(buf), DEALLOCATE %s, S-stmt_name);
 		res = PQexec(H-server, buf);

Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/php_pdo_pgsql_int.h
===
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/php_pdo_pgsql_int.h	2009-11-04 19:26:37 UTC (rev 290213)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/php_pdo_pgsql_int.h	2009-11-04 19:32:27 UTC (rev 290214)
@@ -50,6 +50,7 @@
 	int		emulate_prepares;
 	int		disable_native_prepares;
 #endif
+	unsigned int stmt_counter;
 } pdo_pgsql_db_handle;

 typedef struct {

Added: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_49985.phpt
===
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_49985.phpt	(rev 0)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_49985.phpt	2009-11-04 19:32:27 UTC (rev 290214)
@@ -0,0 +1,35 @@
+--TEST--
+Bug #49985 (pdo_pgsql prepare() re-use previous aborted transaction)
+--SKIPIF--
+?php
+if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not loaded');
+require dirname(__FILE__) . '/config.inc';
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+PDOTest::skip();
+?
+--FILE--
+?php
+require dirname(__FILE__) . 

[PHP-CVS] svn: /php/php-src/branches/PHP_5_2/ NEWS ext/pdo_pgsql/pgsql_statement.c

2009-12-25 Thread Matteo Beccati
mbeccati Fri, 25 Dec 2009 20:09:08 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=292629

Log:
- Fixed bug #50575 (PDO_PGSQL LOBs are not compatible with PostgreSQL 8.5)
# Affects 5.2 only, no need to MFB

Bug: http://bugs.php.net/50575 (Open) PDO_PGSQL LOBs are not compatible with 
PostgreSQL 8.5
  
Changed paths:
U   php/php-src/branches/PHP_5_2/NEWS
U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c

Modified: php/php-src/branches/PHP_5_2/NEWS
===
--- php/php-src/branches/PHP_5_2/NEWS   2009-12-25 16:34:38 UTC (rev 292628)
+++ php/php-src/branches/PHP_5_2/NEWS   2009-12-25 20:09:08 UTC (rev 292629)
@@ -6,6 +6,8 @@

 - Fixed build of mysqli with MySQL 5.5.0-m2. (Andrey)

+- Fixed bug #50575 (PDO_PGSQL LOBs are not compatible with PostgreSQL 8.5).
+  (Matteo)
 - Fixed bug #50558 (Broken object model when extending tidy). (Pierrick)
 - Fixed bug #50540 (Crash while running ldap_next_reference test cases).
   (Sriram)

Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c
===
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c
2009-12-25 16:34:38 UTC (rev 292628)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/pgsql_statement.c
2009-12-25 20:09:08 UTC (rev 292629)
@@ -472,6 +472,24 @@
  */
 static unsigned char *php_pdo_pgsql_unescape_bytea(unsigned char *strtext, 
size_t *retbuflen)
 {
+#ifdef HAVE_PQUNESCAPEBYTEA
+   size_t tmp_len;
+   char *buffer;
+   char *tmp_ptr = PQunescapeBytea(strtext, tmp_len);
+
+   if (!tmp_ptr) {
+   /* PQunescapeBytea returned an error, this
+  function will return en empty string */
+   tmp_len = 0;
+   buffer = emalloc(0);
+   } else {
+   buffer = emalloc(tmp_len);
+   memcpy(buffer, tmp_ptr, tmp_len);
+   PQfreemem(tmp_ptr);
+   }
+   *retbuflen = tmp_len;
+   return buffer;
+#else
size_t  buflen;
unsigned char *buffer,
   *sp,
@@ -480,6 +498,7 @@

if (strtext == NULL)
return NULL;
+
buflen = strlen(strtext);   /* will shrink, also we discover if
 * strtext */
buffer = (unsigned char *) emalloc(buflen); /* isn't NULL 
terminated */
@@ -549,6 +568,7 @@

*retbuflen = buflen;
return buffer;
+#endif
 }

 static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, char **ptr, 
unsigned long *len, int *caller_frees  TSRMLS_DC)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/ext/pdo_pgsql/tests/bug_33876.phpt branches/PHP_5_2/ext/pdo_pgsql/tests/bug_49985.phpt branches/PHP_5_3/ext/pdo/tests/bug_44861.phpt branches/PHP_5_3/ext/

2009-12-25 Thread Matteo Beccati
mbeccati Fri, 25 Dec 2009 20:11:07 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=292630

Log:
- Updated pdo_pgsql tests to be 8.5+ friendly

Changed paths:
U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_33876.phpt
U   php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_49985.phpt
U   php/php-src/branches/PHP_5_3/ext/pdo/tests/bug_44861.phpt
U   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_33876.phpt
U   php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_49985.phpt
U   php/php-src/trunk/ext/pdo/tests/bug_44861.phpt
U   php/php-src/trunk/ext/pdo_pgsql/tests/bug_33876.phpt
U   php/php-src/trunk/ext/pdo_pgsql/tests/bug_49985.phpt

Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_33876.phpt
===
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_33876.phpt 
2009-12-25 20:09:08 UTC (rev 292629)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_33876.phpt 
2009-12-25 20:11:07 UTC (rev 292630)
@@ -80,10 +80,14 @@

 # Expected to fail; unless told otherwise, PDO assumes string inputs
 # false -  as string, which pgsql doesn't like
-if (!$res-execute(array(false)))
-   print_r($res-errorInfo());
-else
+if (!$res-execute(array(false))) {
+   $err = $res-errorInfo();
+   // Strip additional lines ouputted by recent PgSQL versions
+   $err[2] = trim(current(explode(\n, $err[2])));
+   print_r($err);
+} else {
print_r($res-fetchAll(PDO::FETCH_ASSOC));
+}




Modified: php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_49985.phpt
===
--- php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_49985.phpt 
2009-12-25 20:09:08 UTC (rev 292629)
+++ php/php-src/branches/PHP_5_2/ext/pdo_pgsql/tests/bug_49985.phpt 
2009-12-25 20:11:07 UTC (rev 292630)
@@ -22,7 +22,7 @@
 var_dump($stmt-execute(array(1)));
 $db-commit();
 } catch (Exception $e) {
-echo $e-getMessage().\n;
+echo trim(current(explode(\n, $e-getMessage(.\n;
 $db-rollback();
 }
 }

Modified: php/php-src/branches/PHP_5_3/ext/pdo/tests/bug_44861.phpt
===
--- php/php-src/branches/PHP_5_3/ext/pdo/tests/bug_44861.phpt   2009-12-25 
20:09:08 UTC (rev 292629)
+++ php/php-src/branches/PHP_5_3/ext/pdo/tests/bug_44861.phpt   2009-12-25 
20:11:07 UTC (rev 292630)
@@ -32,7 +32,7 @@
$from = '';
 }

-$query = SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 
'row3' $from UNION SELECT 'row4' $from;
+$query = SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 
'row3' $from UNION SELECT 'row4' $from ORDER BY r;
 $aParams = array(PDO::ATTR_CURSOR = PDO::CURSOR_SCROLL);

 $res = $db-prepare($query, $aParams);

Modified: php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_33876.phpt
===
--- php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_33876.phpt 
2009-12-25 20:09:08 UTC (rev 292629)
+++ php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_33876.phpt 
2009-12-25 20:11:07 UTC (rev 292630)
@@ -80,10 +80,14 @@

 # Expected to fail; unless told otherwise, PDO assumes string inputs
 # false -  as string, which pgsql doesn't like
-if (!$res-execute(array(false)))
-   print_r($res-errorInfo());
-else
+if (!$res-execute(array(false))) {
+   $err = $res-errorInfo();
+   // Strip additional lines ouputted by recent PgSQL versions
+   $err[2] = trim(current(explode(\n, $err[2])));
+   print_r($err);
+} else {
print_r($res-fetchAll(PDO::FETCH_ASSOC));
+}




Modified: php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_49985.phpt
===
--- php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_49985.phpt 
2009-12-25 20:09:08 UTC (rev 292629)
+++ php/php-src/branches/PHP_5_3/ext/pdo_pgsql/tests/bug_49985.phpt 
2009-12-25 20:11:07 UTC (rev 292630)
@@ -22,7 +22,7 @@
 var_dump($stmt-execute(array(1)));
 $db-commit();
 } catch (Exception $e) {
-echo $e-getMessage().\n;
+echo trim(current(explode(\n, $e-getMessage(.\n;
 $db-rollback();
 }
 }

Modified: php/php-src/trunk/ext/pdo/tests/bug_44861.phpt
===
--- php/php-src/trunk/ext/pdo/tests/bug_44861.phpt  2009-12-25 20:09:08 UTC 
(rev 292629)
+++ php/php-src/trunk/ext/pdo/tests/bug_44861.phpt  2009-12-25 20:11:07 UTC 
(rev 292630)
@@ -32,7 +32,7 @@
$from = '';
 }

-$query = SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 
'row3' $from UNION SELECT 'row4' $from;
+$query = SELECT 'row1' AS r $from UNION SELECT 'row2' $from UNION SELECT 
'row3' $from UNION SELECT 'row4' $from ORDER BY r;
 

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/ext/pgsql/tests/10pg_convert.phpt branches/PHP_5_2/ext/pgsql/tests/10pg_convert_85.phpt branches/PHP_5_2/ext/pgsql/tests/12pg_insert.phpt branches/PHP_5_2

2009-12-25 Thread Matteo Beccati
mbeccati Fri, 25 Dec 2009 20:56:00 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=292633

Log:
- Updated ext/pgsql tests to work w/ PostgreSQL 8.5
# tested w/ 8.5alpha3

Changed paths:
U   php/php-src/branches/PHP_5_2/ext/pgsql/tests/10pg_convert.phpt
A + php/php-src/branches/PHP_5_2/ext/pgsql/tests/10pg_convert_85.phpt
(from 
php/php-src/branches/PHP_5_2/ext/pgsql/tests/10pg_convert.phpt:r292601)
U   php/php-src/branches/PHP_5_2/ext/pgsql/tests/12pg_insert.phpt
A + php/php-src/branches/PHP_5_2/ext/pgsql/tests/12pg_insert_85.phpt
(from 
php/php-src/branches/PHP_5_2/ext/pgsql/tests/12pg_insert.phpt:r292601)
U   php/php-src/branches/PHP_5_2/ext/pgsql/tests/13pg_select.phpt
A + php/php-src/branches/PHP_5_2/ext/pgsql/tests/13pg_select_85.phpt
(from 
php/php-src/branches/PHP_5_2/ext/pgsql/tests/13pg_select.phpt:r292601)
U   php/php-src/branches/PHP_5_2/ext/pgsql/tests/14pg_update.phpt
A + php/php-src/branches/PHP_5_2/ext/pgsql/tests/14pg_update_85.phpt
(from 
php/php-src/branches/PHP_5_2/ext/pgsql/tests/14pg_update.phpt:r292601)
U   php/php-src/branches/PHP_5_2/ext/pgsql/tests/bug37100.phpt
A + php/php-src/branches/PHP_5_2/ext/pgsql/tests/bug37100_85.phpt
(from 
php/php-src/branches/PHP_5_2/ext/pgsql/tests/bug37100.phpt:r292601)
U   php/php-src/branches/PHP_5_2/ext/pgsql/tests/skipif.inc
U   php/php-src/branches/PHP_5_3/ext/pgsql/tests/10pg_convert.phpt
A + php/php-src/branches/PHP_5_3/ext/pgsql/tests/10pg_convert_85.phpt
(from 
php/php-src/branches/PHP_5_3/ext/pgsql/tests/10pg_convert.phpt:r292601)
U   php/php-src/branches/PHP_5_3/ext/pgsql/tests/12pg_insert.phpt
A + php/php-src/branches/PHP_5_3/ext/pgsql/tests/12pg_insert_85.phpt
(from 
php/php-src/branches/PHP_5_3/ext/pgsql/tests/12pg_insert.phpt:r292601)
U   php/php-src/branches/PHP_5_3/ext/pgsql/tests/13pg_select.phpt
A + php/php-src/branches/PHP_5_3/ext/pgsql/tests/13pg_select_85.phpt
(from 
php/php-src/branches/PHP_5_3/ext/pgsql/tests/13pg_select.phpt:r292601)
U   php/php-src/branches/PHP_5_3/ext/pgsql/tests/14pg_update.phpt
A + php/php-src/branches/PHP_5_3/ext/pgsql/tests/14pg_update_85.phpt
(from 
php/php-src/branches/PHP_5_3/ext/pgsql/tests/14pg_update.phpt:r292601)
U   php/php-src/branches/PHP_5_3/ext/pgsql/tests/bug37100.phpt
A + php/php-src/branches/PHP_5_3/ext/pgsql/tests/bug37100_85.phpt
(from 
php/php-src/branches/PHP_5_3/ext/pgsql/tests/bug37100.phpt:r292601)
U   php/php-src/branches/PHP_5_3/ext/pgsql/tests/skipif.inc
U   php/php-src/trunk/ext/pgsql/tests/08escape.phpt
A + php/php-src/trunk/ext/pgsql/tests/08escape_85.phpt
(from php/php-src/trunk/ext/pgsql/tests/08escape.phpt:r292622)
U   php/php-src/trunk/ext/pgsql/tests/10pg_convert.phpt
A + php/php-src/trunk/ext/pgsql/tests/10pg_convert_85.phpt
(from php/php-src/trunk/ext/pgsql/tests/10pg_convert.phpt:r292622)
U   php/php-src/trunk/ext/pgsql/tests/12pg_insert.phpt
A + php/php-src/trunk/ext/pgsql/tests/12pg_insert_85.phpt
(from php/php-src/trunk/ext/pgsql/tests/12pg_insert.phpt:r292622)
U   php/php-src/trunk/ext/pgsql/tests/13pg_select.phpt
A + php/php-src/trunk/ext/pgsql/tests/13pg_select_85.phpt
(from php/php-src/trunk/ext/pgsql/tests/13pg_select.phpt:r292622)
U   php/php-src/trunk/ext/pgsql/tests/14pg_update.phpt
A + php/php-src/trunk/ext/pgsql/tests/14pg_update_85.phpt
(from php/php-src/trunk/ext/pgsql/tests/14pg_update.phpt:r292622)
U   php/php-src/trunk/ext/pgsql/tests/bug37100.phpt
A + php/php-src/trunk/ext/pgsql/tests/bug37100_85.phpt
(from php/php-src/trunk/ext/pgsql/tests/bug37100.phpt:r292622)
U   php/php-src/trunk/ext/pgsql/tests/skipif.inc

Modified: php/php-src/branches/PHP_5_2/ext/pgsql/tests/10pg_convert.phpt
===
--- php/php-src/branches/PHP_5_2/ext/pgsql/tests/10pg_convert.phpt	2009-12-25 20:34:59 UTC (rev 292632)
+++ php/php-src/branches/PHP_5_2/ext/pgsql/tests/10pg_convert.phpt	2009-12-25 20:56:00 UTC (rev 292633)
@@ -1,7 +1,10 @@
 --TEST--
 PostgreSQL pg_convert()
 --SKIPIF--
-?php include(skipif.inc); ?
+?php
+include(skipif.inc);
+skip_server_version('8.5dev', '=');
+?
 --FILE--
 ?php
 error_reporting(E_ALL);

Copied: php/php-src/branches/PHP_5_2/ext/pgsql/tests/10pg_convert_85.phpt (from rev 292601, php/php-src/branches/PHP_5_2/ext/pgsql/tests/10pg_convert.phpt)
===
--- php/php-src/branches/PHP_5_2/ext/pgsql/tests/10pg_convert_85.phpt	(rev 0)
+++ php/php-src/branches/PHP_5_2/ext/pgsql/tests/10pg_convert_85.phpt	2009-12-25 20:56:00 UTC (rev 292633)
@@ -0,0 +1,29 @@
+--TEST--
+PostgreSQL pg_convert() (8.5+)
+--SKIPIF--
+?php
+include(skipif.inc);
+skip_server_version('8.5dev', '');
+?
+--FILE--
+?php

[PHP-CVS] svn: /php/php-src/branches/ PHP_5_2/ext/pgsql/tests/13pg_select_85.phpt PHP_5_3/ext/pgsql/tests/13pg_select_85.phpt

2009-12-25 Thread Matteo Beccati
mbeccati Fri, 25 Dec 2009 21:01:06 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=292634

Log:
Removed spurious high-ascii char from previous commmit

Changed paths:
U   php/php-src/branches/PHP_5_2/ext/pgsql/tests/13pg_select_85.phpt
U   php/php-src/branches/PHP_5_3/ext/pgsql/tests/13pg_select_85.phpt

Modified: php/php-src/branches/PHP_5_2/ext/pgsql/tests/13pg_select_85.phpt
===
--- php/php-src/branches/PHP_5_2/ext/pgsql/tests/13pg_select_85.phpt
2009-12-25 20:56:00 UTC (rev 292633)
+++ php/php-src/branches/PHP_5_2/ext/pgsql/tests/13pg_select_85.phpt
2009-12-25 21:01:06 UTC (rev 292634)
@@ -1,5 +1,5 @@
 --TEST--
-PostgreSQL pg_select() (8.5�+)
+PostgreSQL pg_select() (8.5++)
 --SKIPIF--
 ?php
 include(skipif.inc);

Modified: php/php-src/branches/PHP_5_3/ext/pgsql/tests/13pg_select_85.phpt
===
--- php/php-src/branches/PHP_5_3/ext/pgsql/tests/13pg_select_85.phpt
2009-12-25 20:56:00 UTC (rev 292633)
+++ php/php-src/branches/PHP_5_3/ext/pgsql/tests/13pg_select_85.phpt
2009-12-25 21:01:06 UTC (rev 292634)
@@ -1,5 +1,5 @@
 --TEST--
-PostgreSQL pg_select() (8.5�+)
+PostgreSQL pg_select() (8.5+)
 --SKIPIF--
 ?php
 include(skipif.inc);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_3/ext/standard/ basic_functions.c dns.c php_dns.h

2010-01-07 Thread Matteo Beccati

Il 07/01/2010 12:12, Jani Taskinen ha scritto:

On 01/07/2010 01:02 PM, Sebastian Bergmann wrote:

sebastian Thu, 07 Jan 2010 11:02:39 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=293211

Log:
sed -i s#1997-2008#1997-2010#g **/*.c **/*.h

Bug: http://bugs.php.net/1997 (Bogus) Compilation Problems


Why is that commit script picking these without word 'bug' in the commit
message? Sebastian spammed a few reports now unintentionally..


I've noticed it before, but forgot to report it. Maybe changing the 
regex in:


http://svn.php.net/viewvc/SVNROOT/commit-bugs.php?revision=284714view=markuppathrev=291593

to:

$bug_pattern = 
'/(?:(pecl|pear|php)\s*)?(?:bug|#)[\s#:]*([0-9]+)(?=\s|$)/iuX';


would do the trick.


Cheers
--
Matteo Beccati

Development  Consulting - http://www.beccati.com/

--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_2/run-tests.php branches/PHP_5_3/run-tests.php trunk/run-tests.php

2010-08-17 Thread Matteo Beccati
Hi Kalle,

 + if ($value{$len - 1} == '') {
 + $value{0} = ';
 + $value{$len - 1} = ';
 + }

Aren't curly braces deprecated? ;)


Cheers
-- 
Matteo Beccati

Development  Consulting - http://www.beccati.com/

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/pgsql/tests/09notice.phpt branches/PHP_5_3/ext/pgsql/tests/22pg_fetch_object.phpt branches/PHP_5_3/ext/pgsql/tests/80_bug32223.phpt branches/PHP_5_3/e

2011-08-30 Thread Matteo Beccati
mbeccati Tue, 30 Aug 2011 14:01:03 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=315783

Log:
Fixed a few false positives on gcov for ext/pgsql

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/pgsql/tests/09notice.phpt
U   php/php-src/branches/PHP_5_3/ext/pgsql/tests/22pg_fetch_object.phpt
U   php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223.phpt
U   php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223b.phpt
A   php/php-src/branches/PHP_5_3/ext/pgsql/tests/lcmess.inc
U   php/php-src/branches/PHP_5_3/ext/pgsql/tests/skipif.inc
U   php/php-src/branches/PHP_5_4/ext/pgsql/tests/09notice.phpt
U   php/php-src/branches/PHP_5_4/ext/pgsql/tests/22pg_fetch_object.phpt
U   php/php-src/branches/PHP_5_4/ext/pgsql/tests/80_bug32223.phpt
U   php/php-src/branches/PHP_5_4/ext/pgsql/tests/80_bug32223b.phpt
A   php/php-src/branches/PHP_5_4/ext/pgsql/tests/lcmess.inc
U   php/php-src/branches/PHP_5_4/ext/pgsql/tests/skipif.inc
U   php/php-src/trunk/ext/pgsql/tests/09notice.phpt
U   php/php-src/trunk/ext/pgsql/tests/22pg_fetch_object.phpt
U   php/php-src/trunk/ext/pgsql/tests/80_bug32223.phpt
U   php/php-src/trunk/ext/pgsql/tests/80_bug32223b.phpt
A   php/php-src/trunk/ext/pgsql/tests/lcmess.inc
U   php/php-src/trunk/ext/pgsql/tests/skipif.inc

Modified: php/php-src/branches/PHP_5_3/ext/pgsql/tests/09notice.phpt
===
--- php/php-src/branches/PHP_5_3/ext/pgsql/tests/09notice.phpt	2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_3/ext/pgsql/tests/09notice.phpt	2011-08-30 14:01:03 UTC (rev 315783)
@@ -1,16 +1,25 @@
 --TEST--
 PostgreSQL notice function
 --SKIPIF--
-?php include(skipif.inc); ?
+?php
+
+include(skipif.inc);
+
+_skip_lc_messages();
+
+?
 --INI--
 pgsql.log_notice=1
 pgsql.ignore_notices=0
 --FILE--
 ?php
 include 'config.inc';
+include 'lcmess.inc';

 $db = pg_connect($conn_str);
-pg_exec($db, SET LC_MESSAGES='C';);
+
+_set_lc_messages();
+
 pg_query($db, BEGIN;);
 pg_query($db, BEGIN;);


Modified: php/php-src/branches/PHP_5_3/ext/pgsql/tests/22pg_fetch_object.phpt
===
--- php/php-src/branches/PHP_5_3/ext/pgsql/tests/22pg_fetch_object.phpt	2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_3/ext/pgsql/tests/22pg_fetch_object.phpt	2011-08-30 14:01:03 UTC (rev 315783)
@@ -16,7 +16,7 @@

 $db = pg_connect($conn_str);

-$sql = SELECT * FROM $table_name;
+$sql = SELECT * FROM $table_name WHERE num = 0;
 $result = pg_query($db, $sql) or die('Cannot qeury db');
 $rows = pg_num_rows($result);


Modified: php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223.phpt
===
--- php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223.phpt	2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223.phpt	2011-08-30 14:01:03 UTC (rev 315783)
@@ -3,6 +3,8 @@
 --SKIPIF--
 ?php
 require_once('skipif.inc');
+
+_skip_lc_messages();

 @pg_query($conn, CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL');
 $res = @pg_query($conn, CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
@@ -17,14 +19,15 @@
 ?php

 require_once('config.inc');
+require_once('lcmess.inc');

 $dbh = @pg_connect($conn_str);
 if (!$dbh) {
 	die (Could not connect to the server);
 }
-pg_exec($dbh, SET LC_MESSAGES='C';);

-//@pg_query($dbh, CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL');
+_set_lc_messages();
+
 $res = pg_query($dbh, CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
 begin
 RAISE NOTICE ''1'';

Modified: php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223b.phpt
===
--- php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223b.phpt	2011-08-30 13:54:41 UTC (rev 315782)
+++ php/php-src/branches/PHP_5_3/ext/pgsql/tests/80_bug32223b.phpt	2011-08-30 14:01:03 UTC (rev 315783)
@@ -3,6 +3,8 @@
 --SKIPIF--
 ?php
 require_once('skipif.inc');
+
+_skip_lc_messages();

 @pg_query($conn, CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL');
 $res = @pg_query($conn, CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
@@ -17,14 +19,15 @@
 ?php

 require_once('config.inc');
+require_once('lcmess.inc');

 define('dbh', pg_connect($conn_str));
 if (!dbh) {
 die (Could not connect to the server);
 }
-pg_exec(dbh, SET LC_MESSAGES='C';);

-//@pg_query(dbh, CREATE LANGUAGE 'plpgsql' HANDLER plpgsql_call_handler LANCOMPILER 'PL/pgSQL');
+_set_lc_messages();
+
 $res = pg_query(dbh, CREATE OR REPLACE FUNCTION test_notice() RETURNS boolean AS '
 begin
 RAISE NOTICE ''1'';

Added: php/php-src/branches/PHP_5_3/ext/pgsql/tests/lcmess.inc

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/curl/tests/curl_setopt_basic002.phpt branches/PHP_5_4/ext/curl/tests/curl_setopt_basic002.phpt trunk/ext/curl/tests/curl_setopt_basic002.phpt

2011-08-31 Thread Matteo Beccati
mbeccati Wed, 31 Aug 2011 22:12:53 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=315936

Log:
Fixed false positive failure on gcov

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/curl/tests/curl_setopt_basic002.phpt
U   php/php-src/branches/PHP_5_4/ext/curl/tests/curl_setopt_basic002.phpt
U   php/php-src/trunk/ext/curl/tests/curl_setopt_basic002.phpt

Modified: php/php-src/branches/PHP_5_3/ext/curl/tests/curl_setopt_basic002.phpt
===
--- php/php-src/branches/PHP_5_3/ext/curl/tests/curl_setopt_basic002.phpt   
2011-08-31 21:12:46 UTC (rev 315935)
+++ php/php-src/branches/PHP_5_3/ext/curl/tests/curl_setopt_basic002.phpt   
2011-08-31 22:12:53 UTC (rev 315936)
@@ -26,7 +26,7 @@

 fclose($handle);
 unset($handle);
-var_dump( file_get_contents($temp_file) );
+var_dump(preg_replace('/[\r\n]/', ' ', file_get_contents($temp_file)));
 @unlink($temp_file);

 ob_start(); // start output buffering
@@ -38,7 +38,7 @@

 fclose($handle);
 unset($handle);
-var_dump( file_get_contents($temp_file) );
+var_dump(preg_replace('/[\r\n]/', ' ', file_get_contents($temp_file)));
 @unlink($temp_file);

 curl_close($ch);

Modified: php/php-src/branches/PHP_5_4/ext/curl/tests/curl_setopt_basic002.phpt
===
--- php/php-src/branches/PHP_5_4/ext/curl/tests/curl_setopt_basic002.phpt   
2011-08-31 21:12:46 UTC (rev 315935)
+++ php/php-src/branches/PHP_5_4/ext/curl/tests/curl_setopt_basic002.phpt   
2011-08-31 22:12:53 UTC (rev 315936)
@@ -26,7 +26,7 @@

 fclose($handle);
 unset($handle);
-var_dump( file_get_contents($temp_file) );
+var_dump(preg_replace('/[\r\n]/', ' ', file_get_contents($temp_file)));
 @unlink($temp_file);

 ob_start(); // start output buffering
@@ -38,7 +38,7 @@

 fclose($handle);
 unset($handle);
-var_dump( file_get_contents($temp_file) );
+var_dump(preg_replace('/[\r\n]/', ' ', file_get_contents($temp_file)));
 @unlink($temp_file);

 curl_close($ch);

Modified: php/php-src/trunk/ext/curl/tests/curl_setopt_basic002.phpt
===
--- php/php-src/trunk/ext/curl/tests/curl_setopt_basic002.phpt  2011-08-31 
21:12:46 UTC (rev 315935)
+++ php/php-src/trunk/ext/curl/tests/curl_setopt_basic002.phpt  2011-08-31 
22:12:53 UTC (rev 315936)
@@ -26,7 +26,7 @@

 fclose($handle);
 unset($handle);
-var_dump( file_get_contents($temp_file) );
+var_dump(preg_replace('/[\r\n]/', ' ', file_get_contents($temp_file)));
 @unlink($temp_file);

 ob_start(); // start output buffering
@@ -38,7 +38,7 @@

 fclose($handle);
 unset($handle);
-var_dump( file_get_contents($temp_file) );
+var_dump(preg_replace('/[\r\n]/', ' ', file_get_contents($temp_file)));
 @unlink($temp_file);

 curl_close($ch);

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/iconv/tests/bug52941.phpt branches/PHP_5_4/ext/iconv/tests/bug52941.phpt trunk/ext/iconv/tests/bug52941.phpt

2011-08-31 Thread Matteo Beccati
mbeccati Wed, 31 Aug 2011 22:38:20 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=315937

Log:
Fixed test. Apparently it was already fixed on PHP_5_3 98% of the cases and
the fix wasn't ported to trunk/PHP_5_4. However the very same test was failing
on my FreeBSD 6.2 box, that appears to also decode the ks_c_5601-1987 parts,
so I've made the test more generic.

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/iconv/tests/bug52941.phpt
U   php/php-src/branches/PHP_5_4/ext/iconv/tests/bug52941.phpt
U   php/php-src/trunk/ext/iconv/tests/bug52941.phpt

Modified: php/php-src/branches/PHP_5_3/ext/iconv/tests/bug52941.phpt
===
--- php/php-src/branches/PHP_5_3/ext/iconv/tests/bug52941.phpt  2011-08-31 
22:12:53 UTC (rev 315936)
+++ php/php-src/branches/PHP_5_3/ext/iconv/tests/bug52941.phpt  2011-08-31 
22:38:20 UTC (rev 315937)
@@ -28,14 +28,14 @@
 var_dump($decoded['X-Bar']);
 var_dump($decoded['To']);
 ?
---EXPECT--
+--EXPECTF--
 string(17) f...@example.com
-string(29) =?ks_c_5601-1987?B?UkU6odk=?=
-string(33) =?ks_c_5601-1987?B?UkU6odk=?= Foo
-string(32) =?ks_c_5601-1987?B?UkU6odk=?=Foo
+string(%d) %s
+string(%d) %sFoo
+string(%d) %sFoo
 string(18) t...@example.com
 string(17) f...@example.com
-string(29) =?ks_c_5601-1987?B?UkU6odk=?=
-string(33) =?ks_c_5601-1987?B?UkU6odk=?= Foo
-string(32) =?ks_c_5601-1987?B?UkU6odk=?=Foo
+string(%d) %s
+string(%d) %sFoo
+string(%d) %sFoo
 string(18) t...@example.com

Modified: php/php-src/branches/PHP_5_4/ext/iconv/tests/bug52941.phpt
===
--- php/php-src/branches/PHP_5_4/ext/iconv/tests/bug52941.phpt  2011-08-31 
22:12:53 UTC (rev 315936)
+++ php/php-src/branches/PHP_5_4/ext/iconv/tests/bug52941.phpt  2011-08-31 
22:38:20 UTC (rev 315937)
@@ -28,14 +28,14 @@
 var_dump($decoded['X-Bar']);
 var_dump($decoded['To']);
 ?
---EXPECT--
+--EXPECTF--
 string(17) f...@example.com
-string(29) =?ks_c_5601-1987?B?UkU6odk=?=
-string(33) =?ks_c_5601-1987?B?UkU6odk=?= Foo
-string(33) =?ks_c_5601-1987?B?UkU6odk=?= Foo
+string(%d) %s
+string(%d) %sFoo
+string(%d) %sFoo
 string(18) t...@example.com
 string(17) f...@example.com
-string(29) =?ks_c_5601-1987?B?UkU6odk=?=
-string(33) =?ks_c_5601-1987?B?UkU6odk=?= Foo
-string(33) =?ks_c_5601-1987?B?UkU6odk=?= Foo
+string(%d) %s
+string(%d) %sFoo
+string(%d) %sFoo
 string(18) t...@example.com

Modified: php/php-src/trunk/ext/iconv/tests/bug52941.phpt
===
--- php/php-src/trunk/ext/iconv/tests/bug52941.phpt 2011-08-31 22:12:53 UTC 
(rev 315936)
+++ php/php-src/trunk/ext/iconv/tests/bug52941.phpt 2011-08-31 22:38:20 UTC 
(rev 315937)
@@ -28,14 +28,14 @@
 var_dump($decoded['X-Bar']);
 var_dump($decoded['To']);
 ?
---EXPECT--
+--EXPECTF--
 string(17) f...@example.com
-string(29) =?ks_c_5601-1987?B?UkU6odk=?=
-string(33) =?ks_c_5601-1987?B?UkU6odk=?= Foo
-string(33) =?ks_c_5601-1987?B?UkU6odk=?= Foo
+string(%d) %s
+string(%d) %sFoo
+string(%d) %sFoo
 string(18) t...@example.com
 string(17) f...@example.com
-string(29) =?ks_c_5601-1987?B?UkU6odk=?=
-string(33) =?ks_c_5601-1987?B?UkU6odk=?= Foo
-string(33) =?ks_c_5601-1987?B?UkU6odk=?= Foo
+string(%d) %s
+string(%d) %sFoo
+string(%d) %sFoo
 string(18) t...@example.com

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/curl/tests/curl_error_basic.phpt branches/PHP_5_4/ext/curl/tests/curl_error_basic.phpt trunk/ext/curl/tests/curl_error_basic.phpt

2011-08-31 Thread Matteo Beccati
mbeccati Thu, 01 Sep 2011 00:45:56 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=315940

Log:
Fixed test randomly failing due to different error messages. Also added a skip
section in case fakeURL resolves to an IP address, as some empty error
messages and HTML can be seen in the reports

Changed paths:
U   php/php-src/branches/PHP_5_3/ext/curl/tests/curl_error_basic.phpt
U   php/php-src/branches/PHP_5_4/ext/curl/tests/curl_error_basic.phpt
U   php/php-src/trunk/ext/curl/tests/curl_error_basic.phpt

Modified: php/php-src/branches/PHP_5_3/ext/curl/tests/curl_error_basic.phpt
===
--- php/php-src/branches/PHP_5_3/ext/curl/tests/curl_error_basic.phpt   
2011-08-31 23:42:04 UTC (rev 315939)
+++ php/php-src/branches/PHP_5_3/ext/curl/tests/curl_error_basic.phpt   
2011-09-01 00:45:56 UTC (rev 315940)
@@ -4,7 +4,15 @@
 Mattijs Hoitink mattijshoit...@gmail.com
 #Testfest Utrecht 2009
 --SKIPIF--
-?php if (!extension_loaded(curl)) print skip; ?
+?php
+
+if (!extension_loaded(curl)) die(skip\n);
+
+$url = fakeURL;
+$ip = gethostbyname($url);
+if ($ip != $url) die(skip 'fakeURL' resolves to $ip\n);
+
+?
 --FILE--
 ?php
 /*
@@ -21,13 +29,13 @@

 // cURL handler
 $ch = curl_init($url);
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

-ob_start(); // start output buffering
 curl_exec($ch);
-echo Error:  . curl_error($ch);
+var_dump(curl_error($ch));
 curl_close($ch);

 ?
---EXPECT--
+--EXPECTF--
 == Testing curl_error with a fake URL ==
-Error: Couldn't resolve host 'fakeURL'
+string(%d) %sfakeURL%s

Modified: php/php-src/branches/PHP_5_4/ext/curl/tests/curl_error_basic.phpt
===
--- php/php-src/branches/PHP_5_4/ext/curl/tests/curl_error_basic.phpt   
2011-08-31 23:42:04 UTC (rev 315939)
+++ php/php-src/branches/PHP_5_4/ext/curl/tests/curl_error_basic.phpt   
2011-09-01 00:45:56 UTC (rev 315940)
@@ -4,7 +4,15 @@
 Mattijs Hoitink mattijshoit...@gmail.com
 #Testfest Utrecht 2009
 --SKIPIF--
-?php if (!extension_loaded(curl)) print skip; ?
+?php
+
+if (!extension_loaded(curl)) die(skip\n);
+
+$url = fakeURL;
+$ip = gethostbyname($url);
+if ($ip != $url) die(skip 'fakeURL' resolves to $ip\n);
+
+?
 --FILE--
 ?php
 /*
@@ -21,13 +29,13 @@

 // cURL handler
 $ch = curl_init($url);
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

-ob_start(); // start output buffering
 curl_exec($ch);
-echo Error:  . curl_error($ch);
+var_dump(curl_error($ch));
 curl_close($ch);

 ?
---EXPECT--
+--EXPECTF--
 == Testing curl_error with a fake URL ==
-Error: Couldn't resolve host 'fakeURL'
+string(%d) %sfakeURL%s

Modified: php/php-src/trunk/ext/curl/tests/curl_error_basic.phpt
===
--- php/php-src/trunk/ext/curl/tests/curl_error_basic.phpt  2011-08-31 
23:42:04 UTC (rev 315939)
+++ php/php-src/trunk/ext/curl/tests/curl_error_basic.phpt  2011-09-01 
00:45:56 UTC (rev 315940)
@@ -4,7 +4,15 @@
 Mattijs Hoitink mattijshoit...@gmail.com
 #Testfest Utrecht 2009
 --SKIPIF--
-?php if (!extension_loaded(curl)) print skip; ?
+?php
+
+if (!extension_loaded(curl)) die(skip\n);
+
+$url = fakeURL;
+$ip = gethostbyname($url);
+if ($ip != $url) die(skip 'fakeURL' resolves to $ip\n);
+
+?
 --FILE--
 ?php
 /*
@@ -21,13 +29,13 @@

 // cURL handler
 $ch = curl_init($url);
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

-ob_start(); // start output buffering
 curl_exec($ch);
-echo Error:  . curl_error($ch);
+var_dump(curl_error($ch));
 curl_close($ch);

 ?
---EXPECT--
+--EXPECTF--
 == Testing curl_error with a fake URL ==
-Error: Couldn't resolve host 'fakeURL'
+string(%d) %sfakeURL%s

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-CVS] svn: /php/php-src/ branches/PHP_5_4/ext/session/tests/rfc1867_invalid_settings.phpt branches/PHP_5_4/ext/session/tests/rfc1867_invalid_settings_2.phpt trunk/ext/session/tests/rfc1867_inv

2011-09-11 Thread Matteo Beccati
On 10/09/2011 20:46, Stas Malyshev wrote:
 Hi!
 care to comment?
 
 It looks like neither me nor others (inluding gcov machine) are getting
 that message.

I do. Pls check the message I've sent a few days ago to the internals
ML. I was asking feedback about it as it seemed to be a weird behaviour
and I wasn't sure that updating the test was the correct solution.


Cheers
-- 
Matteo Beccati

Development  Consulting - http://www.beccati.com/

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ext/pdo_firebird/ EXPERIMENTAL

2011-09-12 Thread Matteo Beccati
On 12/09/2011 00:11, Popa Adrian Marius wrote:
 mariuz   Sun, 11 Sep 2011 22:11:30 +
 
 Revision: http://svn.php.net/viewvc?view=revisionrevision=316506
 
 Log:
 extension is not experimental anymore
 see the status http://www.gn0s1s.nl/?p=108

Is it really so? I was under the impression that there were quite a few
issues in the PDO Firebird driver. Not to mention the pretty high number
of failing tests...


Cheers
-- 
Matteo Beccati

Development  Consulting - http://www.beccati.com/

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-CVS] svn: /php/php-src/branches/PHP_5_4/ext/pdo_firebird/tests/ rowCount.phpt

2011-09-12 Thread Matteo Beccati
On 12/09/2011 15:41, Popa Adrian Marius wrote:
 mariuz   Mon, 12 Sep 2011 13:41:28 +
 
 Revision: http://svn.php.net/viewvc?view=revisionrevision=316540
 
 Log:
 fix warning Warning: ibase_drop_db(): lock time-out on wait transaction object
 
 Changed paths:
 U   php/php-src/branches/PHP_5_4/ext/pdo_firebird/tests/rowCount.phpt
 
 Modified: php/php-src/branches/PHP_5_4/ext/pdo_firebird/tests/rowCount.phpt
 ===
 --- php/php-src/branches/PHP_5_4/ext/pdo_firebird/tests/rowCount.phpt 
 2011-09-12 13:39:57 UTC (rev 316539)
 +++ php/php-src/branches/PHP_5_4/ext/pdo_firebird/tests/rowCount.phpt 
 2011-09-12 13:41:28 UTC (rev 316540)
 @@ -38,6 +38,7 @@
 
  $dbh-exec('DROP TABLE testz');
 
 +unset($stmt);
  unset($dbh);
 
  ?

Isn't this just hiding a problem?


Cheers
-- 
Matteo Beccati

Development  Consulting - http://www.beccati.com/

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] svn: /php/php-src/ branches/PHP_5_3/ext/pdo/tests/bug_43139.phpt branches/PHP_5_4/ext/pdo/tests/bug_43139.phpt trunk/ext/pdo/tests/bug_43139.phpt

2012-01-02 Thread Matteo Beccati
mbeccati Mon, 02 Jan 2012 11:43:25 +

Revision: http://svn.php.net/viewvc?view=revisionrevision=321675

Log:
Bug #55663, fixed test for bug 43139 on Firebird. Per request from mariuz

Bugs: https://bugs.php.net/55663 (error getting bug information)
  https://bugs.php.net/43139 (error getting bug information)
  
Changed paths:
U   php/php-src/branches/PHP_5_3/ext/pdo/tests/bug_43139.phpt
U   php/php-src/branches/PHP_5_4/ext/pdo/tests/bug_43139.phpt
U   php/php-src/trunk/ext/pdo/tests/bug_43139.phpt

Modified: php/php-src/branches/PHP_5_3/ext/pdo/tests/bug_43139.phpt
===
--- php/php-src/branches/PHP_5_3/ext/pdo/tests/bug_43139.phpt   2012-01-02 
10:37:12 UTC (rev 321674)
+++ php/php-src/branches/PHP_5_3/ext/pdo/tests/bug_43139.phpt   2012-01-02 
11:43:25 UTC (rev 321675)
@@ -20,6 +20,8 @@
 $from = '';
 if ($db-getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') {
$from = 'from dual';
+} else if ($db-getAttribute(PDO::ATTR_DRIVER_NAME) == 'firebird') {
+   $from = 'FROM RDB$DATABASE';
 }

 var_dump($db-query(select 0 as abc, 1 as xyz, 2 as def 
$from)-fetchAll(PDO::FETCH_GROUP));

Modified: php/php-src/branches/PHP_5_4/ext/pdo/tests/bug_43139.phpt
===
--- php/php-src/branches/PHP_5_4/ext/pdo/tests/bug_43139.phpt   2012-01-02 
10:37:12 UTC (rev 321674)
+++ php/php-src/branches/PHP_5_4/ext/pdo/tests/bug_43139.phpt   2012-01-02 
11:43:25 UTC (rev 321675)
@@ -20,6 +20,8 @@
 $from = '';
 if ($db-getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') {
$from = 'from dual';
+} else if ($db-getAttribute(PDO::ATTR_DRIVER_NAME) == 'firebird') {
+   $from = 'FROM RDB$DATABASE';
 }

 var_dump($db-query(select 0 as abc, 1 as xyz, 2 as def 
$from)-fetchAll(PDO::FETCH_GROUP));

Modified: php/php-src/trunk/ext/pdo/tests/bug_43139.phpt
===
--- php/php-src/trunk/ext/pdo/tests/bug_43139.phpt  2012-01-02 10:37:12 UTC 
(rev 321674)
+++ php/php-src/trunk/ext/pdo/tests/bug_43139.phpt  2012-01-02 11:43:25 UTC 
(rev 321675)
@@ -20,6 +20,8 @@
 $from = '';
 if ($db-getAttribute(PDO::ATTR_DRIVER_NAME) == 'oci') {
$from = 'from dual';
+} else if ($db-getAttribute(PDO::ATTR_DRIVER_NAME) == 'firebird') {
+   $from = 'FROM RDB$DATABASE';
 }

 var_dump($db-query(select 0 as abc, 1 as xyz, 2 as def 
$from)-fetchAll(PDO::FETCH_GROUP));

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-CVS] com php-src: Slightly edited tests and fix for bug #62024: ext/pdo_firebird/firebird_statement.c ext/pdo_firebird/tests/bug_62024.phpt

2013-05-31 Thread Matteo Beccati
Commit:510498947ee350a7c60c576bb17911fd2d2880c8
Author:Matteo Beccati mbecc...@php.net Fri, 31 May 2013 16:19:58 
+0200
Parents:   df6ca450ce1bebb7a36c0d2eecb51a28ac2f5118
Branches:  PHP-5.3 PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=510498947ee350a7c60c576bb17911fd2d2880c8

Log:
Slightly edited tests and fix for bug #62024

Bugs:
https://bugs.php.net/62024

Changed paths:
  M  ext/pdo_firebird/firebird_statement.c
  M  ext/pdo_firebird/tests/bug_62024.phpt


Diff:
diff --git a/ext/pdo_firebird/firebird_statement.c 
b/ext/pdo_firebird/firebird_statement.c
index e172133..2b57cd8 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.c
@@ -535,12 +535,14 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, 
struct pdo_bound_param_dat
int force_null;

case IS_LONG:
-   var-sqltype = (sizeof(long) == 8 ? 
SQL_INT64 : SQL_LONG) + (var-sqltype  1);
+   /* keep the allow-NULL flag */
+   var-sqltype = (sizeof(long) == 8 ? 
SQL_INT64 : SQL_LONG) | (var-sqltype  1);
var-sqldata = 
(void*)Z_LVAL_P(param-parameter);
var-sqllen = sizeof(long);
break;
case IS_DOUBLE:
-   var-sqltype = SQL_DOUBLE + 
(var-sqltype  1);
+   /* keep the allow-NULL flag */
+   var-sqltype = SQL_DOUBLE | 
(var-sqltype  1);
var-sqldata = 
(void*)Z_DVAL_P(param-parameter);
var-sqllen = sizeof(double);
break;
@@ -560,7 +562,8 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, 
struct pdo_bound_param_dat
force_null = 
(Z_STRLEN_P(param-parameter) == 0);
}
if (!force_null) {
-   var-sqltype = SQL_TEXT + 
(var-sqltype  1);
+   /* keep the allow-NULL flag */
+   var-sqltype = SQL_TEXT | 
(var-sqltype  1);
var-sqldata = 
Z_STRVAL_P(param-parameter);
var-sqllen  = 
Z_STRLEN_P(param-parameter);
break;
diff --git a/ext/pdo_firebird/tests/bug_62024.phpt 
b/ext/pdo_firebird/tests/bug_62024.phpt
index 3daef68..e046879 100644
--- a/ext/pdo_firebird/tests/bug_62024.phpt
+++ b/ext/pdo_firebird/tests/bug_62024.phpt
@@ -21,8 +21,8 @@ $dbh-commit();
 $sql = insert into test_insert (id, text) values (?, ?);
 $sttmt = $dbh-prepare($sql);
 
-$args_ok = [1, test1];
-$args_err = [2, null];
+$args_ok = array(1, test1);
+$args_err = array(2, null);
 
 $res = $sttmt-execute($args_ok);
 var_dump($res);


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: NEWS: NEWS

2013-05-31 Thread Matteo Beccati
Commit:bf4a034e3e506799ecf4d20247533eec4ee94875
Author:Matteo Beccati mbecc...@php.net Fri, 31 May 2013 16:22:53 
+0200
Parents:   510498947ee350a7c60c576bb17911fd2d2880c8
Branches:  PHP-5.3 PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=bf4a034e3e506799ecf4d20247533eec4ee94875

Log:
NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 0b9e7cb..7889832 100644
--- a/NEWS
+++ b/NEWS
@@ -2,8 +2,14 @@ PHP
NEWS
 |||
 ?? ??? 2013, PHP 5.3.27
 
+- PDO_firebird:
+  . Fixed bug #64037 (Firebird return wrong value for numeric field).
+(Matheus Degiovani, Matteo)
+  . Fixed bug #62024 (Cannot insert second row with null using parametrized
+query). (patch by ja...@kenjim.com, Matheus Degiovani, Matteo)
+
 - PDO_pgsql:
-  . Fixed Bug #64949 (Buffer overflow in _pdo_pgsql_error). (Remi)
+  . Fixed bug #64949 (Buffer overflow in _pdo_pgsql_error). (Remi)
 
 ?? ??? 2013, PHP 5.3.26


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed bug #62024 (unable to run consecutive prepared querys with null values): ext/pdo_firebird/firebird_statement.c ext/pdo_firebird/tests/bug_62024.phpt

2013-05-31 Thread Matteo Beccati
Commit:df6ca450ce1bebb7a36c0d2eecb51a28ac2f5118
Author:Matheus Degiovani math...@gigatron.com.br Fri, 22 Mar 2013 
10:39:36 -0300
Committer: Matteo Beccati mat...@beccati.com  Fri, 31 May 2013 14:30:57 
+0200
Parents:   65d233f06c6e274f9559880a7c187b35932b1918
Branches:  PHP-5.3 PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=df6ca450ce1bebb7a36c0d2eecb51a28ac2f5118

Log:
Fixed bug #62024 (unable to run consecutive prepared querys with null values)

Credits to ja...@kenjim.com for the patch.

Bugs:
https://bugs.php.net/62024

Changed paths:
  M  ext/pdo_firebird/firebird_statement.c
  A  ext/pdo_firebird/tests/bug_62024.phpt


Diff:
diff --git a/ext/pdo_firebird/firebird_statement.c 
b/ext/pdo_firebird/firebird_statement.c
index ffe9b3c..e172133 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.c
@@ -535,12 +535,12 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, 
struct pdo_bound_param_dat
int force_null;

case IS_LONG:
-   var-sqltype = sizeof(long) == 8 ? 
SQL_INT64 : SQL_LONG;
+   var-sqltype = (sizeof(long) == 8 ? 
SQL_INT64 : SQL_LONG) + (var-sqltype  1);
var-sqldata = 
(void*)Z_LVAL_P(param-parameter);
var-sqllen = sizeof(long);
break;
case IS_DOUBLE:
-   var-sqltype = SQL_DOUBLE;
+   var-sqltype = SQL_DOUBLE + 
(var-sqltype  1);
var-sqldata = 
(void*)Z_DVAL_P(param-parameter);
var-sqllen = sizeof(double);
break;
@@ -560,7 +560,7 @@ static int firebird_stmt_param_hook(pdo_stmt_t *stmt, 
struct pdo_bound_param_dat
force_null = 
(Z_STRLEN_P(param-parameter) == 0);
}
if (!force_null) {
-   var-sqltype = SQL_TEXT;
+   var-sqltype = SQL_TEXT + 
(var-sqltype  1);
var-sqldata = 
Z_STRVAL_P(param-parameter);
var-sqllen  = 
Z_STRLEN_P(param-parameter);
break;
diff --git a/ext/pdo_firebird/tests/bug_62024.phpt 
b/ext/pdo_firebird/tests/bug_62024.phpt
new file mode 100644
index 000..3daef68
--- /dev/null
+++ b/ext/pdo_firebird/tests/bug_62024.phpt
@@ -0,0 +1,51 @@
+--TEST--
+Bug #62024 Cannot insert second row with null using parametrized query 
(Firebird PDO)
+--SKIPIF--
+?php extension_loaded(pdo_firebird) or die(skip); ?
+?php function_exists(ibase_query) or die(skip); ?
+--FILE--
+?php
+
+require(testdb.inc);
+
+$dbh = new PDO(firebird:dbname=$test_base,$user,$password) or die;
+$dbh-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+$value = '2';
+@$dbh-exec('DROP TABLE test_insert');
+$dbh-exec(CREATE TABLE test_insert (ID INTEGER NOT NULL, TEXT VARCHAR(10)));
+
+$dbh-commit();
+
+//start actual test
+
+$sql = insert into test_insert (id, text) values (?, ?);
+$sttmt = $dbh-prepare($sql);
+
+$args_ok = [1, test1];
+$args_err = [2, null];
+
+$res = $sttmt-execute($args_ok);
+var_dump($res);
+
+$res = $sttmt-execute($args_err);
+var_dump($res);
+
+$dbh-commit();
+
+
+//teardown test data
+$sttmt = $dbh-prepare('DELETE FROM test_insert');
+$sttmt-execute();
+
+$dbh-commit();
+
+$dbh-exec('DROP TABLE test_insert');
+
+unset($sttmt);
+unset($dbh);
+
+?
+--EXPECT--
+bool(true)
+bool(true)
+


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed bug #64037 (wrong value returned when using a negative numeric field equal to the scale): ext/pdo_firebird/firebird_statement.c ext/pdo_firebird/tests/bug_64037.phpt

2013-05-31 Thread Matteo Beccati
Commit:65d233f06c6e274f9559880a7c187b35932b1918
Author:Matheus Degiovani math...@gigatron.com.br Fri, 22 Mar 2013 
10:24:07 -0300
Committer: Matteo Beccati mat...@beccati.com  Fri, 31 May 2013 14:30:51 
+0200
Parents:   1c623e3b07128e78362911ff5754e7eee57fa8bb
Branches:  PHP-5.3 PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=65d233f06c6e274f9559880a7c187b35932b1918

Log:
Fixed bug #64037 (wrong value returned when using a negative numeric field 
equal to the scale)

Bugs:
https://bugs.php.net/64037

Changed paths:
  M  ext/pdo_firebird/firebird_statement.c
  A  ext/pdo_firebird/tests/bug_64037.phpt


Diff:
diff --git a/ext/pdo_firebird/firebird_statement.c 
b/ext/pdo_firebird/firebird_statement.c
index 5c3e435..ffe9b3c 100644
--- a/ext/pdo_firebird/firebird_statement.c
+++ b/ext/pdo_firebird/firebird_statement.c
@@ -344,7 +344,7 @@ static int firebird_stmt_get_col(pdo_stmt_t *stmt, int 
colno, char **ptr,  /* {{
if (n = 0) {
*len = slprintf(*ptr, CHAR_BUF_LEN, % LL_MASK 
d.%0* LL_MASK d, 
n / f, -var-sqlscale, n % f);
-   } else if (n  -f) {
+   } else if (n = -f) {
*len = slprintf(*ptr, CHAR_BUF_LEN, % LL_MASK 
d.%0* LL_MASK d,
n / f, -var-sqlscale, -n % f); 

 } else {
diff --git a/ext/pdo_firebird/tests/bug_64037.phpt 
b/ext/pdo_firebird/tests/bug_64037.phpt
new file mode 100644
index 000..f7b53e5
--- /dev/null
+++ b/ext/pdo_firebird/tests/bug_64037.phpt
@@ -0,0 +1,45 @@
+--TEST--
+Bug #64037 Firebird return wrong value for numeric field
+--SKIPIF--
+?php extension_loaded(pdo_firebird) or die(skip); ?
+?php function_exists(ibase_query) or die(skip); ?
+--FILE--
+?php
+
+require(testdb.inc);
+
+$dbh = new PDO(firebird:dbname=$test_base,$user,$password) or die;
+$dbh-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
+$value = '2';
+@$dbh-exec('DROP TABLE price');
+$dbh-exec(CREATE TABLE PRICE (ID INTEGER NOT NULL, TEXT VARCHAR(10), COST 
NUMERIC(15, 2)));
+$dbh-exec(INSERT INTO PRICE (ID, TEXT, COST) VALUES (1, 'test', -1.0));
+$dbh-exec(INSERT INTO PRICE (ID, TEXT, COST) VALUES (2, 'test', -0.99));
+$dbh-exec(INSERT INTO PRICE (ID, TEXT, COST) VALUES (3, 'test', -1.01));
+
+$dbh-commit();
+
+$query = SELECT * from price order by ID;
+$stmt = $dbh-prepare($query);
+$stmt-execute();
+$rows = $stmt-fetchAll();
+var_dump($rows[0]['COST']);
+var_dump($rows[1]['COST']);
+var_dump($rows[2]['COST']);
+
+
+$stmt = $dbh-prepare('DELETE FROM price');
+$stmt-execute();
+
+$dbh-commit();
+
+$dbh-exec('DROP TABLE price');
+
+unset($stmt);
+unset($dbh);
+
+?
+--EXPECT--
+string(5) -1.00
+string(5) -0.99
+string(5) -1.01
\ No newline at end of file


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed bug #62857 (bytea test failures): ext/pgsql/tests/10pg_convert_85.phpt ext/pgsql/tests/12pg_insert_85.phpt ext/pgsql/tests/14pg_update_85.phpt ext/pgsql/tests/18pg_escape_

2013-06-01 Thread Matteo Beccati
Commit:79803bebdea2827d66c0f96fd3dbaf4a2747ff27
Author:Matteo Beccati mbecc...@php.net Sat, 1 Jun 2013 23:15:48 
+0200
Parents:   598e2690b81a145589f6dfe06f77d9e3b66a7853
Branches:  PHP-5.3 PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=79803bebdea2827d66c0f96fd3dbaf4a2747ff27

Log:
Fixed bug #62857 (bytea test failures)

Postgres 9.1+ test fixes. Tests were failing due to the default
standard_conforming_strings GUC being changed to on. Also the
pg_escape_bytea test was encoding the data before estabilishing
a connection, thus falling back to the old escaping type which
isn't properly handled by the backend when using a default
configuration.

I haven't updated the NEWS file as it's just test fixes.

Bugs:
https://bugs.php.net/62857

Changed paths:
  M  ext/pgsql/tests/10pg_convert_85.phpt
  M  ext/pgsql/tests/12pg_insert_85.phpt
  M  ext/pgsql/tests/14pg_update_85.phpt
  M  ext/pgsql/tests/18pg_escape_bytea.phpt


Diff:
diff --git a/ext/pgsql/tests/10pg_convert_85.phpt 
b/ext/pgsql/tests/10pg_convert_85.phpt
index 4f1c92b..8b1cc8f 100644
--- a/ext/pgsql/tests/10pg_convert_85.phpt
+++ b/ext/pgsql/tests/10pg_convert_85.phpt
@@ -12,6 +12,7 @@ error_reporting(E_ALL);
 include 'config.inc';
 
 $db = pg_connect($conn_str);
+pg_query($db, SET standard_conforming_strings = 0);
 
 $fields = array('num'='1234', 'str'='AAA', 'bin'='BBB');
 $converted = pg_convert($db, $table_name, $fields);
diff --git a/ext/pgsql/tests/12pg_insert_85.phpt 
b/ext/pgsql/tests/12pg_insert_85.phpt
index a85dea0..5fbbe4b 100644
--- a/ext/pgsql/tests/12pg_insert_85.phpt
+++ b/ext/pgsql/tests/12pg_insert_85.phpt
@@ -12,6 +12,8 @@ error_reporting(E_ALL);
 include 'config.inc';
 
 $db = pg_connect($conn_str);
+pg_query($db, SET standard_conforming_strings = 0);
+
 $fields = array('num'='1234', 'str'='AAA', 'bin'='BBB');
 
 pg_insert($db, $table_name, $fields) or print Error in test 1\n;
diff --git a/ext/pgsql/tests/14pg_update_85.phpt 
b/ext/pgsql/tests/14pg_update_85.phpt
index f1c77ea..06ca8c3 100644
--- a/ext/pgsql/tests/14pg_update_85.phpt
+++ b/ext/pgsql/tests/14pg_update_85.phpt
@@ -12,6 +12,8 @@ error_reporting(E_ALL);
 include 'config.inc';
 
 $db = pg_connect($conn_str);
+pg_query($db, SET standard_conforming_strings = 0);
+
 $fields = array('num'='1234', 'str'='ABC', 'bin'='XYZ');
 $ids = array('num'='1234');
 
diff --git a/ext/pgsql/tests/18pg_escape_bytea.phpt 
b/ext/pgsql/tests/18pg_escape_bytea.phpt
index 43f98c4..5f52a17 100644
--- a/ext/pgsql/tests/18pg_escape_bytea.phpt
+++ b/ext/pgsql/tests/18pg_escape_bytea.phpt
@@ -8,10 +8,11 @@ PostgreSQL pg_escape_bytea() functions
 
 include('config.inc');
 
+$db = pg_connect($conn_str);
+
 $image = file_get_contents(dirname(__FILE__) . '/php.gif');
 $esc_image = pg_escape_bytea($image);
 
-$db = pg_connect($conn_str);
 pg_query($db, 'INSERT INTO '.$table_name.' (num, bin) VALUES (9876, 
\''.$esc_image.'\');');
 $result = pg_query($db, 'SELECT * FROM '.$table_name.' WHERE num = 9876');
 $rows = pg_fetch_all($result);


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: ext/pgsql/pgsql.c

2013-06-01 Thread Matteo Beccati
Commit:51c065f611c563c4b9fc0432be27fafd99424d8e
Author:Matteo Beccati mbecc...@php.net Sun, 2 Jun 2013 06:33:54 
+0200
Parents:   de428331158a8850c1bb7b1b187efb52c34a6b34 
25aae37229a439109c020150d0f496ef4a237ecd
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=51c065f611c563c4b9fc0432be27fafd99424d8e

Log:
Merge branch 'PHP-5.3' into PHP-5.4

* PHP-5.3:
  Fixed bug #64609 (pg_convert enum type support)

Bugs:
https://bugs.php.net/64609

Changed paths:
  MM  ext/pgsql/pgsql.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed bug #64609 (pg_convert enum type support): NEWS ext/pgsql/pgsql.c ext/pgsql/tests/bug64609.phpt

2013-06-01 Thread Matteo Beccati
Commit:25aae37229a439109c020150d0f496ef4a237ecd
Author:Matteo Beccati mbecc...@php.net Sun, 2 Jun 2013 06:29:35 
+0200
Parents:   79803bebdea2827d66c0f96fd3dbaf4a2747ff27
Branches:  PHP-5.3 PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=25aae37229a439109c020150d0f496ef4a237ecd

Log:
Fixed bug #64609 (pg_convert enum type support)

Bugs:
https://bugs.php.net/64609

Changed paths:
  M  NEWS
  M  ext/pgsql/pgsql.c
  A  ext/pgsql/tests/bug64609.phpt


Diff:
diff --git a/NEWS b/NEWS
index 7889832..a1fbbcd 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,9 @@ PHP   
 NEWS
 - PDO_pgsql:
   . Fixed bug #64949 (Buffer overflow in _pdo_pgsql_error). (Remi)
 
+- pgsql:
+  - Fixed bug #64609 (pg_convert enum type support). (Matteo)
+
 ?? ??? 2013, PHP 5.3.26
 
 ### DO NOT ADD ENTRIES HERE, ADD THEM ABOVE FOR 5.3.27 ###
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index a0faed1..c5d9a4a 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -4875,7 +4875,7 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, 
const char *table_name, z
}
 
smart_str_appends(querystr, 
-   SELECT a.attname, a.attnum, t.typname, a.attlen, 
a.attnotNULL, a.atthasdef, a.attndims 
+   SELECT a.attname, a.attnum, t.typname, a.attlen, 
a.attnotnull, a.atthasdef, a.attndims, t.typtype = 'e' 
FROM pg_class as c, pg_attribute a, pg_type t, 
pg_namespace n 
WHERE a.attnum  0 AND a.attrelid = c.oid AND 
c.relname = ');
tmp_name2 = php_addslashes(tmp_name2, strlen(tmp_name2), new_len, 0 
TSRMLS_CC);
@@ -4921,6 +4921,12 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, 
const char *table_name, z
add_assoc_bool(elem, has default, 0);
}
add_assoc_long(elem, array dims, 
atoi(PQgetvalue(pg_result,i,6)));
+   if (!strcmp(PQgetvalue(pg_result,i,7), t)) {
+   add_assoc_bool(elem, is enum, 1);
+   }
+   else {
+   add_assoc_bool(elem, is enum, 0);
+   }
name = PQgetvalue(pg_result,i,0);
add_assoc_zval(meta, name, elem);
}
@@ -4954,7 +4960,18 @@ PHP_FUNCTION(pg_meta_data)
zval_dtor(return_value); /* destroy array */
RETURN_FALSE;
}
-} 
+   else {
+   HashPosition pos;
+   zval **val;
+
+   for 
(zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(return_value), pos);
+   zend_hash_get_current_data_ex(Z_ARRVAL_P(return_value), 
(void **)val, pos) == SUCCESS;
+   zend_hash_move_forward_ex(Z_ARRVAL_P(return_value), 
pos)) {
+   /* delete newly added entry, in order to keep BC */
+   zend_hash_del_key_or_index(Z_ARRVAL_PP(val), is enum, 
sizeof(is enum), 0, HASH_DEL_KEY);
+   }
+   }
+}
 /* }}} */
 
 /* {{{ php_pgsql_get_data_type
@@ -5136,8 +5153,9 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, 
const char *table_name, con
char *field = NULL;
uint field_len = -1;
ulong num_idx = -1;
-   zval *meta, **def, **type, **not_null, **has_default, **val, *new_val;
+   zval *meta, **def, **type, **not_null, **has_default, **is_enum, **val, 
*new_val;
int new_len, key_type, err = 0, skip_field;
+   php_pgsql_data_type data_type;

assert(pg_link != NULL);
assert(Z_TYPE_P(values) == IS_ARRAY);
@@ -5188,17 +5206,30 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, 
const char *table_name, con
php_error_docref(NULL TSRMLS_CC, E_NOTICE, Detected 
broken meta data. Missing 'has default');
err = 1;
}
+   if (!err  zend_hash_find(Z_ARRVAL_PP(def), is enum, 
sizeof(is enum), (void **)is_enum) == FAILURE) {
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Detected 
broken meta data. Missing 'is enum');
+   err = 1;
+   }
if (!err  (Z_TYPE_PP(val) == IS_ARRAY ||
 Z_TYPE_PP(val) == IS_OBJECT ||
 Z_TYPE_PP(val) == IS_CONSTANT_ARRAY)) {
-   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Expects 
scaler values as field values);
+   php_error_docref(NULL TSRMLS_CC, E_NOTICE, Expects 
scalar values as field values);
err = 1;
}
if (err) {
break; /* break out for() */
}
ALLOC_INIT_ZVAL(new_val);
-   switch(php_pgsql_get_data_type(Z_STRVAL_PP(type), 
Z_STRLEN_PP(type)))
+
+   if (Z_BVAL_PP(is_enum)) {
+   /* enums need to be treated like

[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/pgsql/pgsql.c

2013-06-01 Thread Matteo Beccati
Commit:d5a1c0cae2ec779f116bdb3f73a949c0234c1468
Author:Matteo Beccati mbecc...@php.net Sun, 2 Jun 2013 06:34:05 
+0200
Parents:   d9c2eecec0cbb9a7c032245308a72a913e092392 
51c065f611c563c4b9fc0432be27fafd99424d8e
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=d5a1c0cae2ec779f116bdb3f73a949c0234c1468

Log:
Merge branch 'PHP-5.4' into PHP-5.5

* PHP-5.4:
  Fixed bug #64609 (pg_convert enum type support)

Bugs:
https://bugs.php.net/64609

Changed paths:
  MM  ext/pgsql/pgsql.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Clean up leftover test files: ext/pdo_pgsql/tests/copy_from.phpt

2013-06-02 Thread Matteo Beccati
Commit:2463e8979470a8e61b17c28ae8f8f1dad63f856f
Author:Matteo Beccati mbecc...@php.net Sun, 2 Jun 2013 13:38:43 
+0200
Parents:   25aae37229a439109c020150d0f496ef4a237ecd
Branches:  PHP-5.3 PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=2463e8979470a8e61b17c28ae8f8f1dad63f856f

Log:
Clean up leftover test files

Changed paths:
  M  ext/pdo_pgsql/tests/copy_from.phpt


Diff:
diff --git a/ext/pdo_pgsql/tests/copy_from.phpt 
b/ext/pdo_pgsql/tests/copy_from.phpt
index 2858905..10967b0 100644
--- a/ext/pdo_pgsql/tests/copy_from.phpt
+++ b/ext/pdo_pgsql/tests/copy_from.phpt
@@ -110,8 +110,10 @@ $db-rollback();
echo Exception! at line , $e-getLine(), \n;
var_dump($e-getMessage());
 }
-if(isset($filename)) {
-   @unlink($filename);
+
+// Clean up 
+foreach (array($filename, $filenameWithDifferentNullValues, 
$filenameWithDifferentNullValuesAndSelectedFields) as $f) {
+   @unlink($f);
 }
 ?
 --EXPECT--
@@ -383,4 +385,4 @@ array(6) {
   NULL
 }
 Testing pgsqlCopyFromFile() with error
-bool(false)
\ No newline at end of file
+bool(false)


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Improved test portability so that it doesn't fail with pdo_pgsql: ext/pdo/tests/bug61292.phpt

2013-06-02 Thread Matteo Beccati
Commit:a98359b7b95e06f4ad2a3369e20550bdeeb1e0d1
Author:Matteo Beccati mbecc...@php.net Sun, 2 Jun 2013 13:32:48 
+0200
Parents:   cbf90b1a908d8f5c1799a1e206b968f393ba7d99
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=a98359b7b95e06f4ad2a3369e20550bdeeb1e0d1

Log:
Improved test portability so that it doesn't fail with pdo_pgsql

Changed paths:
  M  ext/pdo/tests/bug61292.phpt


Diff:
diff --git a/ext/pdo/tests/bug61292.phpt b/ext/pdo/tests/bug61292.phpt
index 2381fd1..05b2e9c 100644
--- a/ext/pdo/tests/bug61292.phpt
+++ b/ext/pdo/tests/bug61292.phpt
@@ -17,8 +17,15 @@ class Database_SQL extends PDO
 {
function __construct()
{
+$dsn = getenv('PDOTEST_DSN');
+$user = getenv('PDOTEST_USER');
+$pass = getenv('PDOTEST_PASS');
+
+if ($user === false) $user = NULL;
+if ($pass === false) $pass = NULL;
$options = array(PDO::ATTR_PERSISTENT = TRUE);
-   parent::__construct(getenv(PDOTEST_DSN), 
getenv(PDOTEST_USER), getenv(PDOTEST_PASS), $options);
+
+   parent::__construct($dsn, $user, $pass, $options);
}
 
var $bar = array();


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fix PDO::inTransaction() test for pgsql: ext/pdo_pgsql/tests/is_in_transaction.phpt

2013-06-02 Thread Matteo Beccati
Commit:cbf90b1a908d8f5c1799a1e206b968f393ba7d99
Author:Nikita Popov ni...@php.net Sun, 24 Mar 2013 17:52:16 +0100
Committer: Matteo Beccati mbecc...@php.net  Sun, 2 Jun 2013 13:28:30 +0200
Parents:   51c065f611c563c4b9fc0432be27fafd99424d8e
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=cbf90b1a908d8f5c1799a1e206b968f393ba7d99

Log:
Fix PDO::inTransaction() test for pgsql

inTransaction() nowadays casts the in_transaction result to boolean.
I'm not sure whether the INERROR state should result in true or false.
For now I went with the result that we actually get.

Changed paths:
  M  ext/pdo_pgsql/tests/is_in_transaction.phpt


Diff:
diff --git a/ext/pdo_pgsql/tests/is_in_transaction.phpt 
b/ext/pdo_pgsql/tests/is_in_transaction.phpt
index 99ff561..72da4f4 100644
--- a/ext/pdo_pgsql/tests/is_in_transaction.phpt
+++ b/ext/pdo_pgsql/tests/is_in_transaction.phpt
@@ -57,10 +57,10 @@ var_dump($db-inTransaction());
 ?
 --EXPECT--
 Test PDO::PGSQL_TRANSACTION_INTRANS
-int(2)
+bool(true)
 Test PDO::PGSQL_TRANSACTION_IDLE
-int(0)
+bool(false)
 Test PDO::PGSQL_TRANSACTION_INERROR
-int(3)
+bool(true)
 Test PDO::PGSQL_TRANSACTION_IDLE
-int(0)
+bool(false)


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Refactored custom PDO_pgsql methods to trigger errors/exceptions: ext/pdo_pgsql/pgsql_driver.c ext/pdo_pgsql/php_pdo_pgsql_int.h ext/pdo_pgsql/tests/copy_from.phpt ext/pdo_pgsql

2013-06-04 Thread Matteo Beccati
Commit:baabd1192973156ac79c35f6d1b0dced4af8e8fb
Author:Matteo Beccati mbecc...@php.net Tue, 4 Jun 2013 17:20:20 
+0200
Parents:   1e36e45d97da9e212b00f339c90b995908efa70c
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=baabd1192973156ac79c35f6d1b0dced4af8e8fb

Log:
Refactored custom PDO_pgsql methods to trigger errors/exceptions

BC Break: the custom methods were previously just return false on
failure. Now they throw an exception with a proper error message.
An hopefully welcome improvement, but some application might be
depending on the old behaviour. FWIW the PDO::pgsqlCopy* methods
are not documented, even though they are available since 5.3.x.

Changed paths:
  M  ext/pdo_pgsql/pgsql_driver.c
  M  ext/pdo_pgsql/php_pdo_pgsql_int.h
  M  ext/pdo_pgsql/tests/copy_from.phpt
  M  ext/pdo_pgsql/tests/copy_to.phpt

diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index 252bfff..a83fb4c 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -29,6 +29,7 @@
 #include ext/standard/info.h
 #include pdo/php_pdo.h
 #include pdo/php_pdo_driver.h
+#include pdo/php_pdo_error.h
 #include ext/standard/file.h
 
 #undef PACKAGE_BUGREPORT
@@ -60,7 +61,7 @@ static char * _pdo_pgsql_trim_message(const char *message, 
int persistent)
return tmp;
 }
 
-int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char 
*sqlstate, const char *file, int line TSRMLS_DC) /* {{{ */
+int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int errcode, const char 
*sqlstate, const char *msg, const char *file, int line TSRMLS_DC) /* {{{ */
 {
pdo_pgsql_db_handle *H = (pdo_pgsql_db_handle *)dbh-driver_data;
pdo_error_type *pdo_err = stmt ? stmt-error_code : dbh-error_code;
@@ -83,7 +84,10 @@ int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int 
errcode, const char *
strcpy(*pdo_err, sqlstate);
}
 
-   if (errmsg) {
+   if (msg) {
+   einfo-errmsg = estrdup(msg);
+   }
+   else if (errmsg) {
einfo-errmsg = _pdo_pgsql_trim_message(errmsg, 
dbh-is_persistent);
}
 
@@ -91,7 +95,7 @@ int _pdo_pgsql_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, int 
errcode, const char *
zend_throw_exception_ex(php_pdo_get_exception(), einfo-errcode 
TSRMLS_CC, SQLSTATE[%s] [%d] %s,
*pdo_err, einfo-errcode, einfo-errmsg);
}
-   
+
return errcode;
 }
 /* }}} */
@@ -535,6 +539,7 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray)
 
dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
PDO_CONSTRUCT_CHECK;
+   PDO_DBH_CLEAR_ERR();
 
if (pg_fields) {
spprintf(query, 0, COPY %s (%s) FROM STDIN DELIMITERS E'%c' 
WITH NULL AS E'%s', table_name, pg_fields, (pg_delim_len ? *pg_delim : '\t'), 
(pg_null_as_len ? pg_null_as : N));
@@ -583,7 +588,8 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray)
query[query_len] = '\0';
if (PQputCopyData(H-server, query, query_len) != 1) {
efree(query);
-   pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, copy 
failed);
+   pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL);
+   PDO_HANDLE_DBH_ERR();
RETURN_FALSE;
}
zend_hash_move_forward_ex(Z_ARRVAL_P(pg_rows), pos);
@@ -593,22 +599,25 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray)
}
 
if (PQputCopyEnd(H-server, NULL) != 1) {
-   pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, putcopyend 
failed);
+   pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, NULL);
+   PDO_HANDLE_DBH_ERR();
RETURN_FALSE;
}
 
while ((pgsql_result = PQgetResult(H-server))) {
if (PGRES_COMMAND_OK != PQresultStatus(pgsql_result)) {
-   pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, Copy 
command failed);
+   pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, 
pdo_pgsql_sqlstate(pgsql_result));
command_failed = 1;
}
PQclear(pgsql_result);
}
 
+   PDO_HANDLE_DBH_ERR();
RETURN_BOOL(!command_failed);
} else {
+   pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, 
pdo_pgsql_sqlstate(pgsql_result));
PQclear(pgsql_result);
-   pdo_pgsql_error(dbh, PGRES_FATAL_ERROR, Copy command failed);
+   PDO_HANDLE_DBH_ERR();
RETURN_FALSE;
}
 }
@@ -637,10 +646,12 @@ static PHP_METHOD(PDO, pgsqlCopyFromFile)
/* Obtain db Handler */
dbh = zend_object_store_get_object(getThis() TSRMLS_CC

[PHP-CVS] com php-src: Allow PDO drivers custom methods to trigger errors/exceptions: ext/pdo/Makefile.frag ext/pdo/php_pdo_error.h ext/pdo/php_pdo_int.h

2013-06-04 Thread Matteo Beccati
Commit:1e36e45d97da9e212b00f339c90b995908efa70c
Author:Matteo Beccati mbecc...@php.net Tue, 4 Jun 2013 16:49:16 
+0200
Parents:   b144c263191f857391d3cc009951c95d25a2cdb3
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=1e36e45d97da9e212b00f339c90b995908efa70c

Log:
Allow PDO drivers custom methods to trigger errors/exceptions

Moved a few definitions from php_pdo_int.h to a new php_pdo_error.h
header file that can be included if drivers need PDO's own error
handling to be triggered within custom methods (e.g. PDO::pgsqlLOBOpen).

Changed paths:
  M  ext/pdo/Makefile.frag
  A  ext/pdo/php_pdo_error.h
  M  ext/pdo/php_pdo_int.h


Diff:
diff --git a/ext/pdo/Makefile.frag b/ext/pdo/Makefile.frag
index 5ba5f80..dc25c9f 100644
--- a/ext/pdo/Makefile.frag
+++ b/ext/pdo/Makefile.frag
@@ -2,7 +2,8 @@ phpincludedir=$(prefix)/include/php
 
 PDO_HEADER_FILES= \
php_pdo.h \
-   php_pdo_driver.h
+   php_pdo_driver.h \
+   php_pdo_error.h
 
 
 $(srcdir)/pdo_sql_parser.c: $(srcdir)/pdo_sql_parser.re
diff --git a/ext/pdo/php_pdo_error.h b/ext/pdo/php_pdo_error.h
new file mode 100644
index 000..13d45eb
--- /dev/null
+++ b/ext/pdo/php_pdo_error.h
@@ -0,0 +1,47 @@
+/*
+  +--+
+  | PHP Version 5|
+  +--+
+  | Copyright (c) 1997-2013 The PHP Group|
+  +--+
+  | This source file is subject to version 3.01 of the PHP license,  |
+  | that is bundled with this package in the file LICENSE, and is|
+  | available through the world-wide-web at the following url:   |
+  | http://www.php.net/license/3_01.txt  |
+  | If you did not receive a copy of the PHP license and are unable to   |
+  | obtain it through the world-wide-web, please send a note to  |
+  | lice...@php.net so we can mail you a copy immediately.   |
+  +--+
+  | Author: Wez Furlong w...@php.net|
+  +--+
+*/
+
+/* $Id$ */
+
+#ifndef PHP_PDO_ERROR_H
+#define PHP_PDO_ERROR_H
+
+#include php_pdo_driver.h
+
+extern void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC);
+
+#define PDO_DBH_CLEAR_ERR() do { \
+   strlcpy(dbh-error_code, PDO_ERR_NONE, sizeof(PDO_ERR_NONE)); \
+   if (dbh-query_stmt) { \
+   dbh-query_stmt = NULL; \
+   zend_objects_store_del_ref(dbh-query_stmt_zval TSRMLS_CC); \
+   } \
+} while (0)
+#define PDO_STMT_CLEAR_ERR()strcpy(stmt-error_code, PDO_ERR_NONE)
+#define PDO_HANDLE_DBH_ERR()if (strcmp(dbh-error_code, PDO_ERR_NONE)) { 
pdo_handle_error(dbh, NULL TSRMLS_CC); }
+#define PDO_HANDLE_STMT_ERR()   if (strcmp(stmt-error_code, PDO_ERR_NONE)) { 
pdo_handle_error(stmt-dbh, stmt TSRMLS_CC); }
+
+#endif /* PHP_PDO_ERROR_H */
+/*
+ * Local variables:
+ * tab-width: 4
+ * c-basic-offset: 4
+ * End:
+ * vim600: noet sw=4 ts=4 fdm=marker
+ * vim600: noet sw=4 ts=4
+ */
diff --git a/ext/pdo/php_pdo_int.h b/ext/pdo/php_pdo_int.h
index 91d0bf0..59dbaf9 100644
--- a/ext/pdo/php_pdo_int.h
+++ b/ext/pdo/php_pdo_int.h
@@ -23,6 +23,8 @@
 /* Stuff private to the PDO extension and not for consumption by PDO drivers
  * */
 
+#include php_pdo_error.h
+
 extern HashTable pdo_driver_hash;
 extern zend_class_entry *pdo_exception_ce;
 PDO_API zend_class_entry *php_pdo_get_exception_base(int root TSRMLS_DC);
@@ -55,19 +57,6 @@ zend_object_iterator 
*php_pdo_dbstmt_iter_get(zend_class_entry *ce, zval *object
 
 extern pdo_driver_t *pdo_find_driver(const char *name, int namelen);
 
-extern void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt TSRMLS_DC);
-
-#define PDO_DBH_CLEAR_ERR()do { \
-   strlcpy(dbh-error_code, PDO_ERR_NONE, sizeof(PDO_ERR_NONE)); \
-   if (dbh-query_stmt) { \
-   dbh-query_stmt = NULL; \
-   zend_objects_store_del_ref(dbh-query_stmt_zval TSRMLS_CC); \
-   } \
-} while (0)
-#define PDO_STMT_CLEAR_ERR()   strcpy(stmt-error_code, PDO_ERR_NONE)
-#define PDO_HANDLE_DBH_ERR()   if (strcmp(dbh-error_code, PDO_ERR_NONE)) { 
pdo_handle_error(dbh, NULL TSRMLS_CC); }
-#define PDO_HANDLE_STMT_ERR()  if (strcmp(stmt-error_code, PDO_ERR_NONE)) { 
pdo_handle_error(stmt-dbh, stmt TSRMLS_CC); }
-
 int pdo_sqlstate_init_error_table(void);
 void pdo_sqlstate_fini_error_table(void);
 const char *pdo_sqlstate_state_to_description(char *state);


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed Bug #42614 (PDO_pgsql: add pg_get_notify support): ext/pdo_pgsql/pgsql_driver.c ext/pdo_pgsql/tests/getnotify.phpt

2013-06-04 Thread Matteo Beccati
Commit:b62b8b45286e7e8a69b04fc6aaf28f838c9a5951
Author:Matteo Beccati mbecc...@php.net Sun, 2 Jun 2013 14:00:40 
+0200
Parents:   baabd1192973156ac79c35f6d1b0dced4af8e8fb
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=b62b8b45286e7e8a69b04fc6aaf28f838c9a5951

Log:
Fixed Bug #42614 (PDO_pgsql: add pg_get_notify support)

Bugs:
https://bugs.php.net/42614

Changed paths:
  M  ext/pdo_pgsql/pgsql_driver.c
  A  ext/pdo_pgsql/tests/getnotify.phpt


Diff:
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index a83fb4c..fab06d7 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -27,6 +27,7 @@
 #include php.h
 #include php_ini.h
 #include ext/standard/info.h
+#include main/php_network.h
 #include pdo/php_pdo.h
 #include pdo/php_pdo_driver.h
 #include pdo/php_pdo_error.h
@@ -1006,6 +1007,84 @@ static PHP_METHOD(PDO, pgsqlLOBUnlink)
 }
 /* }}} */
 
+/* {{{ proto mixed PDO::pgsqlGetNotify([ int $result_type = 
PDO::FETCH_USE_DEFAULT] [, int $ms_timeout = 0 ]])
+   Get asyncronous notification */
+static PHP_METHOD(PDO, pgsqlGetNotify)
+{
+   pdo_dbh_t *dbh;
+   pdo_pgsql_db_handle *H;
+   long result_type = PDO_FETCH_USE_DEFAULT;
+   long ms_timeout = 0;
+   PGnotify *pgsql_notify;
+
+   if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |ll,
+   result_type, ms_timeout)) {
+   RETURN_FALSE;
+   }
+
+   dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
+   PDO_CONSTRUCT_CHECK;
+
+   if (result_type == PDO_FETCH_USE_DEFAULT) {
+   result_type = dbh-default_fetch_type;
+   }
+
+   if (result_type != PDO_FETCH_BOTH  result_type != PDO_FETCH_ASSOC  
result_type != PDO_FETCH_NUM) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid result 
type);
+   RETURN_FALSE;
+   }
+
+   if (ms_timeout  0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Invalid timeout);
+   RETURN_FALSE;
+   }
+
+   H = (pdo_pgsql_db_handle *)dbh-driver_data;
+
+   PQconsumeInput(H-server);
+   pgsql_notify = PQnotifies(H-server);
+
+   if (ms_timeout  !pgsql_notify) {
+   php_pollfd_for_ms(PQsocket(H-server), PHP_POLLREADABLE, 
ms_timeout);
+
+   PQconsumeInput(H-server);
+   pgsql_notify = PQnotifies(H-server);
+   }
+
+   if (!pgsql_notify) {
+   RETURN_FALSE;
+   }
+
+   array_init(return_value);
+   if (result_type == PDO_FETCH_NUM || result_type == PDO_FETCH_BOTH) {
+   add_index_string(return_value, 0, pgsql_notify-relname, 1);
+   add_index_long(return_value, 1, pgsql_notify-be_pid);
+   }
+   if (result_type == PDO_FETCH_ASSOC || result_type == PDO_FETCH_BOTH) {
+   add_assoc_string(return_value, message, 
pgsql_notify-relname, 1);
+   add_assoc_long(return_value, pid, pgsql_notify-be_pid);
+   }
+
+   PQfreemem(pgsql_notify);
+}
+/* }}} */
+
+/* {{{ proto int PDO::pgsqlGetPid()
+   Get backend(server) pid */
+static PHP_METHOD(PDO, pgsqlGetPid)
+{
+   pdo_dbh_t *dbh;
+   pdo_pgsql_db_handle *H;
+
+   dbh = zend_object_store_get_object(getThis() TSRMLS_CC);
+   PDO_CONSTRUCT_CHECK;
+
+   H = (pdo_pgsql_db_handle *)dbh-driver_data;
+
+   RETURN_LONG(PQbackendPID(H-server));
+}
+/* }}} */
+
 
 static const zend_function_entry dbh_methods[] = {
PHP_ME(PDO, pgsqlLOBCreate, NULL, ZEND_ACC_PUBLIC)
@@ -1015,6 +1094,8 @@ static const zend_function_entry dbh_methods[] = {
PHP_ME(PDO, pgsqlCopyFromFile, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PDO, pgsqlCopyToArray, NULL, ZEND_ACC_PUBLIC)
PHP_ME(PDO, pgsqlCopyToFile, NULL, ZEND_ACC_PUBLIC)
+PHP_ME(PDO, pgsqlGetNotify, NULL, ZEND_ACC_PUBLIC)
+PHP_ME(PDO, pgsqlGetPid, NULL, ZEND_ACC_PUBLIC)
PHP_FE_END
 };
 
diff --git a/ext/pdo_pgsql/tests/getnotify.phpt 
b/ext/pdo_pgsql/tests/getnotify.phpt
new file mode 100644
index 000..c093e03
--- /dev/null
+++ b/ext/pdo_pgsql/tests/getnotify.phpt
@@ -0,0 +1,109 @@
+--TEST--
+PDO PgSQL LISTEN/NOTIFY support
+--SKIPIF--
+?php # vim:se ft=php:
+if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) die('skip not 
loaded');
+require dirname(__FILE__) . '/config.inc';
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+PDOTest::skip();
+?
+--FILE--
+?php
+require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
+$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
+$db-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
+
+// pgsqlGetPid should return something meaningful
+$pid = $db-pgsqlGetPid();
+var_dump($pid  0);
+
+// No listen, no notifies
+var_dump($db-pgsqlGetNotify());
+
+// Listen started, no notifies
+$db-exec(LISTEN notifies_phpt);
+var_dump($db-pgsqlGetNotify());
+
+// No parameters, use default PDO

[PHP-CVS] com php-src: NEWS: NEWS

2013-06-07 Thread Matteo Beccati
Commit:2f7f34374c3a39a4664d1a80c530c7edb52bb97c
Author:Matteo Beccati mbecc...@php.net Fri, 7 Jun 2013 09:27:42 
+0200
Parents:   fbf1dff6742cee9bdacacd0d5ec25fa15803cd16
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=2f7f34374c3a39a4664d1a80c530c7edb52bb97c

Log:
NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index 5d9b713..c55ce0c 100644
--- a/NEWS
+++ b/NEWS
@@ -12,4 +12,7 @@ PHP   
 NEWS
 cache_slots) in op_array-literals table. (Laruence, Dmitry)
   . Added script level constant replacement optimization pass. (Dmitry)
 
+- PDO_pgsql
+  . Fixed Bug #42614 (PDO_pgsql: add pg_get_notify support). (Matteo)
+
  NOTE: Insert NEWS from last stable release here prior to actual release! 



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed bug #63657 (pgsqlCopyFrom/To methods use Postgres 7.3 syntax): ext/pdo_pgsql/pgsql_driver.c

2013-06-07 Thread Matteo Beccati
Commit:19ead23e8ec1e09bce080139a92d372ff1a8416b
Author:Matteo Beccati mbecc...@php.net Fri, 7 Jun 2013 09:23:00 
+0200
Parents:   2f7f34374c3a39a4664d1a80c530c7edb52bb97c
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=19ead23e8ec1e09bce080139a92d372ff1a8416b

Log:
Fixed bug #63657 (pgsqlCopyFrom/To methods use Postgres  7.3 syntax)

Although still supported (for now), I've replaced with pre-9.0 syntax.
Still not cutting edge, but it works with any version PDO_pgsql is
compatible with (7.4+) and will possibly keep working for longer than
what we already had.

Bugs:
https://bugs.php.net/63657

Changed paths:
  M  ext/pdo_pgsql/pgsql_driver.c


Diff:
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index fab06d7..03cc5a0 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -542,10 +542,11 @@ static PHP_METHOD(PDO, pgsqlCopyFromArray)
PDO_CONSTRUCT_CHECK;
PDO_DBH_CLEAR_ERR();
 
+   /* using pre-9.0 syntax as PDO_pgsql is 7.4+ compatible */
if (pg_fields) {
-   spprintf(query, 0, COPY %s (%s) FROM STDIN DELIMITERS E'%c' 
WITH NULL AS E'%s', table_name, pg_fields, (pg_delim_len ? *pg_delim : '\t'), 
(pg_null_as_len ? pg_null_as : N));
+   spprintf(query, 0, COPY %s (%s) FROM STDIN WITH DELIMITER 
E'%c' NULL AS E'%s', table_name, pg_fields, (pg_delim_len ? *pg_delim : '\t'), 
(pg_null_as_len ? pg_null_as : N));
} else {
-   spprintf(query, 0, COPY %s FROM STDIN DELIMITERS E'%c' WITH 
NULL AS E'%s', table_name, (pg_delim_len ? *pg_delim : '\t'), (pg_null_as_len 
? pg_null_as : N));
+   spprintf(query, 0, COPY %s FROM STDIN WITH DELIMITER E'%c' 
NULL AS E'%s', table_name, (pg_delim_len ? *pg_delim : '\t'), (pg_null_as_len 
? pg_null_as : N));
}
 
/* Obtain db Handle */
@@ -656,10 +657,11 @@ static PHP_METHOD(PDO, pgsqlCopyFromFile)
RETURN_FALSE;
}
 
+   /* using pre-9.0 syntax as PDO_pgsql is 7.4+ compatible */
if (pg_fields) {
-   spprintf(query, 0, COPY %s (%s) FROM STDIN DELIMITERS E'%c' 
WITH NULL AS E'%s', table_name, pg_fields, (pg_delim_len ? *pg_delim : '\t'), 
(pg_null_as_len ? pg_null_as : N));
+   spprintf(query, 0, COPY %s (%s) FROM STDIN WITH DELIMITER 
E'%c' NULL AS E'%s', table_name, pg_fields, (pg_delim_len ? *pg_delim : '\t'), 
(pg_null_as_len ? pg_null_as : N));
} else {
-   spprintf(query, 0, COPY %s FROM STDIN DELIMITERS E'%c' WITH 
NULL AS E'%s', table_name, (pg_delim_len ? *pg_delim : '\t'), (pg_null_as_len 
? pg_null_as : N));
+   spprintf(query, 0, COPY %s FROM STDIN WITH DELIMITER E'%c' 
NULL AS E'%s', table_name, (pg_delim_len ? *pg_delim : '\t'), (pg_null_as_len 
? pg_null_as : N));
}
 
H = (pdo_pgsql_db_handle *)dbh-driver_data;
@@ -761,10 +763,11 @@ static PHP_METHOD(PDO, pgsqlCopyToFile)
PQclear(pgsql_result);
}
 
+   /* using pre-9.0 syntax as PDO_pgsql is 7.4+ compatible */
if (pg_fields) {
-   spprintf(query, 0, COPY %s (%s) TO STDIN DELIMITERS E'%c' 
WITH NULL AS E'%s', table_name, pg_fields, (pg_delim_len ? *pg_delim : '\t'), 
(pg_null_as_len ? pg_null_as : N));
+   spprintf(query, 0, COPY %s (%s) TO STDIN WITH DELIMITER E'%c' 
NULL AS E'%s', table_name, pg_fields, (pg_delim_len ? *pg_delim : '\t'), 
(pg_null_as_len ? pg_null_as : N));
} else {
-   spprintf(query, 0, COPY %s TO STDIN DELIMITERS E'%c' WITH 
NULL AS E'%s', table_name, (pg_delim_len ? *pg_delim : '\t'), (pg_null_as_len 
? pg_null_as : N));
+   spprintf(query, 0, COPY %s TO STDIN WITH DELIMITER E'%c' NULL 
AS E'%s', table_name, (pg_delim_len ? *pg_delim : '\t'), (pg_null_as_len ? 
pg_null_as : N));
}
pgsql_result = PQexec(H-server, query);
efree(query);
@@ -846,10 +849,11 @@ static PHP_METHOD(PDO, pgsqlCopyToArray)
PQclear(pgsql_result);
}
 
+   /* using pre-9.0 syntax as PDO_pgsql is 7.4+ compatible */
if (pg_fields) {
-   spprintf(query, 0, COPY %s (%s) TO STDIN DELIMITERS E'%c' 
WITH NULL AS E'%s', table_name, pg_fields, (pg_delim_len ? *pg_delim : '\t'), 
(pg_null_as_len ? pg_null_as : N));
+   spprintf(query, 0, COPY %s (%s) TO STDIN WITH DELIMITER E'%c' 
NULL AS E'%s', table_name, pg_fields, (pg_delim_len ? *pg_delim : '\t'), 
(pg_null_as_len ? pg_null_as : N));
} else {
-   spprintf(query, 0, COPY %s TO STDIN DELIMITERS E'%c' WITH 
NULL AS E'%s', table_name, (pg_delim_len ? *pg_delim : '\t'), (pg_null_as_len 
? pg_null_as : N));
+   spprintf(query, 0, COPY %s TO STDIN WITH DELIMITER E'%c' NULL 
AS E'%s', table_name, (pg_delim_len ? *pg_delim : '\t'), (pg_null_as_len ? 
pg_null_as : N));
}
pgsql_result = PQexec(H-server

[PHP-CVS] com php-src: NEWS: NEWS

2013-06-07 Thread Matteo Beccati
Commit:a649f42b20b60bbac545f79e2112c99b663897d1
Author:Matteo Beccati mbecc...@php.net Fri, 7 Jun 2013 09:36:41 
+0200
Parents:   19ead23e8ec1e09bce080139a92d372ff1a8416b
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=a649f42b20b60bbac545f79e2112c99b663897d1

Log:
NEWS

Changed paths:
  M  NEWS


Diff:
diff --git a/NEWS b/NEWS
index c55ce0c..7516a6a 100644
--- a/NEWS
+++ b/NEWS
@@ -14,5 +14,7 @@ PHP   
 NEWS
 
 - PDO_pgsql
   . Fixed Bug #42614 (PDO_pgsql: add pg_get_notify support). (Matteo)
+  . Fixed Bug #63657 (pgsqlCopyFromFile, pgsqlCopyToArray use Postgres  7.3
+syntax). (Matteo)
 
  NOTE: Insert NEWS from last stable release here prior to actual release! 



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed signedness warning: ext/pdo_pgsql/pgsql_driver.c

2013-06-07 Thread Matteo Beccati
Commit:2c0f09540e18371387eb291906f19b8b94e1ca5a
Author:Matteo Beccati mbecc...@php.net Fri, 7 Jun 2013 09:38:58 
+0200
Parents:   a649f42b20b60bbac545f79e2112c99b663897d1
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=2c0f09540e18371387eb291906f19b8b94e1ca5a

Log:
Fixed signedness warning

Changed paths:
  M  ext/pdo_pgsql/pgsql_driver.c


Diff:
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index 03cc5a0..80abb4b 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -320,7 +320,7 @@ static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char 
*unquoted, int unquote
case PDO_PARAM_LOB:
/* escapedlen returned by PQescapeBytea() accounts for 
trailing 0 */
 #ifdef HAVE_PQESCAPE_BYTEA_CONN
-   escaped = PQescapeByteaConn(H-server, unquoted, 
unquotedlen, tmp_len);
+   escaped = PQescapeByteaConn(H-server, (unsigned char 
*)unquoted, unquotedlen, tmp_len);
 #else
escaped = PQescapeBytea(unquoted, unquotedlen, 
tmp_len);
 #endif


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed bug #63186 (compile failure on netbsd): NEWS main/streams/cast.c

2013-06-14 Thread Matteo Beccati
Commit:6238dd6f3257bed9efe60a39978376862668e71c
Author:Matteo Beccati mbecc...@php.net Fri, 14 Jun 2013 16:51:54 
+0200
Parents:   cd1b44c4b6b67e77d8704a2a24e7c676f835a76d
Branches:  PHP-5.3 PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=6238dd6f3257bed9efe60a39978376862668e71c

Log:
Fixed bug #63186 (compile failure on netbsd)

Bugs:
https://bugs.php.net/63186

Changed paths:
  M  NEWS
  M  main/streams/cast.c


Diff:
diff --git a/NEWS b/NEWS
index 3c5b346..a0f9e2b 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ PHP 
   NEWS
   . Fixed bug #64966 (segfault in zend_do_fcall_common_helper_SPEC). (Laruence)
   . Fixed bug #64960 (Segfault in gc_zval_possible_root). (Laruence)
   . Fixed bug #64934 (Apache2 TS crash with get_browser()). (Anatol)
+  . Fixed bug #63186 (compile failure on netbsd). (Matteo)
 
 - DateTime:
   . Fixed bug #53437 (Crash when using unserialized DatePeriod instance).
diff --git a/main/streams/cast.c b/main/streams/cast.c
index 4063930..6f79a24 100644
--- a/main/streams/cast.c
+++ b/main/streams/cast.c
@@ -31,10 +31,18 @@
 
 /* Under BSD, emulate fopencookie using funopen */
 #if defined(HAVE_FUNOPEN)  !defined(HAVE_FOPENCOOKIE)
+
+/* NetBSD 6.0+ uses off_t instead of fpos_t in funopen */
+# if defined(__NetBSD__)  (__NetBSD_Version__  6)
+#  define PHP_FPOS_T off_t
+# else
+#  define PHP_FPOS_T fpos_t
+# endif
+
 typedef struct {
int (*reader)(void *, char *, int);
int (*writer)(void *, const char *, int);
-   fpos_t (*seeker)(void *, fpos_t, int);
+   PHP_FPOS_T (*seeker)(void *, PHP_FPOS_T, int);
int (*closer)(void *);
 } COOKIE_IO_FUNCTIONS_T;
 
@@ -68,11 +76,11 @@ static int stream_cookie_writer(void *cookie, const char 
*buffer, int size)
return php_stream_write((php_stream *)cookie, (char *)buffer, size);
 }
 
-static fpos_t stream_cookie_seeker(void *cookie, off_t position, int whence)
+static PHP_FPOS_T stream_cookie_seeker(void *cookie, off_t position, int 
whence)
 {
TSRMLS_FETCH();
 
-   return (fpos_t)php_stream_seek((php_stream *)cookie, position, whence);
+   return (PHP_FPOS_T)php_stream_seek((php_stream *)cookie, position, 
whence);
 }
 
 static int stream_cookie_closer(void *cookie)


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Merge branch 'PHP-5.3' into PHP-5.4: main/streams/cast.c

2013-06-14 Thread Matteo Beccati
Commit:02f552cecadf7fa0a77f179e02f4dcb33b267105
Author:Matteo Beccati mbecc...@php.net Fri, 14 Jun 2013 16:54:32 
+0200
Parents:   10b9579395641d96baf267bd880366aee690c1e0 
6238dd6f3257bed9efe60a39978376862668e71c
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=02f552cecadf7fa0a77f179e02f4dcb33b267105

Log:
Merge branch 'PHP-5.3' into PHP-5.4

* PHP-5.3:
  Fixed bug #63186 (compile failure on netbsd)

Bugs:
https://bugs.php.net/63186

Changed paths:
  MM  main/streams/cast.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Remove broken client version checking: ext/pgsql/tests/skipif.inc

2013-06-19 Thread Matteo Beccati
Commit:25e9aa6b0a86b2b3b098949b0fe866a5edeff02f
Author:Matteo Beccati mbecc...@php.net Wed, 19 Jun 2013 08:34:48 
+0200
Parents:   5edd53051169c0765479fc34d709814c8a0a0bda
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=25e9aa6b0a86b2b3b098949b0fe866a5edeff02f

Log:
Remove broken client version checking

Changed paths:
  M  ext/pgsql/tests/skipif.inc


Diff:
diff --git a/ext/pgsql/tests/skipif.inc b/ext/pgsql/tests/skipif.inc
index 7c5153e..59bd5a3 100644
--- a/ext/pgsql/tests/skipif.inc
+++ b/ext/pgsql/tests/skipif.inc
@@ -17,15 +17,11 @@ if (!is_resource($conn)) {
 die(skip could not connect\n);
 }
 
-function skip_server_version($version, $op = '') { _skip_version('server', 
$version, $op); }
-function skip_client_version($version, $op = '') { _skip_version('client', 
$version, $op); }
-
-
-function _skip_version($type, $version, $op)
+function skip_server_version($version, $op = '')
 {
-   $pg = pg_parameter_status($type.'_version');
+   $pg = pg_parameter_status('server_version');
if (version_compare($pg, $version, $op)) {
-   die(skip {$type} version {$pg} is {$op} {$version}\n);
+   die(skip Server version {$pg} is {$op} {$version}\n);
}
 }


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed bug #65047 (Test skip on client / server version): ext/pdo_pgsql/tests/bug46274.phpt ext/pdo_pgsql/tests/bug46274_2.phpt ext/pgsql/tests/08escape.phpt ext/pgsql/tests/10pg

2013-06-19 Thread Matteo Beccati
Commit:c666239265048abd3cc0b2c48493a5db1eacc28e
Author:Matteo Beccati mbecc...@php.net Wed, 19 Jun 2013 11:46:11 
+0200
Parents:   25e9aa6b0a86b2b3b098949b0fe866a5edeff02f
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=c666239265048abd3cc0b2c48493a5db1eacc28e

Log:
Fixed bug #65047 (Test skip on client / server version)

Bugs:
https://bugs.php.net/65047

Changed paths:
  M  ext/pdo_pgsql/tests/bug46274.phpt
  M  ext/pdo_pgsql/tests/bug46274_2.phpt
  M  ext/pgsql/tests/08escape.phpt
  M  ext/pgsql/tests/10pg_convert.phpt
  D  ext/pgsql/tests/10pg_convert_85.phpt
  A  ext/pgsql/tests/10pg_convert_9.phpt
  M  ext/pgsql/tests/12pg_insert.phpt
  D  ext/pgsql/tests/12pg_insert_85.phpt
  A  ext/pgsql/tests/12pg_insert_9.phpt
  D  ext/pgsql/tests/13pg_select_85.phpt
  A  ext/pgsql/tests/13pg_select_9.phpt
  M  ext/pgsql/tests/14pg_update.phpt
  D  ext/pgsql/tests/14pg_update_85.phpt
  A  ext/pgsql/tests/14pg_update_9.phpt
  D  ext/pgsql/tests/18pg_escape_bytea.phpt
  A  ext/pgsql/tests/18pg_escape_bytea_before.phpt
  A  ext/pgsql/tests/18pg_escape_bytea_esc.phpt
  A  ext/pgsql/tests/18pg_escape_bytea_hex.phpt
  M  ext/pgsql/tests/bug37100.phpt
  D  ext/pgsql/tests/bug37100_85.phpt
  A  ext/pgsql/tests/bug37100_9.phpt
  M  ext/pgsql/tests/skipif.inc

diff --git a/ext/pdo_pgsql/tests/bug46274.phpt 
b/ext/pdo_pgsql/tests/bug46274.phpt
index c34839a..8a85c9f 100644
--- a/ext/pdo_pgsql/tests/bug46274.phpt
+++ b/ext/pdo_pgsql/tests/bug46274.phpt
@@ -14,6 +14,11 @@ $db = PDOTest::test_factory(dirname(__FILE__) . 
'/common.phpt');
 
 $db-setAttribute(PDO::ATTR_STRINGIFY_FETCHES, true);
 
+try {
+   $db-query(SET bytea_output = 'escape');
+} catch (Exception $e) {
+}
+
 $db-query('CREATE TABLE test_one_blob (id SERIAL NOT NULL, blob1 BYTEA)');
 
 $stmt = $db-prepare(INSERT INTO test_one_blob (blob1) VALUES (:foo));
diff --git a/ext/pdo_pgsql/tests/bug46274_2.phpt 
b/ext/pdo_pgsql/tests/bug46274_2.phpt
index eb675af..317160c 100644
--- a/ext/pdo_pgsql/tests/bug46274_2.phpt
+++ b/ext/pdo_pgsql/tests/bug46274_2.phpt
@@ -14,6 +14,11 @@ $db = PDOTest::test_factory(dirname(__FILE__) . 
'/common.phpt');
 
 $db-setAttribute(PDO::ATTR_STRINGIFY_FETCHES, false);
 
+try {
+$db-query(SET bytea_output = 'escape');
+} catch (Exception $e) {
+}
+
 $db-query('CREATE TABLE test_one_blob (id SERIAL NOT NULL, blob1 BYTEA)');
 
 $stmt = $db-prepare(INSERT INTO test_one_blob (blob1) VALUES (:foo));
diff --git a/ext/pgsql/tests/08escape.phpt b/ext/pgsql/tests/08escape.phpt
index 90b4ed8..1bea35b 100644
--- a/ext/pgsql/tests/08escape.phpt
+++ b/ext/pgsql/tests/08escape.phpt
@@ -48,15 +48,24 @@ $sql = INSERT INTO .$table_name. (num, bin) VALUES 
(-, CAST ('.$escaped_
 pg_query($db, $sql);
 
 // Retrieve binary from DB
-$sql = SELECT bin::bytea FROM .$table_name. WHERE num = -;
-$result = pg_query($db, $sql);
-$row = pg_fetch_array($result, 0, PGSQL_ASSOC);
+for ($i = 0; $i  2; $i++) {
+   $sql = SELECT bin::bytea FROM .$table_name. WHERE num = -;
+   $result = pg_query($db, $sql);
+   $row = pg_fetch_array($result, 0, PGSQL_ASSOC);
 
-if ($data === pg_unescape_bytea($row['bin'])) {
-   echo pg_escape_bytea() actually works with database\n;
-}
-else {
-   echo pg_escape_bytea() is broken\n;
+   if ($data === pg_unescape_bytea($row['bin'])) {
+   echo pg_escape_bytea() actually works with database\n;
+   break;
+   }
+   elseif (!$i) {
+   // Force bytea escaping and retry
+   @pg_query($db, SET bytea_output = 'escape');
+   }
+   else {
+   $result = pg_query($db, $sql);
+   echo pg_escape_bytea() is broken\n;
+   break;
+   }
 }
 
 // pg_escape_literal/pg_escape_identifier
@@ -92,4 +101,4 @@ pg_escape_string() is Ok
 pg_escape_bytea() is Ok
 pg_escape_bytea() actually works with database
 pg_escape_literal() is Ok
-pg_escape_identifier() is Ok
\ No newline at end of file
+pg_escape_identifier() is Ok
diff --git a/ext/pgsql/tests/10pg_convert.phpt 
b/ext/pgsql/tests/10pg_convert.phpt
index 73bf2b6..fde4c67 100644
--- a/ext/pgsql/tests/10pg_convert.phpt
+++ b/ext/pgsql/tests/10pg_convert.phpt
@@ -3,7 +3,7 @@ PostgreSQL pg_convert()
 --SKIPIF--
 ?php
 include(skipif.inc);
-skip_server_version('8.5dev', '=');
+skip_bytea_not_escape();
 ?
 --FILE--
 ?php
diff --git a/ext/pgsql/tests/10pg_convert_85.phpt 
b/ext/pgsql/tests/10pg_convert_85.phpt
deleted file mode 100644
index 8b1cc8f..000
--- a/ext/pgsql/tests/10pg_convert_85.phpt
+++ /dev/null
@@ -1,30 +0,0 @@
---TEST--
-PostgreSQL pg_convert() (8.5+)
---SKIPIF--
-?php
-include(skipif.inc);
-skip_server_version('8.5dev', '');
-?
---FILE--
-?php
-error_reporting(E_ALL);
-
-include 'config.inc';
-
-$db = pg_connect($conn_str);
-pg_query($db, SET standard_conforming_strings = 0);
-
-$fields = array('num'='1234', 'str'='AAA', 'bin'='BBB');
-$converted = pg_convert($db, $table_name

[PHP-CVS] com php-src: Clean up leftover file after the test: ext/pgsql/tests/80_bug36625.phpt

2013-06-19 Thread Matteo Beccati
Commit:5edd53051169c0765479fc34d709814c8a0a0bda
Author:Matteo Beccati mbecc...@php.net Wed, 19 Jun 2013 08:28:47 
+0200
Parents:   e2bb74ab4f90ca2b840e44b96125c4c1633e0a14
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=5edd53051169c0765479fc34d709814c8a0a0bda

Log:
Clean up leftover file after the test

Changed paths:
  M  ext/pgsql/tests/80_bug36625.phpt


Diff:
diff --git a/ext/pgsql/tests/80_bug36625.phpt b/ext/pgsql/tests/80_bug36625.phpt
index a95cea7..9cc8a1d 100644
--- a/ext/pgsql/tests/80_bug36625.phpt
+++ b/ext/pgsql/tests/80_bug36625.phpt
@@ -37,6 +37,8 @@ array_walk($trace, 'search_trace_file');
 var_dump($found  0);
 var_dump(file_exists($tracefile));
 
+@unlink($tracefile);
+
 ?
 ===DONE===
 --CLEAN--


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Properly fixed bug #63186 on NetBSD == 6.0: NEWS main/streams/cast.c

2013-07-19 Thread Matteo Beccati
Commit:2b9d42433f8e634593c2306d5d0ef61cc44281bf
Author:Matteo Beccati mbecc...@php.net Mon, 8 Jul 2013 19:25:03 
+0200
Parents:   445dffa75a1ffdbcf03670781c48fa4f88ce2ce9
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=2b9d42433f8e634593c2306d5d0ef61cc44281bf

Log:
Properly fixed bug #63186 on NetBSD == 6.0

Bugs:
https://bugs.php.net/63186

Changed paths:
  M  NEWS
  M  main/streams/cast.c


Diff:
diff --git a/NEWS b/NEWS
index 765d183..4826d0c 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ PHP 
   NEWS
 |||
 ?? ??? 2013, PHP 5.4.19
 
+- Core.
+  . Improve fix for bug #63186 (compile failure on netbsd). (Matteo)
+
 - Session:
   . Fixed bug #62129 (rfc1867 crashes php even though turned off). (gxd305 at
 gmail dot com)
diff --git a/main/streams/cast.c b/main/streams/cast.c
index da6a293..bf96d3c 100644
--- a/main/streams/cast.c
+++ b/main/streams/cast.c
@@ -33,7 +33,7 @@
 #if defined(HAVE_FUNOPEN)  !defined(HAVE_FOPENCOOKIE)
 
 /* NetBSD 6.0+ uses off_t instead of fpos_t in funopen */
-# if defined(__NetBSD__)  (__NetBSD_Version__  6)
+# if defined(__NetBSD__)  (__NetBSD_Version__ = 6)
 #  define PHP_FPOS_T off_t
 # else
 #  define PHP_FPOS_T fpos_t


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/pgsql/pgsql.c

2013-08-21 Thread Matteo Beccati
Commit:4283f75c347a105e53ae38fc96e614671df53f1b
Author:Matteo Beccati mbecc...@php.net Wed, 21 Aug 2013 11:24:27 
+0200
Parents:   7be3c743392fbf1837760393403c7b703e502d3a 
540f325664a6f4975cf005f367c95ece04757714
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=4283f75c347a105e53ae38fc96e614671df53f1b

Log:
Merge branch 'PHP-5.4' into PHP-5.5

* PHP-5.4:
  Fixed compiler warnings in ext/pgsql
  Fixed other compiler warnings in PDO_PGSQL
  Fixed compiler warning

Changed paths:
  MM  ext/pgsql/pgsql.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed compiler warnings in ext/pgsql: ext/pgsql/pgsql.c

2013-08-21 Thread Matteo Beccati
Commit:540f325664a6f4975cf005f367c95ece04757714
Author:Matteo Beccati mbecc...@php.net Wed, 21 Aug 2013 11:21:43 
+0200
Parents:   696852f2bd500c9a2f54d7956ff13e57c0cb3f83
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=540f325664a6f4975cf005f367c95ece04757714

Log:
Fixed compiler warnings in ext/pgsql

Changed paths:
  M  ext/pgsql/pgsql.c


Diff:
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 3189070..41e304f 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -4152,7 +4152,7 @@ PHP_FUNCTION(pg_escape_bytea)
 #ifdef HAVE_PQESCAPE_BYTEA_CONN
if (pgsql_link != NULL || id != -1) {
ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, 
PostgreSQL link, le_link, le_plink);
-   to = (char *)PQescapeByteaConn(pgsql, from, (size_t)from_len, 
to_len);
+   to = (char *)PQescapeByteaConn(pgsql, (unsigned char *)from, 
(size_t)from_len, to_len);
} else
 #endif
to = (char *)PQescapeBytea((unsigned char*)from, from_len, 
to_len);
@@ -4346,7 +4346,7 @@ static char* php_pgsql_PQescapeInternal(PGconn *conn, 
const char *str, size_t le
 #endif
 
 static void php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int 
escape_literal) {
-   char *from = NULL, *to = NULL, *tmp = NULL;
+   char *from = NULL, *to = NULL;
zval *pgsql_link = NULL;
PGconn *pgsql;
int from_len;
@@ -4379,17 +4379,22 @@ static void 
php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAMETERS, int escape_l
RETURN_FALSE;
}
 #ifdef HAVE_PQESCAPELITERAL
-   if (escape_literal) {
-   tmp = PQescapeLiteral(pgsql, from, (size_t)from_len);
-   } else {
-   tmp = PQescapeIdentifier(pgsql, from, (size_t)from_len);
-   }
-   if (!tmp) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING,Failed to escape);
-   RETURN_FALSE;
+   /* Use a block with a local var to avoid unused variable warnings */
+   {
+   char *tmp;
+
+   if (escape_literal) {
+   tmp = PQescapeLiteral(pgsql, from, (size_t)from_len);
+   } else {
+   tmp = PQescapeIdentifier(pgsql, from, (size_t)from_len);
+   }
+   if (!tmp) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING,Failed to 
escape);
+   RETURN_FALSE;
+   }
+   to = estrdup(tmp);
+   PQfreemem(tmp);
}
-   to = estrdup(tmp);
-   PQfreemem(tmp);
 #else 
to = php_pgsql_PQescapeInternal(pgsql, from, (size_t)from_len, 
escape_literal);
if (!to) {
@@ -5120,7 +5125,9 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, 
const char *table_name, z
 #else
new_len = PQescapeString(escaped, tmp_name2, strlen(tmp_name2));
 #endif
-   smart_str_appends(querystr, escaped);
+   if (new_len) {
+   smart_str_appends(querystr, escaped);
+   }
efree(escaped);
 
smart_str_appends(querystr, ' AND c.relnamespace = n.oid AND 
n.nspname = ');
@@ -5130,7 +5137,9 @@ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, 
const char *table_name, z
 #else
new_len = PQescapeString(escaped, tmp_name, strlen(tmp_name));
 #endif
-   smart_str_appends(querystr, escaped);
+   if (new_len) {
+   smart_str_appends(querystr, escaped);
+   }
efree(escaped);
 
smart_str_appends(querystr, ' AND a.atttypid = t.oid ORDER BY 
a.attnum;);
@@ -5923,9 +5932,9 @@ PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, 
const char *table_name, con
size_t to_len;
smart_str s = {0};
 #ifdef HAVE_PQESCAPE_BYTEA_CONN
-   tmp = 
PQescapeByteaConn(pg_link, Z_STRVAL_PP(val), Z_STRLEN_PP(val), to_len);
+   tmp = 
PQescapeByteaConn(pg_link, (unsigned char *)Z_STRVAL_PP(val), Z_STRLEN_PP(val), 
to_len);
 #else
-   tmp = 
PQescapeBytea(Z_STRVAL_PP(val), Z_STRLEN_PP(val), to_len);
+   tmp = 
PQescapeBytea(Z_STRVAL_PP(val), (unsigned char *)Z_STRLEN_PP(val), to_len);
 #endif
Z_TYPE_P(new_val) = 
IS_STRING;
Z_STRLEN_P(new_val) = 
to_len-1; /* PQescapeBytea's to_len includes additional '\0' */


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed other compiler warnings in PDO_PGSQL: ext/pdo_pgsql/pgsql_driver.c ext/pdo_pgsql/pgsql_statement.c

2013-08-21 Thread Matteo Beccati
Commit:696852f2bd500c9a2f54d7956ff13e57c0cb3f83
Author:Matteo Beccati mbecc...@php.net Wed, 21 Aug 2013 11:08:16 
+0200
Parents:   5c06e5c2e020c49c3a99c88477014846e6d82b97
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=696852f2bd500c9a2f54d7956ff13e57c0cb3f83

Log:
Fixed other compiler warnings in PDO_PGSQL

Changed paths:
  M  ext/pdo_pgsql/pgsql_driver.c
  M  ext/pdo_pgsql/pgsql_statement.c


Diff:
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index 252bfff..5013643 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -315,9 +315,9 @@ static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char 
*unquoted, int unquote
case PDO_PARAM_LOB:
/* escapedlen returned by PQescapeBytea() accounts for 
trailing 0 */
 #ifdef HAVE_PQESCAPE_BYTEA_CONN
-   escaped = PQescapeByteaConn(H-server, unquoted, 
unquotedlen, tmp_len);
+   escaped = PQescapeByteaConn(H-server, (unsigned char 
*)unquoted, (size_t)unquotedlen, tmp_len);
 #else
-   escaped = PQescapeBytea(unquoted, unquotedlen, 
tmp_len);
+   escaped = PQescapeBytea((unsigned char *)unquoted, 
(size_t)unquotedlen, tmp_len);
 #endif
*quotedlen = (int)tmp_len + 1;
*quoted = emalloc(*quotedlen + 1);
@@ -331,9 +331,9 @@ static int pgsql_handle_quoter(pdo_dbh_t *dbh, const char 
*unquoted, int unquote
*quoted = safe_emalloc(2, unquotedlen, 3);
(*quoted)[0] = '\'';
 #ifndef HAVE_PQESCAPE_CONN
-   *quotedlen = PQescapeString(*quoted + 1, unquoted, 
unquotedlen);
+   *quotedlen = PQescapeString(*quoted + 1, unquoted, 
(size_t)unquotedlen);
 #else
-   *quotedlen = PQescapeStringConn(H-server, *quoted + 1, 
unquoted, unquotedlen, NULL);
+   *quotedlen = PQescapeStringConn(H-server, *quoted + 1, 
unquoted, (size_t)unquotedlen, NULL);
 #endif
(*quoted)[*quotedlen + 1] = '\'';
(*quoted)[*quotedlen + 2] = '\0';
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
index 3ef8919..792ad27 100644
--- a/ext/pdo_pgsql/pgsql_statement.c
+++ b/ext/pdo_pgsql/pgsql_statement.c
@@ -536,7 +536,7 @@ static int pgsql_stmt_get_col(pdo_stmt_t *stmt, int colno, 
char **ptr, unsigned
*len = 0;
return 0;
} else {
-   char *tmp_ptr = PQunescapeBytea(*ptr, 
tmp_len);
+   char *tmp_ptr = (char 
*)PQunescapeBytea((unsigned char *)*ptr, tmp_len);
if (!tmp_ptr) {
/* PQunescapeBytea returned an 
error */
*len = 0;


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed compiler warning: ext/pdo/php_pdo_driver.h

2013-08-21 Thread Matteo Beccati
Commit:5c06e5c2e020c49c3a99c88477014846e6d82b97
Author:Matteo Beccati mbecc...@php.net Wed, 21 Aug 2013 11:00:31 
+0200
Parents:   e9b12bedc331631cbcc8605972325ca41ec50f01
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=5c06e5c2e020c49c3a99c88477014846e6d82b97

Log:
Fixed compiler warning

I moved the constant to the enum in order to avoid this:
ext/pgsql/pgsql.c:3491: warning: comparison is always false due to limited 
range of data type

Works in gcc 4.6, but I'm not sure about other compilers.

Changed paths:
  M  ext/pdo/php_pdo_driver.h


Diff:
diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h
index c757dbf..ede2d6f 100644
--- a/ext/pdo/php_pdo_driver.h
+++ b/ext/pdo/php_pdo_driver.h
@@ -72,11 +72,11 @@ enum pdo_param_type {
/* get_col ptr should point to a zval*
   and the driver is responsible for adding correct type information to 
get_column_meta()
 */
-   PDO_PARAM_ZVAL
-};
+   PDO_PARAM_ZVAL,
 
-/* magic flag to denote a parameter as being input/output */
-#definePDO_PARAM_INPUT_OUTPUT  0x8000  
+   /* magic flag to denote a parameter as being input/output */
+   PDO_PARAM_INPUT_OUTPUT = 0x8000
+};
 
 #define PDO_PARAM_FLAGS0x


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Merge branch 'PHP-5.5': ext/pdo_pgsql/pgsql_driver.c

2013-08-21 Thread Matteo Beccati
Commit:3ec28b1d1fcf26d6e495292eea8af9c6cabd72b2
Author:Matteo Beccati mbecc...@php.net Wed, 21 Aug 2013 11:26:41 
+0200
Parents:   aaf95aa1b65170d756a897926e7c9f996bc37e93 
4283f75c347a105e53ae38fc96e614671df53f1b
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=3ec28b1d1fcf26d6e495292eea8af9c6cabd72b2

Log:
Merge branch 'PHP-5.5'

* PHP-5.5:
  Fixed compiler warnings in ext/pgsql
  Fixed other compiler warnings in PDO_PGSQL
  Fixed compiler warning
  Update NEWS

Conflicts:
ext/pdo_pgsql/pgsql_driver.c

Changed paths:
  MM  ext/pdo_pgsql/pgsql_driver.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Merge branch 'PHP-5.4' into PHP-5.5: ext/pdo/pdo_stmt.c ext/pgsql/pgsql.c

2013-08-22 Thread Matteo Beccati
Commit:908da14bd1131c5c35d3f206734e9f8f42872b33
Author:Matteo Beccati mbecc...@php.net Thu, 22 Aug 2013 15:34:11 
+0200
Parents:   c0d99fd76a37785d357ffe7a0fee8715108d3dd5 
d5987478a8fd566775510c08993cc933267a3765
Branches:  PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=908da14bd1131c5c35d3f206734e9f8f42872b33

Log:
Merge branch 'PHP-5.4' into PHP-5.5

* PHP-5.4:
  Fixed other compiler warnings

Changed paths:
  MM  ext/pdo/pdo_stmt.c
  MM  ext/pgsql/pgsql.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Merge branch 'PHP-5.5': ext/pdo/pdo_dbh.c

2013-08-22 Thread Matteo Beccati
Commit:80917e5ca29b8eeed31d87915154dba13bdcc2b5
Author:Matteo Beccati mbecc...@php.net Thu, 22 Aug 2013 15:34:22 
+0200
Parents:   926987bdc7a0013a46ca69ed6da54ca614f0c9ae 
908da14bd1131c5c35d3f206734e9f8f42872b33
Branches:  master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=80917e5ca29b8eeed31d87915154dba13bdcc2b5

Log:
Merge branch 'PHP-5.5'

* PHP-5.5:
  Fixed other compiler warnings

Changed paths:
  MM  ext/pdo/pdo_dbh.c


Diff:



--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-CVS] com php-src: Fixed other compiler warnings: ext/pdo/pdo_dbh.c ext/pdo/pdo_stmt.c ext/pgsql/pgsql.c

2013-08-22 Thread Matteo Beccati
Commit:d5987478a8fd566775510c08993cc933267a3765
Author:Matteo Beccati mbecc...@php.net Thu, 22 Aug 2013 15:33:12 
+0200
Parents:   54d4a28003f35020a734b172d263b9e15b38950f
Branches:  PHP-5.4 PHP-5.5 master

Link:   
http://git.php.net/?p=php-src.git;a=commitdiff;h=d5987478a8fd566775510c08993cc933267a3765

Log:
Fixed other compiler warnings

Changed paths:
  M  ext/pdo/pdo_dbh.c
  M  ext/pdo/pdo_stmt.c
  M  ext/pgsql/pgsql.c


Diff:
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index ee76357..d5860b1 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -997,7 +997,7 @@ static PHP_METHOD(PDO, lastInsertId)
pdo_raise_impl_error(dbh, NULL, IM001, driver does not 
support lastInsertId() TSRMLS_CC);
RETURN_FALSE;
} else {
-   Z_STRVAL_P(return_value) = dbh-methods-last_id(dbh, name, 
Z_STRLEN_P(return_value) TSRMLS_CC);
+   Z_STRVAL_P(return_value) = dbh-methods-last_id(dbh, name, 
(unsigned int *)Z_STRLEN_P(return_value) TSRMLS_CC);
if (!Z_STRVAL_P(return_value)) {
PDO_HANDLE_DBH_ERR();
RETURN_FALSE;
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index 81224ab..9622cb3 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -1146,7 +1146,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval 
*return_value,
zval_ptr_dtor(val);

pdo_raise_impl_error(stmt-dbh, stmt, HY000, cannot unserialize class 
TSRMLS_CC);
return 0;
-   } else if 
(ce-unserialize(return_value, ce, Z_TYPE_P(val) == IS_STRING ? 
Z_STRVAL_P(val) : , Z_TYPE_P(val) == IS_STRING ? Z_STRLEN_P(val) : 0, NULL 
TSRMLS_CC) == FAILURE) {
+   } else if 
(ce-unserialize(return_value, ce, (unsigned char *)(Z_TYPE_P(val) == 
IS_STRING ? Z_STRVAL_P(val) : ), Z_TYPE_P(val) == IS_STRING ? Z_STRLEN_P(val) 
: 0, NULL TSRMLS_CC) == FAILURE) {
zval_ptr_dtor(val);

pdo_raise_impl_error(stmt-dbh, stmt, HY000, cannot unserialize class 
TSRMLS_CC);
zval_dtor(return_value);
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 41e304f..f4c4cb3 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -63,6 +63,7 @@
 #define PGSQL_MAX_LENGTH_OF_LONG   30
 #define PGSQL_MAX_LENGTH_OF_DOUBLE 60
 
+#if LONG_MAX  UINT_MAX
 #define PGSQL_RETURN_OID(oid) do { \
if (oid  LONG_MAX) { \
smart_str s = {0}; \
@@ -72,7 +73,9 @@
} \
RETURN_LONG((long)oid); \
 } while(0)
-
+#else
+#define PGSQL_RETURN_OID(oid) (RETURN_LONG((long)oid))
+#endif
 
 #if HAVE_PQSETNONBLOCKING
 #define PQ_SETNONBLOCKING(pg_link, flag) PQsetnonblocking(pg_link, flag)


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php