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

2003-11-23 Thread Georg Richter
georg   Sun Nov 23 02:50:05 2003 EDT

  Modified files:  
/php-src/ext/mysqli mysqli_nonapi.c 
  Log:
  fixed mem leak in constructor
  
  
Index: php-src/ext/mysqli/mysqli_nonapi.c
diff -u php-src/ext/mysqli/mysqli_nonapi.c:1.19 php-src/ext/mysqli/mysqli_nonapi.c:1.20
--- php-src/ext/mysqli/mysqli_nonapi.c:1.19 Sat Nov 22 16:20:07 2003
+++ php-src/ext/mysqli/mysqli_nonapi.c  Sun Nov 23 02:50:04 2003
@@ -15,7 +15,7 @@
   | Author: Georg Richter [EMAIL PROTECTED]|
   +--+
 
-  $Id: mysqli_nonapi.c,v 1.19 2003/11/22 21:20:07 georg Exp $ 
+  $Id: mysqli_nonapi.c,v 1.20 2003/11/23 07:50:04 georg Exp $ 
 */
 
 #ifdef HAVE_CONFIG_H
@@ -42,6 +42,10 @@
unsigned intport=0;
struct timeval  starttime;
 
+   if (getThis()  !ZEND_NUM_ARGS()) {
+   RETURN_NULL();
+   }
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, |ls, hostname, 
hostname_len, username, username_len, 
passwd, passwd_len, dbname, dbname_len, port, socket, 
socket_len) == FAILURE) {
return;

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



[PHP-CVS] cvs: php-src /ext/simplexml php_simplexml.h simplexml.c /ext/simplexml/tests 006.phpt 006.xml

2003-11-23 Thread Marcus Boerger
helly   Sun Nov 23 11:20:59 2003 EDT

  Modified files:  
/php-src/ext/simplexml  php_simplexml.h simplexml.c 
/php-src/ext/simplexml/tests006.phpt 006.xml 
  Log:
  Several  improvements to the simplexml_element object:
  - Allow to use it as an instance of Iterator
  - Prepareto use it as a normal object, including spcialization
  
  Index: php-src/ext/simplexml/php_simplexml.h
diff -u php-src/ext/simplexml/php_simplexml.h:1.8 
php-src/ext/simplexml/php_simplexml.h:1.9
--- php-src/ext/simplexml/php_simplexml.h:1.8   Sun Oct 26 11:00:58 2003
+++ php-src/ext/simplexml/php_simplexml.h   Sun Nov 23 11:20:57 2003
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: php_simplexml.h,v 1.8 2003/10/26 16:00:58 rrichards Exp $ */
+/* $Id: php_simplexml.h,v 1.9 2003/11/23 16:20:57 helly Exp $ */
 
 #ifndef PHP_SIMPLEXML_H
 #define PHP_SIMPLEXML_H
@@ -64,6 +64,12 @@
HashTable *properties;
simplexml_nsmap *nsmapptr;
xmlXPathContextPtr xpath;
+   struct {
+   xmlNodePtrnode;
+   char  *name;
+   int   namelen;
+   zval  *data;
+   } iter;
 } php_sxe_object;
 
 
Index: php-src/ext/simplexml/simplexml.c
diff -u php-src/ext/simplexml/simplexml.c:1.85 php-src/ext/simplexml/simplexml.c:1.86
--- php-src/ext/simplexml/simplexml.c:1.85  Fri Nov 14 02:41:05 2003
+++ php-src/ext/simplexml/simplexml.c   Sun Nov 23 11:20:57 2003
@@ -17,7 +17,7 @@
   +--+
 */
 
-/* $Id: simplexml.c,v 1.85 2003/11/14 07:41:05 helly Exp $ */
+/* $Id: simplexml.c,v 1.86 2003/11/23 16:20:57 helly Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -30,8 +30,17 @@
 #include ext/standard/info.h
 #include php_simplexml.h
 
+#if HAVE_SPL
+#include ext/spl/spl_iterators.h
+#endif
+
+
 zend_class_entry *sxe_class_entry;
 
+#define SXE_ME(func, arg_info, flags) PHP_ME(simplexml_element, func, arg_info, flags)
+
+#define SXE_METHOD(func) PHP_METHOD(simplexml_element, func)
+
 #define SKIP_TEXT(__p) \
if ((__p)-type == XML_TEXT_NODE) { \
goto next_iter; \
@@ -51,8 +60,7 @@
 
 /* {{{ _node_as_zval()
  */
-static void
-_node_as_zval(php_sxe_object *sxe, xmlNodePtr node, zval *value TSRMLS_DC)
+static void _node_as_zval(php_sxe_object *sxe, xmlNodePtr node, zval *value TSRMLS_DC)
 {
php_sxe_object *subnode;
 
@@ -118,8 +126,7 @@

 /* {{{ sxe_prop_dim_read()
  */
-static zval *
-sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, zend_bool attribs, 
zend_bool silent TSRMLS_DC)
+static zval * sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, 
zend_bool attribs, zend_bool silent TSRMLS_DC)
 {
zval   *return_value;
zval   *value = NULL;
@@ -224,8 +231,7 @@
 
 /* {{{ sxe_property_read()
  */
-static zval *
-sxe_property_read(zval *object, zval *member, zend_bool silent TSRMLS_DC)
+static zval * sxe_property_read(zval *object, zval *member, zend_bool silent 
TSRMLS_DC)
 {
return sxe_prop_dim_read(object, member, 1, 0, silent TSRMLS_CC);
 }
@@ -233,7 +239,7 @@
 
 /* {{{ sxe_dimension_read()
  */
-static zval *sxe_dimension_read(zval *object, zval *offset TSRMLS_DC)
+static zval * sxe_dimension_read(zval *object, zval *offset TSRMLS_DC)
 {
return sxe_prop_dim_read(object, offset, 0, 1, 0 TSRMLS_CC);
 }
@@ -641,10 +647,9 @@
 }
 /* }}} */
 
-/* {{{ simplexml_ce_xpath_search()
- */
-static void 
-simplexml_ce_xpath_search(INTERNAL_FUNCTION_PARAMETERS)
+/* {{{ xsearch()
+ */ 
+SXE_METHOD(xsearch)
 {
php_sxe_object*sxe;
zval  *value;
@@ -694,8 +699,7 @@
_node_as_zval(sxe, result-nodeTab[i], value TSRMLS_CC);
}
add_next_index_zval(return_value, value);
-   }
-   
+   }   
 }
 /* }}} */
 
@@ -775,12 +779,26 @@
 }
 /* }}} */
 
+/* {{{ validate_schema_file
+ */
+SXE_METHOD(validate_schema_file)
+{
+   simplexml_ce_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, SCHEMA_FILE);
+}
+/* }}} */
+
+/* {{{ validate_schema_buffer
+ */
+SXE_METHOD(validate_schema_buffer)
+{
+   simplexml_ce_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, SCHEMA_BLOB);
+}
+/* }}} */
 #endif
 
 /* {{{ simplexml_ce_register_ns()
  */
-static void
-simplexml_ce_register_ns(INTERNAL_FUNCTION_PARAMETERS)
+SXE_METHOD(register_ns)
 {
php_sxe_object *sxe;
char *nsname;
@@ -800,8 +818,7 @@
 
 /* {{{ simplexml_ce_to_xml_string()
  */
-static void 
-simplexml_ce_to_xml_string(INTERNAL_FUNCTION_PARAMETERS)
+SXE_METHOD(to_xml_string)
 {
php_sxe_object *sxe;
xmlChar *strval;
@@ -822,8 +839,7 @@
 
 /* {{{ simplexml_ce_to_xml_file()
  */
-static void
-simplexml_ce_to_xml_file(INTERNAL_FUNCTION_PARAMETERS)
+SXE_METHOD(to_xml_file)
 {

[PHP-CVS] cvs: php-src /main/streams streams.c

2003-11-23 Thread Sara Golemon
pollita Sun Nov 23 12:35:01 2003 EDT

  Modified files:  
/php-src/main/streams   streams.c 
  Log:
  Fix for file:// wrapper parsing.
  (Cristiano Duarte [EMAIL PROTECTED])
  
  
Index: php-src/main/streams/streams.c
diff -u php-src/main/streams/streams.c:1.39 php-src/main/streams/streams.c:1.40
--- php-src/main/streams/streams.c:1.39 Mon Nov  3 09:12:46 2003
+++ php-src/main/streams/streams.c  Sun Nov 23 12:35:00 2003
@@ -19,7 +19,7 @@
+--+
  */
 
-/* $Id: streams.c,v 1.39 2003/11/03 14:12:46 derick Exp $ */
+/* $Id: streams.c,v 1.40 2003/11/23 17:35:00 pollita Exp $ */
 
 #define _GNU_SOURCE
 #include php.h
@@ -1433,7 +1433,7 @@
 #ifdef PHP_WIN32
if (*(*path_for_open + 1) != ':')
 #endif
-   *path_for_open--;
+   (*path_for_open)--;
}

/* fall back on regular file access */

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



Re: [PHP-CVS] cvs: php-src /main/streams streams.c

2003-11-23 Thread Wez Furlong
That win32 branch of the code looks suspect
(I know it is not part of the commit).
Anyone have time to check it out?

--Wez.

  #ifdef PHP_WIN32
   if (*(*path_for_open + 1) != ':')
  #endif
 - *path_for_open--;
 + (*path_for_open)--;

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



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

2003-11-23 Thread Ilia Alshanetsky
iliaa   Sun Nov 23 20:42:43 2003 EDT

  Modified files:  
/php-src/ext/standard   file.c 
  Log:
  Fixed bug #26355 (flock() doesn't initialize the wouldblock argument)
  
  
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.365 php-src/ext/standard/file.c:1.366
--- php-src/ext/standard/file.c:1.365   Wed Oct 29 17:25:57 2003
+++ php-src/ext/standard/file.c Sun Nov 23 20:42:43 2003
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.365 2003/10/29 22:25:57 moriyoshi Exp $ */
+/* $Id: file.c,v 1.366 2003/11/24 01:42:43 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -263,12 +263,16 @@
RETURN_FALSE;
}
 
+   if (arg3  PZVAL_IS_REF(arg3)) {
+   convert_to_long_ex(arg3);
+   Z_LVAL_P(arg3) = 0;
+   }
+
/* flock_values contains all possible actions if (operation  4) we won't 
block on the lock */
act = flock_values[act - 1] | (operation  4 ? LOCK_NB : 0);
if (!php_stream_lock(stream, act)) {
if (operation  errno == EWOULDBLOCK  arg3  PZVAL_IS_REF(arg3)) {
-   convert_to_long_ex(arg3);
-   ZVAL_LONG(arg3, 1);
+   Z_LVAL_P(arg3) = 1;
}
RETURN_TRUE;
}

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



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

2003-11-23 Thread Ilia Alshanetsky
iliaa   Sun Nov 23 20:44:00 2003 EDT

  Modified files:  (Branch: PHP_4_3)
/php-srcNEWS 
/php-src/ext/standard   file.c 
  Log:
  MFH: Fixed bug #26355 (flock() doesn't initialize the wouldblock argument)
  
  
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.475 php-src/NEWS:1.1247.2.476
--- php-src/NEWS:1.1247.2.475   Sat Nov 22 08:40:39 2003
+++ php-src/NEWSSun Nov 23 20:43:58 2003
@@ -3,6 +3,7 @@
 ?? ??? 2003, Version 4.3.5
 - Fixed header handler in NSAPI SAPI module (header-replace was ignored,
   send_default_content_type now sends value from php.ini). (Uwe Schindler)
+- Fixed bug #26355 (flock() doesn't initialize the wouldblock argument). (Ilia)
 - Fixed bug #26309 (Fixed argument parsing for imageftbbox()). (Ilia)
 - Fixed bug #26285 (escapeshellarg() uses wrong quotes on windows). (Ilia)
 - Fixed bug #26267 (gmp_random() leaks memory and does not produce random
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.39 php-src/ext/standard/file.c:1.279.2.40
--- php-src/ext/standard/file.c:1.279.2.39  Fri Nov  7 16:40:46 2003
+++ php-src/ext/standard/file.c Sun Nov 23 20:43:59 2003
@@ -21,7 +21,7 @@
+--+
  */
 
-/* $Id: file.c,v 1.279.2.39 2003/11/07 21:40:46 iliaa Exp $ */
+/* $Id: file.c,v 1.279.2.40 2003/11/24 01:43:59 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -247,12 +247,17 @@
RETURN_FALSE;
}
 
+   if (arg_count == 3) {
+   convert_to_long_ex(arg3);
+   Z_LVAL_PP(arg3) = 0;
+   }
+
/* flock_values contains all possible actions
   if (arg2  4) we won't block on the lock */
act = flock_values[act - 1] | (Z_LVAL_PP(arg2)  4 ? LOCK_NB : 0);
if (flock(fd, act)) {
if (errno == EWOULDBLOCK  arg_count == 3) {
-   ZVAL_LONG(*arg3, 1);
+   Z_LVAL_PP(arg3) = 1;
} else {
RETURN_FALSE;
}   

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



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

2003-11-23 Thread Moriyoshi Koizumi
moriyoshi   Mon Nov 24 01:04:40 2003 EDT

  Modified files:  
/php-src/ext/xmlcompat.c 
  Log:
  Partial fix for bug #25803 (xml_get_current_byte_index() always returns 0)
  
  
Index: php-src/ext/xml/compat.c
diff -u php-src/ext/xml/compat.c:1.19 php-src/ext/xml/compat.c:1.20
--- php-src/ext/xml/compat.c:1.19   Mon Sep 29 07:35:39 2003
+++ php-src/ext/xml/compat.cMon Nov 24 01:04:39 2003
@@ -629,7 +629,8 @@
 int
 XML_GetCurrentByteIndex(XML_Parser parser)
 {
-   return parser-parser-input-consumed;
+   return parser-parser-input-consumed +
+   (parser-parser-input-cur - parser-parser-input-base);
 }
 
 const XML_Char *XML_ExpatVersion(void)

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