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

2008-08-23 Thread Felipe Pena
felipe  Sun Aug 24 02:13:23 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/xmlxml.c 
  Log:
  - Removed unnecessary variable
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xml/xml.c?r1=1.157.2.4.2.5.2.10&r2=1.157.2.4.2.5.2.11&diff_format=u
Index: php-src/ext/xml/xml.c
diff -u php-src/ext/xml/xml.c:1.157.2.4.2.5.2.10 
php-src/ext/xml/xml.c:1.157.2.4.2.5.2.11
--- php-src/ext/xml/xml.c:1.157.2.4.2.5.2.10Thu Jul 17 10:24:51 2008
+++ php-src/ext/xml/xml.c   Sun Aug 24 02:13:23 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: xml.c,v 1.157.2.4.2.5.2.10 2008/07/17 10:24:51 tony2001 Exp $ */
+/* $Id: xml.c,v 1.157.2.4.2.5.2.11 2008/08/24 02:13:23 felipe Exp $ */
 
 #define IS_EXT_MODULE
 
@@ -1478,12 +1478,10 @@
xml_parser *parser;
zval *pind;
char *data;
-   int data_len, argc, ret;
+   int data_len, ret;
long isFinal = 0;
 
-   argc = ZEND_NUM_ARGS();
-   
-   if (zend_parse_parameters(argc TSRMLS_CC, "rs|l", &pind, &data, 
&data_len, &isFinal) == FAILURE) {
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &pind, 
&data, &data_len, &isFinal) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(parser,xml_parser *, &pind, -1, "XML Parser", 
le_xml_parser);



-- 
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/xml xml.c

2008-07-17 Thread Antony Dovgal
tony2001Thu Jul 17 10:24:52 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/xmlxml.c 
  Log:
  fix folding
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xml/xml.c?r1=1.157.2.4.2.5.2.9&r2=1.157.2.4.2.5.2.10&diff_format=u
Index: php-src/ext/xml/xml.c
diff -u php-src/ext/xml/xml.c:1.157.2.4.2.5.2.9 
php-src/ext/xml/xml.c:1.157.2.4.2.5.2.10
--- php-src/ext/xml/xml.c:1.157.2.4.2.5.2.9 Thu Jul 17 09:53:42 2008
+++ php-src/ext/xml/xml.c   Thu Jul 17 10:24:51 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: xml.c,v 1.157.2.4.2.5.2.9 2008/07/17 09:53:42 dmitry Exp $ */
+/* $Id: xml.c,v 1.157.2.4.2.5.2.10 2008/07/17 10:24:51 tony2001 Exp $ */
 
 #define IS_EXT_MODULE
 
@@ -1196,7 +1196,7 @@
 
 /* EXTENSION FUNCTIONS */
 
-static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int 
ns_support)
+static void php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAMETERS, int 
ns_support) /* {{{ */
 {
xml_parser *parser;
int auto_detect = 0;
@@ -1252,6 +1252,7 @@
ZEND_REGISTER_RESOURCE(return_value, parser,le_xml_parser);
parser->index = Z_LVAL_P(return_value);
 }
+/* }}} */
 
 /* {{{ proto resource xml_parser_create([string encoding]) 
Create an XML parser */



-- 
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/xml xml.c

2008-07-05 Thread Felipe Pena
felipe  Sat Jul  5 20:17:58 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/xmlxml.c 
  Log:
  - Removed unnecessary #include "zend_arg_defs.c"
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xml/xml.c?r1=1.157.2.4.2.5.2.7&r2=1.157.2.4.2.5.2.8&diff_format=u
Index: php-src/ext/xml/xml.c
diff -u php-src/ext/xml/xml.c:1.157.2.4.2.5.2.7 
php-src/ext/xml/xml.c:1.157.2.4.2.5.2.8
--- php-src/ext/xml/xml.c:1.157.2.4.2.5.2.7 Tue Jul  1 15:33:11 2008
+++ php-src/ext/xml/xml.c   Sat Jul  5 20:17:58 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: xml.c,v 1.157.2.4.2.5.2.7 2008/07/01 15:33:11 felipe Exp $ */
+/* $Id: xml.c,v 1.157.2.4.2.5.2.8 2008/07/05 20:17:58 felipe Exp $ */
 
 #define IS_EXT_MODULE
 
@@ -62,9 +62,6 @@
 /* {{{ dynamically loadable module stuff */
 #ifdef COMPILE_DL_XML
 ZEND_GET_MODULE(xml)
-# ifdef PHP_WIN32
-# include "zend_arg_defs.c"
-# endif
 #endif /* COMPILE_DL_XML */
 /* }}} */
 



-- 
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/xml xml.c

2008-07-01 Thread Felipe Pena
felipe  Tue Jul  1 15:33:12 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/xmlxml.c 
  Log:
  - Added arginfo
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xml/xml.c?r1=1.157.2.4.2.5.2.6&r2=1.157.2.4.2.5.2.7&diff_format=u
Index: php-src/ext/xml/xml.c
diff -u php-src/ext/xml/xml.c:1.157.2.4.2.5.2.6 
php-src/ext/xml/xml.c:1.157.2.4.2.5.2.7
--- php-src/ext/xml/xml.c:1.157.2.4.2.5.2.6 Sun Jun 22 14:13:41 2008
+++ php-src/ext/xml/xml.c   Tue Jul  1 15:33:11 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: xml.c,v 1.157.2.4.2.5.2.6 2008/06/22 14:13:41 rrichards Exp $ */
+/* $Id: xml.c,v 1.157.2.4.2.5.2.7 2008/07/01 15:33:11 felipe Exp $ */
 
 #define IS_EXT_MODULE
 
@@ -100,38 +100,170 @@
 
 /* {{{ extension definition structures */
 static
-   ZEND_BEGIN_ARG_INFO(third_and_fourth_args_force_ref, 0)
-   ZEND_ARG_PASS_INFO(0)
-   ZEND_ARG_PASS_INFO(0)
-   ZEND_ARG_PASS_INFO(1)
-   ZEND_ARG_PASS_INFO(1)
-   ZEND_END_ARG_INFO();
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_create, 0, 0, 0)
+   ZEND_ARG_INFO(0, encoding)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_create_ns, 0, 0, 0)
+   ZEND_ARG_INFO(0, encoding)
+   ZEND_ARG_INFO(0, sep)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_object, 0, 0, 2)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(1, obj)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_element_handler, 0, 0, 3)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(0, shdl)
+   ZEND_ARG_INFO(0, ehdl)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_character_data_handler, 0, 0, 2)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(0, hdl)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_processing_instruction_handler, 0, 0, 2)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(0, hdl)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_default_handler, 0, 0, 2)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(0, hdl)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_unparsed_entity_decl_handler, 0, 0, 2)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(0, hdl)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_notation_decl_handler, 0, 0, 2)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(0, hdl)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_external_entity_ref_handler, 0, 0, 2)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(0, hdl)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_start_namespace_decl_handler, 0, 0, 2)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(0, hdl)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_set_end_namespace_decl_handler, 0, 0, 2)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(0, hdl)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parse, 0, 0, 2)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(0, data)
+   ZEND_ARG_INFO(0, isfinal)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parse_into_struct, 0, 0, 3)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(0, data)
+   ZEND_ARG_INFO(1, values)
+   ZEND_ARG_INFO(1, index)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_get_error_code, 0, 0, 1)
+   ZEND_ARG_INFO(0, parser)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_error_string, 0, 0, 1)
+   ZEND_ARG_INFO(0, code)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_get_current_line_number, 0, 0, 1)
+   ZEND_ARG_INFO(0, parser)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_get_current_column_number, 0, 0, 1)
+   ZEND_ARG_INFO(0, parser)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_get_current_byte_index, 0, 0, 1)
+   ZEND_ARG_INFO(0, parser)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_free, 0, 0, 1)
+   ZEND_ARG_INFO(0, parser)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_set_option, 0, 0, 3)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(0, option)
+   ZEND_ARG_INFO(0, value)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_xml_parser_get_option, 0, 0, 2)
+   ZEND_ARG_INFO(0, parser)
+   ZEND_ARG_INFO(0, option)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_utf8_encode, 0, 0, 1)
+   ZEND_ARG_INFO(0, data)
+ZEND_END_ARG_INFO()
+
+static
+ZEND_BEGIN_ARG_INFO_EX(arginfo_utf8_decode, 0, 0, 1)
+   ZEND_ARG_INFO(0, data)
+ZEND_END_ARG_INFO()
 
 const zend_function_entry xml_functions[] = {
-   PHP_FE(xml_parser_create, NULL)
-   PHP_FE(xml_parser_create_ns, NULL)
-   PHP_FE(xml_set

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

2008-06-22 Thread Rob Richards
rrichards   Sun Jun 22 14:13:42 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/xmlxml.c 
  Log:
  fix parameter parsing change
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xml/xml.c?r1=1.157.2.4.2.5.2.5&r2=1.157.2.4.2.5.2.6&diff_format=u
Index: php-src/ext/xml/xml.c
diff -u php-src/ext/xml/xml.c:1.157.2.4.2.5.2.5 
php-src/ext/xml/xml.c:1.157.2.4.2.5.2.6
--- php-src/ext/xml/xml.c:1.157.2.4.2.5.2.5 Sun Jun 22 13:22:27 2008
+++ php-src/ext/xml/xml.c   Sun Jun 22 14:13:41 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: xml.c,v 1.157.2.4.2.5.2.5 2008/06/22 13:22:27 felipe Exp $ */
+/* $Id: xml.c,v 1.157.2.4.2.5.2.6 2008/06/22 14:13:41 rrichards Exp $ */
 
 #define IS_EXT_MODULE
 
@@ -1346,23 +1346,18 @@
 PHP_FUNCTION(xml_parse)
 {
xml_parser *parser;
-   zval *pind, **final;
+   zval *pind;
char *data;
-   int data_len, argc, isFinal, ret;
+   int data_len, argc, ret;
+   long isFinal = 0;
 
argc = ZEND_NUM_ARGS();

-   if (zend_parse_parameters(argc TSRMLS_CC, "rs|l", &pind, &data, 
&data_len, &final) == FAILURE) {
+   if (zend_parse_parameters(argc TSRMLS_CC, "rs|l", &pind, &data, 
&data_len, &isFinal) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(parser,xml_parser *, &pind, -1, "XML Parser", 
le_xml_parser);
 
-   if (argc == 3) {
-   isFinal = final;
-   } else {
-   isFinal = 0;
-   }
-
parser->isparsing = 1;
ret = XML_Parse(parser->parser, data, data_len, isFinal);
parser->isparsing = 0;



-- 
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/xml xml.c

2008-06-22 Thread Felipe Pena
felipe  Sun Jun 22 13:22:27 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/xmlxml.c 
  Log:
  - New parameter parsing API
  
  http://cvs.php.net/viewvc.cgi/php-src/ext/xml/xml.c?r1=1.157.2.4.2.5.2.4&r2=1.157.2.4.2.5.2.5&diff_format=u
Index: php-src/ext/xml/xml.c
diff -u php-src/ext/xml/xml.c:1.157.2.4.2.5.2.4 
php-src/ext/xml/xml.c:1.157.2.4.2.5.2.5
--- php-src/ext/xml/xml.c:1.157.2.4.2.5.2.4 Wed Jan 30 08:52:17 2008
+++ php-src/ext/xml/xml.c   Sun Jun 22 13:22:27 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: xml.c,v 1.157.2.4.2.5.2.4 2008/01/30 08:52:17 rasmus Exp $ */
+/* $Id: xml.c,v 1.157.2.4.2.5.2.5 2008/06/22 13:22:27 felipe Exp $ */
 
 #define IS_EXT_MODULE
 
@@ -1145,19 +1145,13 @@
 PHP_FUNCTION(xml_set_object)
 {
xml_parser *parser;
-   zval **pind, **mythis;
+   zval *pind, *mythis;
 
-   if (ZEND_NUM_ARGS() != 2 ||
-   zend_get_parameters_ex(2, &pind, &mythis) == FAILURE) {
-   WRONG_PARAM_COUNT;
-   }
-
-   if (Z_TYPE_PP(mythis) != IS_OBJECT) {
-   php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument 2 has 
wrong type");
-   RETURN_FALSE;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ro", &pind, 
&mythis) == FAILURE) {
+   return;
}
 
-   ZEND_FETCH_RESOURCE(parser,xml_parser *,pind, -1, "XML Parser", 
le_xml_parser);
+   ZEND_FETCH_RESOURCE(parser,xml_parser *, &pind, -1, "XML Parser", 
le_xml_parser);
 
/* please leave this commented - or ask [EMAIL PROTECTED] before doing 
it (again) */
if (parser->object) {
@@ -1170,7 +1164,7 @@
 #endif */
 
ALLOC_ZVAL(parser->object);
-   *parser->object = **mythis;
+   *parser->object = *mythis;
zval_copy_ctor(parser->object);
INIT_PZVAL(parser->object);
 
@@ -1183,14 +1177,13 @@
 PHP_FUNCTION(xml_set_element_handler)
 {
xml_parser *parser;
-   zval **pind, **shdl, **ehdl;
+   zval *pind, **shdl, **ehdl;
 
-   if (ZEND_NUM_ARGS() != 3 ||
-   zend_get_parameters_ex(3, &pind, &shdl, &ehdl) == FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rZZ", &pind, 
&shdl, &ehdl) == FAILURE) {
+   return;
}
 
-   ZEND_FETCH_RESOURCE(parser,xml_parser *,pind, -1, "XML Parser", 
le_xml_parser);
+   ZEND_FETCH_RESOURCE(parser,xml_parser *, &pind, -1, "XML Parser", 
le_xml_parser);
 
xml_set_handler(&parser->startElementHandler, shdl);
xml_set_handler(&parser->endElementHandler, ehdl);
@@ -1204,13 +1197,13 @@
 PHP_FUNCTION(xml_set_character_data_handler)
 {
xml_parser *parser;
-   zval **pind, **hdl;
+   zval *pind, **hdl;
 
-   if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rZ", &pind, &hdl) 
== FAILURE) {
+   return;
}
 
-   ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", 
le_xml_parser);
+   ZEND_FETCH_RESOURCE(parser,xml_parser *, &pind, -1, "XML Parser", 
le_xml_parser);
 
xml_set_handler(&parser->characterDataHandler, hdl);
XML_SetCharacterDataHandler(parser->parser, _xml_characterDataHandler);
@@ -1223,13 +1216,13 @@
 PHP_FUNCTION(xml_set_processing_instruction_handler)
 {
xml_parser *parser;
-   zval **pind, **hdl;
+   zval *pind, **hdl;
 
-   if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rZ", &pind, &hdl) 
== FAILURE) {
+   return;
}
 
-   ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", 
le_xml_parser);
+   ZEND_FETCH_RESOURCE(parser,xml_parser *, &pind, -1, "XML Parser", 
le_xml_parser);
 
xml_set_handler(&parser->processingInstructionHandler, hdl);
XML_SetProcessingInstructionHandler(parser->parser, 
_xml_processingInstructionHandler);
@@ -1242,12 +1235,12 @@
 PHP_FUNCTION(xml_set_default_handler)
 {
xml_parser *parser;
-   zval **pind, **hdl;
+   zval *pind, **hdl;
 
-   if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &hdl) == 
FAILURE) {
-   WRONG_PARAM_COUNT;
+   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rZ", &pind, &hdl) 
== FAILURE) {
+   return;
}
-   ZEND_FETCH_RESOURCE(parser,xml_parser *, pind, -1, "XML Parser", 
le_xml_parser);
+   ZEND_FETCH_RESOURCE(parser,xml_parser *, &pind, -1, "XML Parser", 
le_xml_parser);
 
xml_set_handler(&parser->defaultHandler, hdl);
XML_SetDefaultHandler(parser->parser, _xml_defaultHandler);
@@ -1260,13 +1253,13 @@
 PHP_FUNCTION(xml_set_unparsed_entity_decl_handler)
 {
xml_parse

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

2008-01-30 Thread Rasmus Lerdorf
rasmus  Wed Jan 30 08:52:17 2008 UTC

  Modified files:  (Branch: PHP_5_3)
/php-src/ext/xmlxml.c 
  Log:
  fix typo
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xml/xml.c?r1=1.157.2.4.2.5.2.3&r2=1.157.2.4.2.5.2.4&diff_format=u
Index: php-src/ext/xml/xml.c
diff -u php-src/ext/xml/xml.c:1.157.2.4.2.5.2.3 
php-src/ext/xml/xml.c:1.157.2.4.2.5.2.4
--- php-src/ext/xml/xml.c:1.157.2.4.2.5.2.3 Tue Jan 29 23:21:10 2008
+++ php-src/ext/xml/xml.c   Wed Jan 30 08:52:17 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: xml.c,v 1.157.2.4.2.5.2.3 2008/01/29 23:21:10 rasmus Exp $ */
+/* $Id: xml.c,v 1.157.2.4.2.5.2.4 2008/01/30 08:52:17 rasmus Exp $ */
 
 #define IS_EXT_MODULE
 
@@ -595,7 +595,7 @@
s += 3;
pos -= 3;
} else if (c >= 0xc0) { /* two bytes encoded, 11 bits */
-   if(pos-3 >= 0) {
+   if(pos-2 >= 0) {
c = ((s[0]&63)<<6) | (s[1]&63);
} else {
c = '?';

-- 
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/xml xml.c /ext/xml/tests bug43957.phpt

2008-01-29 Thread Rasmus Lerdorf
rasmus  Tue Jan 29 23:21:11 2008 UTC

  Added files: (Branch: PHP_5_3)
/php-src/ext/xml/tests  bug43957.phpt 

  Modified files:  
/php-src/ext/xmlxml.c 
  Log:
  Fixed bug #43957 (utf8_decode() bogus conversion of partial multibyte UTF8 
char)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xml/xml.c?r1=1.157.2.4.2.5.2.2&r2=1.157.2.4.2.5.2.3&diff_format=u
Index: php-src/ext/xml/xml.c
diff -u php-src/ext/xml/xml.c:1.157.2.4.2.5.2.2 
php-src/ext/xml/xml.c:1.157.2.4.2.5.2.3
--- php-src/ext/xml/xml.c:1.157.2.4.2.5.2.2 Mon Dec 31 07:17:16 2007
+++ php-src/ext/xml/xml.c   Tue Jan 29 23:21:10 2008
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: xml.c,v 1.157.2.4.2.5.2.2 2007/12/31 07:17:16 sebastian Exp $ */
+/* $Id: xml.c,v 1.157.2.4.2.5.2.3 2008/01/29 23:21:10 rasmus Exp $ */
 
 #define IS_EXT_MODULE
 
@@ -579,15 +579,27 @@
while (pos > 0) {
c = (unsigned char)(*s);
if (c >= 0xf0) { /* four bytes encoded, 21 bits */
-   c = ((s[0]&7)<<18) | ((s[1]&63)<<12) | ((s[2]&63)<<6) | 
(s[3]&63);
+   if(pos-4 >= 0) {
+   c = ((s[0]&7)<<18) | ((s[1]&63)<<12) | 
((s[2]&63)<<6) | (s[3]&63);
+   } else {
+   c = '?';
+   }
s += 4;
pos -= 4;
} else if (c >= 0xe0) { /* three bytes encoded, 16 bits */
-   c = ((s[0]&63)<<12) | ((s[1]&63)<<6) | (s[2]&63);
+   if(pos-3 >= 0) {
+   c = ((s[0]&63)<<12) | ((s[1]&63)<<6) | 
(s[2]&63);
+   } else {
+   c = '?';
+   }
s += 3;
pos -= 3;
} else if (c >= 0xc0) { /* two bytes encoded, 11 bits */
-   c = ((s[0]&63)<<6) | (s[1]&63);
+   if(pos-3 >= 0) {
+   c = ((s[0]&63)<<6) | (s[1]&63);
+   } else {
+   c = '?';
+   }
s += 2;
pos -= 2;
} else {

http://cvs.php.net/viewvc.cgi/php-src/ext/xml/tests/bug43957.phpt?view=markup&rev=1.1
Index: php-src/ext/xml/tests/bug43957.phpt
+++ php-src/ext/xml/tests/bug43957.phpt

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