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

2005-07-11 Thread Wez Furlong
wez Mon Jul 11 23:20:08 2005 EDT

  Modified files:  
/php-src/ext/pdopdo_sql_parser.c 
  Log:
  touch generated file
  
  
http://cvs.php.net/diff.php/php-src/ext/pdo/pdo_sql_parser.c?r1=1.30&r2=1.31&ty=u
Index: php-src/ext/pdo/pdo_sql_parser.c
diff -u php-src/ext/pdo/pdo_sql_parser.c:1.30 
php-src/ext/pdo/pdo_sql_parser.c:1.31
--- php-src/ext/pdo/pdo_sql_parser.c:1.30   Fri Jul  8 16:38:13 2005
+++ php-src/ext/pdo/pdo_sql_parser.cMon Jul 11 23:20:08 2005
@@ -1,5 +1,5 @@
-/* Generated by re2c 0.9.8 on Fri Jul  8 22:33:49 2005 */
-#line 1 "ext/pdo/pdo_sql_parser.re"
+/* Generated by re2c 0.9.3 on Mon Jul 11 23:09:09 2005 */
+#line 1 "../pdo/pdo_sql_parser.re"
 /*
   +--+
   | PHP Version 5|
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pdo_sql_parser.c,v 1.30 2005/07/08 20:38:13 helly Exp $ */
+/* $Id: pdo_sql_parser.c,v 1.31 2005/07/12 03:20:08 wez Exp $ */
 
 #include "php.h"
 #include "php_pdo_driver.h"
@@ -46,21 +46,21 @@
char *cursor = s->cur;
 
s->tok = cursor;
-   #line 55 "ext/pdo/pdo_sql_parser.re"
+   #line 55 "../pdo/pdo_sql_parser.re"
 
 

-#line 54 "ext/pdo/pdo_sql_parser.c"
+#line 7 ""
 {
YYCTYPE yych;
unsigned int yyaccept;
goto yy0;
-   ++YYCURSOR;
+yy1:   ++YYCURSOR;
 yy0:
if((YYLIMIT - YYCURSOR) < 2) YYFILL(2);
yych = *YYCURSOR;
switch(yych){
-   case 0x00:  goto yy11;
+   case '\000':goto yy11;
case '"':   goto yy2;
case '\'':  goto yy4;
case ':':   goto yy5;
@@ -69,16 +69,16 @@
}
 yy2:   yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
-   if(yych >= 0x01)goto yy24;
+   if(yych >= '\001')  goto yy24;
goto yy3;
 yy3:
-#line 62 "ext/pdo/pdo_sql_parser.re"
+#line 62 "../pdo/pdo_sql_parser.re"
 { RET(PDO_PARSER_TEXT); }
-#line 78 "ext/pdo/pdo_sql_parser.c"
+#line 31 ""
 yy4:   yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch(yych){
-   case 0x00:  case '"':   goto yy3;
+   case '\000':case '"':   goto yy3;
default:goto yy17;
}
 yy5:   yych = *++YYCURSOR;
@@ -148,27 +148,27 @@
 yy6:   ++YYCURSOR;
goto yy7;
 yy7:
-#line 61 "ext/pdo/pdo_sql_parser.re"
+#line 61 "../pdo/pdo_sql_parser.re"
 { RET(PDO_PARSER_BIND_POS); }
-#line 154 "ext/pdo/pdo_sql_parser.c"
+#line 107 ""
 yy8:   ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy9;
 yy9:   switch(yych){
-   case 0x00:  case '"':   case '\'':  case ':':   case 
'?':   goto yy10;
+   case '\000':case '"':   case '\'':  case ':':   case 
'?':   goto yy10;
default:goto yy8;
}
 yy10:
-#line 63 "ext/pdo/pdo_sql_parser.re"
+#line 63 "../pdo/pdo_sql_parser.re"
 { RET(PDO_PARSER_TEXT); }
-#line 166 "ext/pdo/pdo_sql_parser.c"
+#line 120 ""
 yy11:  ++YYCURSOR;
goto yy12;
 yy12:
-#line 64 "ext/pdo/pdo_sql_parser.re"
+#line 64 "../pdo/pdo_sql_parser.re"
 { RET(PDO_PARSER_EOI); }
-#line 172 "ext/pdo/pdo_sql_parser.c"
+#line 126 ""
 yy13:  ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -237,15 +237,15 @@
default:goto yy15;
}
 yy15:
-#line 60 "ext/pdo/pdo_sql_parser.re"
+#line 60 "../pdo/pdo_sql_parser.re"
 { RET(PDO_PARSER_BIND); }
-#line 243 "ext/pdo/pdo_sql_parser.c"
+#line 198 ""
 yy16:  ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
goto yy17;
 yy17:  switch(yych){
-   case 0x00:  case '"':   goto yy18;
+   case '\000':case '"':   goto yy18;
case '\'':  goto yy19;
case '\\':  goto yy22;
default:goto yy16;
@@ -261,15 +261,15 @@
yych = *YYCURSOR;
goto yy20;
 yy20:  switch(yych){
-   case 0x00:  case '"':   goto yy21;
+   case '\000':case '"':   goto yy21;
case '\'':  goto yy19;
case '\\':  goto yy22;
default:goto yy16;
}
 yy21:
-#line 59 "ext/pdo/pdo_sql_parser.re"
+#line 59 "../pdo/pdo_sql_parser.re"
 { RET(PDO_PARSER_TEXT); }
-#line 273 "ext/pdo/pdo_sql_parser.c"
+#line 229 ""
 yy22:  ++YYCURSOR;
if(YYLIMIT == YYCURSOR) YYFILL(1);
yych = *YYCURSOR;
@@ -282,7 +282,7 @@
yych = *YYCURSOR;
goto yy24;
 yy24:  switch(yych){
-   case 0x00:  goto yy18;
+   case '\000':goto yy18;
case '"':   goto yy26;
case '\\':  goto yy25;
default:goto yy23;
@@ -297,11 +297,11 @@
 yy26:  ++YYCURSOR;
goto yy27;
 yy27:
-#line 58 "ext/pdo/pdo_sql_parser.re"
+#line 58 "../pdo/pdo_sql_parser.re"
 { RET(PDO_PARSER_TEXT); }
-#line 303 "ext/pdo/pdo

[PHP-CVS] cvs: php-src /ext/pdo pdo_sql_parser.re pdo_stmt.c

2005-07-11 Thread Wez Furlong
wez Mon Jul 11 23:19:44 2005 EDT

  Modified files:  
/php-src/ext/pdopdo_stmt.c pdo_sql_parser.re 
  Log:
  remember ? -> :pdox mapping so that binds by position can be mapped to names 
if required.
  
  
  
http://cvs.php.net/diff.php/php-src/ext/pdo/pdo_stmt.c?r1=1.110&r2=1.111&ty=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.110 php-src/ext/pdo/pdo_stmt.c:1.111
--- php-src/ext/pdo/pdo_stmt.c:1.110Mon Jul 11 22:40:59 2005
+++ php-src/ext/pdo/pdo_stmt.c  Mon Jul 11 23:19:44 2005
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pdo_stmt.c,v 1.110 2005/07/12 02:40:59 wez Exp $ */
+/* $Id: pdo_stmt.c,v 1.111 2005/07/12 03:19:44 wez Exp $ */
 
 /* The PDO Statement Handle Class */
 
@@ -92,7 +92,14 @@
return 1;
}
if (!param->name) {
-   return 1;
+   /* do the reverse; map the parameter number to the name 
*/
+   if (SUCCESS == 
zend_hash_index_find(stmt->bound_param_map, param->paramno, (void**)&name)) {
+   param->name = estrdup(name);
+   param->namelen = strlen(param->name);
+   return 1;
+   }
+   pdo_raise_impl_error(stmt->dbh, stmt, "HY093", 
"parameter was not defined" TSRMLS_CC);
+   return 0;
}
 
zend_hash_internal_pointer_reset(stmt->bound_param_map);
http://cvs.php.net/diff.php/php-src/ext/pdo/pdo_sql_parser.re?r1=1.25&r2=1.26&ty=u
Index: php-src/ext/pdo/pdo_sql_parser.re
diff -u php-src/ext/pdo/pdo_sql_parser.re:1.25 
php-src/ext/pdo/pdo_sql_parser.re:1.26
--- php-src/ext/pdo/pdo_sql_parser.re:1.25  Fri Jul  8 16:35:41 2005
+++ php-src/ext/pdo/pdo_sql_parser.re   Mon Jul 11 23:19:44 2005
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: pdo_sql_parser.re,v 1.25 2005/07/08 20:35:41 helly Exp $ */
+/* $Id: pdo_sql_parser.re,v 1.26 2005/07/12 03:19:44 wez Exp $ */
 
 #include "php.h"
 #include "php_pdo_driver.h"
@@ -276,9 +276,15 @@
/* rewrite ? to :pdoX */
char idxbuf[32];
const char *tmpl = stmt->named_rewrite_template ? 
stmt->named_rewrite_template : ":pdo%d";
+   char *name;

newbuffer_len = inquery_len;
 
+   if (stmt->bound_param_map == NULL) {
+   ALLOC_HASHTABLE(stmt->bound_param_map);
+   zend_hash_init(stmt->bound_param_map, 13, NULL, NULL, 
0);
+   }
+
for (plc = placeholders; plc; plc = plc->next) {
snprintf(idxbuf, sizeof(idxbuf), tmpl, plc->bindno + 1);
plc->quoted = estrdup(idxbuf);
@@ -286,18 +292,18 @@
plc->freeq = 1;
newbuffer_len += plc->qlen;
 
+   name = estrndup(plc->pos, plc->len);
+
if (stmt->named_rewrite_template) {
/* create a mapping */
-   char *name = estrndup(plc->pos, plc->len);

-   if (stmt->bound_param_map == NULL) {
-   ALLOC_HASHTABLE(stmt->bound_param_map);
-   zend_hash_init(stmt->bound_param_map, 
13, NULL, NULL, 0);
-   }
-
zend_hash_update(stmt->bound_param_map, name, 
plc->len + 1, idxbuf, plc->qlen + 1, NULL);
-   efree(name);
}
+
+   /* map number to name */
+   zend_hash_index_update(stmt->bound_param_map, 
plc->bindno, idxbuf, plc->qlen + 1, NULL);
+   
+   efree(name);
}

goto rewrite;

-- 
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

2005-07-11 Thread Wez Furlong
wez Mon Jul 11 23:18:20 2005 EDT

  Modified files:  
/php-src/ext/pdo_ocioci_driver.c 
  Log:
  fix bug when query was rewritten from ? to :name
  
  
http://cvs.php.net/diff.php/php-src/ext/pdo_oci/oci_driver.c?r1=1.23&r2=1.24&ty=u
Index: php-src/ext/pdo_oci/oci_driver.c
diff -u php-src/ext/pdo_oci/oci_driver.c:1.23 
php-src/ext/pdo_oci/oci_driver.c:1.24
--- php-src/ext/pdo_oci/oci_driver.c:1.23   Thu Jul  7 19:03:22 2005
+++ php-src/ext/pdo_oci/oci_driver.cMon Jul 11 23:18:17 2005
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: oci_driver.c,v 1.23 2005/07/07 23:03:22 tony2001 Exp $ */
+/* $Id: oci_driver.c,v 1.24 2005/07/12 03:18:17 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -228,6 +228,7 @@
if (ret == 1) {
/* query was re-written */
sql = nsql;
+   sql_len = nsql_len;
} else if (ret == -1) {
/* couldn't grok it */
strcpy(dbh->error_code, stmt->error_code);

-- 
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_statement.c php_pdo_oci_int.h

2005-07-11 Thread Wez Furlong
wez Mon Jul 11 22:43:39 2005 EDT

  Modified files:  
/php-src/ext/pdo_ocioci_statement.c php_pdo_oci_int.h 
  Log:
  improve handling of bound input parameters when no maximal length value is 
set;
  default to 4000 as the maximal length, which is the biggest size possible
  without using a LONG type (if you specify anything larger than this, you'll 
end
  up with ORA-1461).
  
  Don't assume that all parameters were output parameters after execution, as
  this would clobber the input values when used in a loop.
  
  
  
http://cvs.php.net/diff.php/php-src/ext/pdo_oci/oci_statement.c?r1=1.15&r2=1.16&ty=u
Index: php-src/ext/pdo_oci/oci_statement.c
diff -u php-src/ext/pdo_oci/oci_statement.c:1.15 
php-src/ext/pdo_oci/oci_statement.c:1.16
--- php-src/ext/pdo_oci/oci_statement.c:1.15Thu Jul  7 19:02:22 2005
+++ php-src/ext/pdo_oci/oci_statement.c Mon Jul 11 22:43:39 2005
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: oci_statement.c,v 1.15 2005/07/07 23:02:22 tony2001 Exp $ */
+/* $Id: oci_statement.c,v 1.16 2005/07/12 02:43:39 wez Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -97,6 +97,8 @@
}
efree(S);
 
+   stmt->driver_data = NULL;
+
return 1;
 } /* }}} */
 
@@ -203,6 +205,7 @@
 
Z_STRLEN_P(param->parameter) = param->max_value_len;
Z_STRVAL_P(param->parameter) = emalloc(Z_STRLEN_P(param->parameter)+1);
+   P->used_for_output = 1;
 
P->actual_len = Z_STRLEN_P(param->parameter);   
*alenpp = &P->actual_len;
@@ -246,9 +249,10 @@
case PDO_PARAM_STR:
default:
P->oci_type = SQLT_CHR;
-   
convert_to_string(param->parameter);
value_sz = param->max_value_len 
+ 1;
-   P->actual_len = 
Z_STRLEN_P(param->parameter);
+   if (param->max_value_len == 0) {
+   value_sz = 4000; /* 
maximum size before value is interpreted as a LONG value */
+   }

}

@@ -275,30 +279,33 @@
 
case PDO_PARAM_EVT_EXEC_PRE:
P->indicator = 0;
+   P->used_for_output = 0;
return 1;
 
case PDO_PARAM_EVT_EXEC_POST:
/* fixup stuff set in motion in 
oci_bind_output_cb */
-   if (P->indicator == -1) {
-   /* set up a NULL value */
-   if (Z_TYPE_P(param->parameter) == 
IS_STRING
+   if (P->used_for_output) {
+   if (P->indicator == -1) {
+   /* set up a NULL value */
+   if (Z_TYPE_P(param->parameter) 
== IS_STRING
 #if ZEND_EXTENSION_API_NO < 220040718
&& 
Z_STRVAL_P(param->parameter) != empty_string
 #endif
-   ) {
-   /* OCI likes to stick 
non-terminated strings in things */
-   *Z_STRVAL_P(param->parameter) = 
'\0';
-   }
-   zval_dtor(param->parameter);
-   ZVAL_NULL(param->parameter);
-   } else if (Z_TYPE_P(param->parameter) == 
IS_STRING
+  ) {
+   /* OCI likes to stick 
non-terminated strings in things */
+   
*Z_STRVAL_P(param->parameter) = '\0';
+   }
+   zval_dtor(param->parameter);
+   ZVAL_NULL(param->parameter);
+   } else if (Z_TYPE_P(param->parameter) 
== IS_STRING
 #if ZEND_EXTENSION_API_NO < 220040718
&& 
Z_STRVAL_P(param->parameter) != empty_string
 #endif
-   ) {
-   Z_STRLEN_P(param->parameter) = 
P->actual_len;
-   Z_STRVAL_P(param->parameter) = 
erealloc(Z_STRVAL_P(param->parameter), P->actual_len+1);
-

[PHP-CVS] cvs: php-src /ext/pdo pdo.c pdo_dbh.c pdo_stmt.c php_pdo_driver.h

2005-07-11 Thread Wez Furlong
am_map) {
zend_hash_destroy(stmt->bound_param_map);
FREE_HASHTABLE(stmt->bound_param_map);
+   stmt->bound_param_map = NULL;
}
if (stmt->bound_columns) {
zend_hash_destroy(stmt->bound_columns);
FREE_HASHTABLE(stmt->bound_columns);
+   stmt->bound_columns = NULL;
}
 
if (stmt->methods && stmt->methods->dtor) {
http://cvs.php.net/diff.php/php-src/ext/pdo/php_pdo_driver.h?r1=1.64&r2=1.65&ty=u
Index: php-src/ext/pdo/php_pdo_driver.h
diff -u php-src/ext/pdo/php_pdo_driver.h:1.64 
php-src/ext/pdo/php_pdo_driver.h:1.65
--- php-src/ext/pdo/php_pdo_driver.h:1.64   Fri Jul  8 23:52:39 2005
+++ php-src/ext/pdo/php_pdo_driver.hMon Jul 11 22:40:59 2005
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: php_pdo_driver.h,v 1.64 2005/07/09 03:52:39 wez Exp $ */
+/* $Id: php_pdo_driver.h,v 1.65 2005/07/12 02:40:59 wez Exp $ */
 
 #ifndef PHP_PDO_DRIVER_H
 #define PHP_PDO_DRIVER_H
@@ -44,7 +44,7 @@
 # define FALSE 0
 #endif
 
-#define PDO_DRIVER_API 20050709
+#define PDO_DRIVER_API 20050711
 
 enum pdo_param_type {
PDO_PARAM_NULL,
@@ -174,6 +174,13 @@
PDO_CASE_LOWER
 };
 
+/* oracle interop settings */
+enum pdo_null_handling {
+   PDO_NULL_NATURAL = 0,
+   PDO_NULL_EMPTY_STRING = 1,
+   PDO_NULL_TO_STRING = 2,
+};
+
 /* {{{ utils for reading attributes set as driver_options */
 static inline long pdo_attr_lval(zval *options, enum pdo_fetch_type 
option_name, long defval TSRMLS_DC)
 {
@@ -437,15 +444,15 @@
/* max length a single character can become after correct quoting */
unsigned max_escaped_char_length:3;
 
-   /* when set, convert empty strings to NULL */
-   unsigned oracle_nulls:1;
+   /* oracle compat; see enum pdo_null_handling */
+   unsigned oracle_nulls:2;
 
/* when set, convert int/floats to strings */
unsigned stringify:1;
 
/* the sum of the number of bits here and the bit fields preceeding 
should
 * equal 32 */
-   unsigned _reserved_flags:22;
+   unsigned _reserved_flags:21;
 
/* data source string used to open this handle */
const char *data_source;

-- 
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 pdo_018.phpt

2005-07-11 Thread Wez Furlong
wez Mon Jul 11 22:38:43 2005 EDT

  Modified files:  
/php-src/ext/pdo/tests  pdo_018.phpt 
  Log:
  should always bind columns after execute.
  There're probably more of these to fix.
  
  
http://cvs.php.net/diff.php/php-src/ext/pdo/tests/pdo_018.phpt?r1=1.9&r2=1.10&ty=u
Index: php-src/ext/pdo/tests/pdo_018.phpt
diff -u php-src/ext/pdo/tests/pdo_018.phpt:1.9 
php-src/ext/pdo/tests/pdo_018.phpt:1.10
--- php-src/ext/pdo/tests/pdo_018.phpt:1.9  Fri Jul  8 23:52:41 2005
+++ php-src/ext/pdo/tests/pdo_018.phpt  Mon Jul 11 22:38:39 2005
@@ -85,7 +85,6 @@
 
 $stmt = $db->prepare('SELECT id FROM classtypes WHERE name=:cname');
 $stmt->bindParam(':cname', $cname);
-$stmt->bindColumn('id', $ctype);
 
 $ctypes = array();
 
@@ -94,6 +93,7 @@
$cname = get_class($obj);
$ctype = NULL; /* set default for non stored class name */
$stmt->execute();
+   $stmt->bindColumn('id', $ctype);
$stmt->fetch(PDO_FETCH_BOUND);
$ctypes[$cname] = $ctype;
 }

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



[PHP-CVS] cvs: CVSROOT / avail

2005-07-11 Thread Derick Rethans
derick  Mon Jul 11 17:50:36 2005 EDT

  Modified files:  
/CVSROOTavail 
  Log:
  - Go with peardoc karma for colder.
  
  
http://cvs.php.net/diff.php/CVSROOT/avail?r1=1.994&r2=1.995&ty=u
Index: CVSROOT/avail
diff -u CVSROOT/avail:1.994 CVSROOT/avail:1.995
--- CVSROOT/avail:1.994 Sun Jul 10 08:22:23 2005
+++ CVSROOT/avail   Mon Jul 11 17:50:30 2005
@@ -218,7 +218,7 @@
 avail|areaz2|pecl/dazuko
 avail|nicos|php-src/ext/readline
 avail|mabouzou|php-src/ext/sqlanywhere
-avail|cortesi,webdi|peardoc
+avail|cortesi,webdi,colder|peardoc
 avail|aditus|jpgraph
 avail|phallstrom|php-gtk-web/apps,php-gtk-web/include/apps.inc
 avail|mohrt|pear/Date

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



[PHP-CVS] cvs: php-src(PHP_4_4) / NEWS /ext/standard array.c

2005-07-11 Thread Dmitry Stogov
dmitry  Mon Jul 11 12:25:47 2005 EDT

  Modified files:  (Branch: PHP_4_4)
/php-srcNEWS 
/php-src/ext/standard   array.c 
  Log:
  Fixed bug #31158 (array_splice on $GLOBALS crashes)
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.920.2.13&r2=1.1247.2.920.2.14&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.920.2.13 php-src/NEWS:1.1247.2.920.2.14
--- php-src/NEWS:1.1247.2.920.2.13  Mon Jul 11 03:45:08 2005
+++ php-src/NEWSMon Jul 11 12:25:44 2005
@@ -1,5 +1,8 @@
 PHP 4  NEWS
 |||
+?? ??? 2005, Version 4.4.1
+- Fixed bug #31158 (array_splice on $GLOBALS crashes). (Dmitry)
+
 11 Jul 2005, Version 4.4.0
 - Added man pages for "phpize" and "php-config" scripts. (Jakub Vrana)
 - Added support for .cc files in extensions. (Brian)
http://cvs.php.net/diff.php/php-src/ext/standard/array.c?r1=1.199.2.44.2.2&r2=1.199.2.44.2.3&ty=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.199.2.44.2.2 
php-src/ext/standard/array.c:1.199.2.44.2.3
--- php-src/ext/standard/array.c:1.199.2.44.2.2 Tue Jun 21 08:11:19 2005
+++ php-src/ext/standard/array.cMon Jul 11 12:25:46 2005
@@ -22,7 +22,7 @@
 */
 
 
-/* $Id: array.c,v 1.199.2.44.2.2 2005/06/21 12:11:19 dmitry Exp $ */
+/* $Id: array.c,v 1.199.2.44.2.3 2005/07/11 16:25:46 dmitry Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -1831,8 +1831,8 @@
   hashtable and replace it with new one */
new_hash = php_splice(Z_ARRVAL_P(stack), 0, 0, &args[1], argc-1, NULL);
zend_hash_destroy(Z_ARRVAL_P(stack));
-   efree(Z_ARRVAL_P(stack));
-   Z_ARRVAL_P(stack) = new_hash;
+   *Z_ARRVAL_P(stack) = *new_hash;
+   FREE_HASHTABLE(new_hash);
 
/* Clean up and return the number of elements in the stack */
efree(args);
@@ -1909,8 +1909,8 @@

/* Replace input array's hashtable with the new one */
zend_hash_destroy(Z_ARRVAL_P(array));
-   efree(Z_ARRVAL_P(array));
-   Z_ARRVAL_P(array) = new_hash;
+   *Z_ARRVAL_P(array) = *new_hash;
+   FREE_HASHTABLE(new_hash);

/* Clean up */
if (argc == 4)
@@ -2397,8 +2397,8 @@

/* Copy the result hash into return value */
zend_hash_destroy(Z_ARRVAL_P(return_value));
-   efree(Z_ARRVAL_P(return_value));
-   Z_ARRVAL_P(return_value) = new_hash;
+   *Z_ARRVAL_P(return_value) = *new_hash;
+   FREE_HASHTABLE(new_hash);

/* Clean up */
efree(pads);

-- 
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_mysql mysql_driver.c

2005-07-11 Thread Ilia Alshanetsky

Ilia Alshanetsky wrote:

You remove the initial '"', but left the trailing one?


Nm, this bit, misread the line.

Ilia

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



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

2005-07-11 Thread Ilia Alshanetsky
iliaa   Mon Jul 11 10:46:03 2005 EDT

  Modified files:  
/php-src/ext/pdo_mysql  mysql_driver.c 
  Log:
  A bit of further tuning.
  
  
http://cvs.php.net/diff.php/php-src/ext/pdo_mysql/mysql_driver.c?r1=1.54&r2=1.55&ty=u
Index: php-src/ext/pdo_mysql/mysql_driver.c
diff -u php-src/ext/pdo_mysql/mysql_driver.c:1.54 
php-src/ext/pdo_mysql/mysql_driver.c:1.55
--- php-src/ext/pdo_mysql/mysql_driver.c:1.54   Mon Jul 11 09:52:13 2005
+++ php-src/ext/pdo_mysql/mysql_driver.cMon Jul 11 10:46:01 2005
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: mysql_driver.c,v 1.54 2005/07/11 13:52:13 andrey Exp $ */
+/* $Id: mysql_driver.c,v 1.55 2005/07/11 14:46:01 iliaa Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -240,10 +240,10 @@
 static int mysql_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int 
unquotedlen, char **quoted, int *quotedlen, enum pdo_param_type paramtype  
TSRMLS_DC)
 {
pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
-   *quoted = emalloc(2*unquotedlen + 3);
+   *quoted = safe_emalloc(2, unquotedlen, 3);
*quotedlen = mysql_real_escape_string(H->server, *quoted + 1, unquoted, 
unquotedlen);
-   (*quoted)[0] =(*quoted)[*quotedlen + 1] = '"';
-   (*quoted)[*quotedlen+=2] = '\0';
+   (*quoted)[0] =(*quoted)[++*quotedlen] = '"';
+   (*quoted)[++*quotedlen] = '\0';
return 1;
 }
 

-- 
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 pdo_stmt.c

2005-07-11 Thread Wez Furlong
That doesn't sound right.  It should probably be an error to bind by
number when using named parameters.

Will investigate more.

--Wez.

On 7/11/05, Andrey Hristov <[EMAIL PROTECTED]> wrote:
> andrey  Mon Jul 11 10:14:57 2005 EDT
> 
>   Modified files:
> /php-src/ext/pdopdo_stmt.c
>   Log:
>   fix a segfault with the following script:
>  $dbh = new PDO('mysql:dbname=test;host=localhost', "root", "secret");
>   $what = 1;
>   $stmt = $dbh->prepare('select a, b, c from t123 where a=:what');
>   $stmt->bindParam(1, $what, PDO_PARAM_INT, 12);
>   var_dump($stmt->execute());
>   var_dump($stmt->fetchObject());
>   ?>
> 
> 
> http://cvs.php.net/diff.php/php-src/ext/pdo/pdo_stmt.c?r1=1.108&r2=1.109&ty=u
> Index: php-src/ext/pdo/pdo_stmt.c
> diff -u php-src/ext/pdo/pdo_stmt.c:1.108 php-src/ext/pdo/pdo_stmt.c:1.109
> --- php-src/ext/pdo/pdo_stmt.c:1.108Fri Jul  8 23:52:39 2005
> +++ php-src/ext/pdo/pdo_stmt.c  Mon Jul 11 10:14:56 2005
> @@ -18,7 +18,7 @@
>+--+
>  */
> 
> -/* $Id: pdo_stmt.c,v 1.108 2005/07/09 03:52:39 wez Exp $ */
> +/* $Id: pdo_stmt.c,v 1.109 2005/07/11 14:14:56 andrey Exp $ */
> 
>  /* The PDO Statement Handle Class */
> 
> @@ -91,7 +91,10 @@
> /* this is not an error here */
> return 1;
> }
> -
> +   if (!param->name) {
> +   return 1;
> +   }
> +
> zend_hash_internal_pointer_reset(stmt->bound_param_map);
> while (SUCCESS == 
> zend_hash_get_current_data(stmt->bound_param_map, (void**)&name)) {
> if (strcmp(name, param->name)) {
> 
> --
> PHP CVS Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--
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_mysql mysql_driver.c

2005-07-11 Thread Ilia Alshanetsky

Andrey,

According to MySQL C API mysql_affected_rows() can return -1 indicating 
an error, hence the check in the code.


Ilia

Andrey Hristov wrote:

andrey  Mon Jul 11 09:52:15 2005 EDT
-   long c = mysql_affected_rows(H->server);
-   return c >0 ? c : 0;
+   return mysql_affected_rows(H->server);
}
 }



You remove the initial '"', but left the trailing one?


@@ -242,11 +241,9 @@
 {
pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
*quoted = emalloc(2*unquotedlen + 3);
-   (*quoted)[0] = '"';
*quotedlen = mysql_real_escape_string(H->server, *quoted + 1, unquoted, 
unquotedlen);
-   (*quoted)[*quotedlen + 1] = '"';
-   (*quoted)[*quotedlen + 2] = '\0';
-   *quotedlen += 2;
+   (*quoted)[0] =(*quoted)[*quotedlen + 1] = '"';
+   (*quoted)[*quotedlen+=2] = '\0';
return 1;
 }


Ilia

--
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_stmt.c

2005-07-11 Thread Andrey Hristov
andrey  Mon Jul 11 10:14:57 2005 EDT

  Modified files:  
/php-src/ext/pdopdo_stmt.c 
  Log:
  fix a segfault with the following script:
  prepare('select a, b, c from t123 where a=:what');
  $stmt->bindParam(1, $what, PDO_PARAM_INT, 12);
  var_dump($stmt->execute());
  var_dump($stmt->fetchObject());
  ?>
  
  
http://cvs.php.net/diff.php/php-src/ext/pdo/pdo_stmt.c?r1=1.108&r2=1.109&ty=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.108 php-src/ext/pdo/pdo_stmt.c:1.109
--- php-src/ext/pdo/pdo_stmt.c:1.108Fri Jul  8 23:52:39 2005
+++ php-src/ext/pdo/pdo_stmt.c  Mon Jul 11 10:14:56 2005
@@ -18,7 +18,7 @@
   +--+
 */
 
-/* $Id: pdo_stmt.c,v 1.108 2005/07/09 03:52:39 wez Exp $ */
+/* $Id: pdo_stmt.c,v 1.109 2005/07/11 14:14:56 andrey Exp $ */
 
 /* The PDO Statement Handle Class */
 
@@ -91,7 +91,10 @@
/* this is not an error here */
return 1;
}
-
+   if (!param->name) {
+   return 1;
+   }
+
zend_hash_internal_pointer_reset(stmt->bound_param_map);
while (SUCCESS == 
zend_hash_get_current_data(stmt->bound_param_map, (void**)&name)) {
if (strcmp(name, param->name)) {

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



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

2005-07-11 Thread Andrey Hristov
andrey  Mon Jul 11 09:52:15 2005 EDT

  Modified files:  
/php-src/ext/pdo_mysql  mysql_driver.c 
  Log:
  - mysql_affected_rows() already returns an unsigned long
  - optimize a bit the real_escape
  - handle the situation when libmysql bails out because of lack of memory
  
  
http://cvs.php.net/diff.php/php-src/ext/pdo_mysql/mysql_driver.c?r1=1.53&r2=1.54&ty=u
Index: php-src/ext/pdo_mysql/mysql_driver.c
diff -u php-src/ext/pdo_mysql/mysql_driver.c:1.53 
php-src/ext/pdo_mysql/mysql_driver.c:1.54
--- php-src/ext/pdo_mysql/mysql_driver.c:1.53   Fri Jul  8 15:25:37 2005
+++ php-src/ext/pdo_mysql/mysql_driver.cMon Jul 11 09:52:13 2005
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: mysql_driver.c,v 1.53 2005/07/08 19:25:37 wez Exp $ */
+/* $Id: mysql_driver.c,v 1.54 2005/07/11 13:52:13 andrey Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -225,8 +225,7 @@
pdo_mysql_error(dbh);
return -1;
} else {
-   long c = mysql_affected_rows(H->server);
-   return c >0 ? c : 0;
+   return mysql_affected_rows(H->server);
}
 }
 
@@ -242,11 +241,9 @@
 {
pdo_mysql_db_handle *H = (pdo_mysql_db_handle *)dbh->driver_data;
*quoted = emalloc(2*unquotedlen + 3);
-   (*quoted)[0] = '"';
*quotedlen = mysql_real_escape_string(H->server, *quoted + 1, unquoted, 
unquotedlen);
-   (*quoted)[*quotedlen + 1] = '"';
-   (*quoted)[*quotedlen + 2] = '\0';
-   *quotedlen += 2;
+   (*quoted)[0] =(*quoted)[*quotedlen + 1] = '"';
+   (*quoted)[*quotedlen+=2] = '\0';
return 1;
 }
 
@@ -329,7 +326,7 @@
case PDO_ATTR_AUTOCOMMIT:
ZVAL_LONG(return_value, dbh->auto_commit);
return 1;
-
+   
case PDO_MYSQL_ATTR_USE_BUFFERED_QUERY:
ZVAL_LONG(return_value, H->buffered);
return 1;
@@ -398,7 +395,11 @@
/* allocate an environment */

/* handle for the server */
-   H->server = mysql_init(NULL);
+   if (!(H->server = mysql_init(NULL))) {
+   pdo_mysql_error(dbh);
+   goto cleanup;
+   }
+   
dbh->driver_data = H;
 
/* handle MySQL options */

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



[PHP-CVS] cvs: php-src(PHP_4_4) / configure.in /main php_version.h

2005-07-11 Thread Derick Rethans
derick  Mon Jul 11 04:09:51 2005 EDT

  Modified files:  (Branch: PHP_4_4)
/php-srcconfigure.in 
/php-src/main   php_version.h 
  Log:
  - Back to -dev.
  
  
http://cvs.php.net/diff.php/php-src/configure.in?r1=1.396.2.164.2.8&r2=1.396.2.164.2.9&ty=u
Index: php-src/configure.in
diff -u php-src/configure.in:1.396.2.164.2.8 
php-src/configure.in:1.396.2.164.2.9
--- php-src/configure.in:1.396.2.164.2.8Mon Jul 11 03:45:09 2005
+++ php-src/configure.inMon Jul 11 04:09:47 2005
@@ -1,4 +1,4 @@
-dnl ## $Id: configure.in,v 1.396.2.164.2.8 2005/07/11 07:45:09 derick Exp $ 
-*- sh -*-
+dnl ## $Id: configure.in,v 1.396.2.164.2.9 2005/07/11 08:09:47 derick Exp $ 
-*- sh -*-
 dnl ## Process this file with autoconf to produce a configure script.
 
 divert(1)
@@ -40,8 +40,8 @@
 
 MAJOR_VERSION=4
 MINOR_VERSION=4
-RELEASE_VERSION=0
-EXTRA_VERSION=""
+RELEASE_VERSION=1
+EXTRA_VERSION="-dev"
 VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
 
 dnl Define where extension directories are located in the configure context
http://cvs.php.net/diff.php/php-src/main/php_version.h?r1=1.66.2.81.2.6&r2=1.66.2.81.2.7&ty=u
Index: php-src/main/php_version.h
diff -u php-src/main/php_version.h:1.66.2.81.2.6 
php-src/main/php_version.h:1.66.2.81.2.7
--- php-src/main/php_version.h:1.66.2.81.2.6Mon Jul 11 03:45:14 2005
+++ php-src/main/php_version.h  Mon Jul 11 04:09:51 2005
@@ -2,6 +2,6 @@
 /* edit configure.in to change version number */
 #define PHP_MAJOR_VERSION 4
 #define PHP_MINOR_VERSION 4
-#define PHP_RELEASE_VERSION 0
-#define PHP_EXTRA_VERSION ""
-#define PHP_VERSION "4.4.0"
+#define PHP_RELEASE_VERSION 1
+#define PHP_EXTRA_VERSION "-dev"
+#define PHP_VERSION "4.4.1-dev"

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



[PHP-CVS] cvs: php-src(PHP_4_4) / NEWS configure.in /main php_version.h

2005-07-11 Thread Derick Rethans
derick  Mon Jul 11 03:45:15 2005 EDT

  Modified files:  (Branch: PHP_4_4)
/php-srcNEWS configure.in 
/php-src/main   php_version.h 
  Log:
  - Go with 4.4.0.
  
  
http://cvs.php.net/diff.php/php-src/NEWS?r1=1.1247.2.920.2.12&r2=1.1247.2.920.2.13&ty=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.920.2.12 php-src/NEWS:1.1247.2.920.2.13
--- php-src/NEWS:1.1247.2.920.2.12  Tue Jul  5 08:50:02 2005
+++ php-src/NEWSMon Jul 11 03:45:08 2005
@@ -1,15 +1,6 @@
 PHP 4  NEWS
 |||
 11 Jul 2005, Version 4.4.0
-- Fixed memory corruption in pg_copy_from() in case the as_null parameter was
-  passed. (Derick)
-- Fixed bug #30052 (Crash on shutdown after odbc_pconnect()). (Edin)
-
-01 Jul 2005, Version 4.4.0 RC2
-- Fixed bug #31213 (Sideeffects caused by fix of bug #29493). (Dmitry)
-- Fixed bug #28377 (debug_backtrace is intermittently passing args). (Dmitry)
-
-13 Jun 2005, Version 4.4.0 RC1
 - Added man pages for "phpize" and "php-config" scripts. (Jakub Vrana)
 - Added support for .cc files in extensions. (Brian)
 - Added the sorting flag SORT_LOCALE_STRING to the sort() functions which makes
@@ -18,6 +9,8 @@
   low level IO. (Uwe)
 - Fixed memory corruptions when using references in a wrong way. (Marcus,
   Dmitry, Derick)
+- Fixed memory corruption in pg_copy_from() in case the as_null parameter was
+  passed. (Derick)
 - Fixed memory corruption in stristr(). (Derick)
 - Fixed bug #32685, #29423 (Segfault when using assignment by reference within
   function). (Dmitry, Derick)
@@ -83,11 +76,14 @@
   response message). (Jani) 
 - Fixed bug #31583 (php_std_date() uses short day names in non-y2k_compliance 
mode).
   (mike at php dot net)
+- Fixed bug #31213 (Sideeffects caused by fix of bug #29493). (Dmitry)
+- Fixed bug #30052 (Crash on shutdown after odbc_pconnect()). (Edin)
 - Fixed bug #29975 (memory leaks when set_error_handler() is used inside error 
   handler). (Tony)
 - Fixed bug #29944 (Function defined in switch, crashes). (Dmitry)
 - Fixed bug #29338 (unencoded spaces get ignored after certain tags). (Ilia)
 - Fixed bug #28605 (Need to use -[m]ieee option for Alpha CPUs). (Jani)
+- Fixed bug #28377 (debug_backtrace is intermittently passing args). (Dmitry)
 
 31 Mar 2005, Version 4.3.11
 - Added Oracle Instant Client support. (cjbj at hotmail dot com, Tony)
http://cvs.php.net/diff.php/php-src/configure.in?r1=1.396.2.164.2.7&r2=1.396.2.164.2.8&ty=u
Index: php-src/configure.in
diff -u php-src/configure.in:1.396.2.164.2.7 
php-src/configure.in:1.396.2.164.2.8
--- php-src/configure.in:1.396.2.164.2.7Fri Jul  1 06:05:42 2005
+++ php-src/configure.inMon Jul 11 03:45:09 2005
@@ -1,4 +1,4 @@
-dnl ## $Id: configure.in,v 1.396.2.164.2.7 2005/07/01 10:05:42 derick Exp $ 
-*- sh -*-
+dnl ## $Id: configure.in,v 1.396.2.164.2.8 2005/07/11 07:45:09 derick Exp $ 
-*- sh -*-
 dnl ## Process this file with autoconf to produce a configure script.
 
 divert(1)
@@ -41,7 +41,7 @@
 MAJOR_VERSION=4
 MINOR_VERSION=4
 RELEASE_VERSION=0
-EXTRA_VERSION="RC3-dev"
+EXTRA_VERSION=""
 VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
 
 dnl Define where extension directories are located in the configure context
http://cvs.php.net/diff.php/php-src/main/php_version.h?r1=1.66.2.81.2.5&r2=1.66.2.81.2.6&ty=u
Index: php-src/main/php_version.h
diff -u php-src/main/php_version.h:1.66.2.81.2.5 
php-src/main/php_version.h:1.66.2.81.2.6
--- php-src/main/php_version.h:1.66.2.81.2.5Fri Jul  1 06:05:40 2005
+++ php-src/main/php_version.h  Mon Jul 11 03:45:14 2005
@@ -3,5 +3,5 @@
 #define PHP_MAJOR_VERSION 4
 #define PHP_MINOR_VERSION 4
 #define PHP_RELEASE_VERSION 0
-#define PHP_EXTRA_VERSION "RC3-dev"
-#define PHP_VERSION "4.4.0RC3-dev"
+#define PHP_EXTRA_VERSION ""
+#define PHP_VERSION "4.4.0"

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