[PHP-CVS] cvs: php-src /ext/pcre php_pcre.c /ext/pcre/tests 006.phpt

2007-09-20 Thread Antony Dovgal
tony2001Thu Sep 20 08:10:20 2007 UTC

  Added files: 
/php-src/ext/pcre/tests 006.phpt 

  Modified files:  
/php-src/ext/pcre   php_pcre.c 
  Log:
  if one of regular expressions in the array fails, return NULL right away
  this fixes String is not zero-terminated error and makes the behaviour 
consistent with regexps passed as strings
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/php_pcre.c?r1=1.219r2=1.220diff_format=u
Index: php-src/ext/pcre/php_pcre.c
diff -u php-src/ext/pcre/php_pcre.c:1.219 php-src/ext/pcre/php_pcre.c:1.220
--- php-src/ext/pcre/php_pcre.c:1.219   Sat Sep  1 18:01:43 2007
+++ php-src/ext/pcre/php_pcre.c Thu Sep 20 08:10:20 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_pcre.c,v 1.219 2007/09/01 18:01:43 nlopess Exp $ */
+/* $Id: php_pcre.c,v 1.220 2007/09/20 08:10:20 tony2001 Exp $ */
 
 /*  TODO
  *  php_pcre_replace_impl():
@@ -1367,8 +1367,11 @@
efree(subject_value);
subject_value = result;
subject_len = *result_len;
+   } else {
+   efree(subject_value);
+   return NULL;
}
-   
+
zend_hash_move_forward(Z_ARRVAL_P(regex));
}
 

http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/006.phpt?view=markuprev=1.1
Index: php-src/ext/pcre/tests/006.phpt
+++ php-src/ext/pcre/tests/006.phpt
--TEST--
preg_replace() with array of failing regular expressions
--FILE--
?php

$text = '[CODE]lt;td align=quot;$stylevar[right]quot;gt;[/CODE]';
$result = preg_replace(array('#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU', 
'#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU'), '', $text);
var_dump($text);
var_dump($result);

$result = preg_replace('#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU', '', 
$text);
var_dump($text);
var_dump($result);

echo Done\n;
?
--EXPECTF-- 
string(58) [CODE]lt;td align=quot;$stylevar[right]quot;gt;[/CODE]
NULL
string(58) [CODE]lt;td align=quot;$stylevar[right]quot;gt;[/CODE]
NULL
Done
--UEXPECTF--
unicode(58) [CODE]lt;td align=quot;$stylevar[right]quot;gt;[/CODE]
NULL
unicode(58) [CODE]lt;td align=quot;$stylevar[right]quot;gt;[/CODE]
NULL
Done

-- 
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) /ext/pcre php_pcre.c /ext/pcre/tests 006.phpt

2007-09-20 Thread Antony Dovgal
tony2001Thu Sep 20 08:10:45 2007 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/pcre/tests 006.phpt 

  Modified files:  
/php-src/ext/pcre   php_pcre.c 
  Log:
  MFH
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/php_pcre.c?r1=1.168.2.9.2.20r2=1.168.2.9.2.21diff_format=u
Index: php-src/ext/pcre/php_pcre.c
diff -u php-src/ext/pcre/php_pcre.c:1.168.2.9.2.20 
php-src/ext/pcre/php_pcre.c:1.168.2.9.2.21
--- php-src/ext/pcre/php_pcre.c:1.168.2.9.2.20  Sat Sep  1 17:51:35 2007
+++ php-src/ext/pcre/php_pcre.c Thu Sep 20 08:10:44 2007
@@ -16,7 +16,7 @@
+--+
  */
 
-/* $Id: php_pcre.c,v 1.168.2.9.2.20 2007/09/01 17:51:35 nlopess Exp $ */
+/* $Id: php_pcre.c,v 1.168.2.9.2.21 2007/09/20 08:10:44 tony2001 Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -1220,8 +1220,11 @@
efree(subject_value);
subject_value = result;
subject_len = *result_len;
+   } else {
+   efree(subject_value);
+   return NULL;
}
-   
+
zend_hash_move_forward(Z_ARRVAL_P(regex));
}
 

http://cvs.php.net/viewvc.cgi/php-src/ext/pcre/tests/006.phpt?view=markuprev=1.1
Index: php-src/ext/pcre/tests/006.phpt
+++ php-src/ext/pcre/tests/006.phpt
--TEST--
preg_replace() with array of failing regular expressions
--FILE--
?php

$text = '[CODE]lt;td align=quot;$stylevar[right]quot;gt;[/CODE]';
$result = preg_replace(array('#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU', 
'#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU'), '', $text);
var_dump($text);
var_dump($result);

$result = preg_replace('#\[(right)\](((?R)|[^[]+?|\[)*)\[/\\1\]#siU', '', 
$text);
var_dump($text);
var_dump($result);

echo Done\n;
?
--EXPECTF-- 
string(58) [CODE]lt;td align=quot;$stylevar[right]quot;gt;[/CODE]
NULL
string(58) [CODE]lt;td align=quot;$stylevar[right]quot;gt;[/CODE]
NULL
Done
--UEXPECTF--
unicode(58) [CODE]lt;td align=quot;$stylevar[right]quot;gt;[/CODE]
NULL
unicode(58) [CODE]lt;td align=quot;$stylevar[right]quot;gt;[/CODE]
NULL
Done

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



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

2007-09-20 Thread Dmitry Stogov
It seems you've broken ext/standard/tests/file/bug41655_1.phpt

Thanks. Dmitry.

 -Original Message-
 From: Ilia Alshanetsky [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, September 20, 2007 2:40 AM
 To: php-cvs@lists.php.net
 Subject: [PHP-CVS] cvs: php-src /ext/standard dir.c 
 
 
 iliaa Wed Sep 19 22:40:02 2007 UTC
 
   Modified files:  
 /php-src/ext/standard dir.c 
   Log:
   
   MFB: Fixed regression in glob() when enforcing 
 safe_mode/open_basedir checks
   on paths containing '*' 
   
 http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dir.c?r1=1.
 169r2=1.170diff_format=u
 Index: php-src/ext/standard/dir.c
 diff -u php-src/ext/standard/dir.c:1.169 
 php-src/ext/standard/dir.c:1.170
 --- php-src/ext/standard/dir.c:1.169  Wed Sep  5 12:55:36 2007
 +++ php-src/ext/standard/dir.cWed Sep 19 22:40:02 2007
 @@ -16,7 +16,7 @@
 
 +-
 -+
   */
  
 -/* $Id: dir.c,v 1.169 2007/09/05 12:55:36 iliaa Exp $ */
 +/* $Id: dir.c,v 1.170 2007/09/19 22:40:02 iliaa Exp $ */
  
  /* {{{ includes/startup/misc */
  
 @@ -421,6 +421,7 @@
   glob_t globbuf;
   unsigned int n;
   int ret;
 + zend_bool basedir_limit = 0;
  
   if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, 
 Z|l, pppattern, flags) == FAILURE ||
   php_stream_path_param_encode(pppattern, 
 pattern, pattern_len, REPORT_ERRORS, FG(default_context)) 
 == FAILURE) { @@ -455,18 +456,6 @@
   } 
  #endif
  
 - if (PG(open_basedir)  *PG(open_basedir)) {
 - int pattern_len = strlen(pattern);
 - char *basename = estrndup(pattern, pattern_len);
 - 
 - php_dirname(basename, pattern_len);
 - if (php_check_open_basedir(basename TSRMLS_CC)) {
 - efree(basename);
 - RETURN_FALSE;
 - }
 - efree(basename);
 - }
 -
   memset(globbuf, 0, sizeof(glob_t));
   globbuf.gl_offs = 0;
   if (0 != (ret = glob(pattern, flags  GLOB_FLAGMASK, 
 NULL, globbuf))) { @@ -480,8 +469,7 @@
  can be used for simple glob() calls 
 without further error
  checking.
   */
 - array_init(return_value);
 - return;
 + goto no_results;
   }
  #endif
   RETURN_FALSE;
 @@ -489,12 +477,26 @@
  
   /* now catch the FreeBSD style of no matches */
   if (!globbuf.gl_pathc || !globbuf.gl_pathv) {
 +no_results:
 + if (PG(open_basedir)  *PG(open_basedir)) {
 + struct stat s;
 +
 + if (0 != VCWD_STAT(pattern, s) || 
 S_IFDIR != (s.st_mode  S_IFMT)) {
 + RETURN_FALSE;
 + }
 + }
   array_init(return_value);
   return;
   }
  
   array_init(return_value);
   for (n = 0; n  globbuf.gl_pathc; n++) {
 + if (PG(open_basedir)  *PG(open_basedir)) {
 + if 
 (php_check_open_basedir_ex(globbuf.gl_pathv[n], 0 TSRMLS_CC)) {
 + basedir_limit = 1;
 + continue;
 + }
 + }
   /* we need to do this everytime since 
 GLOB_ONLYDIR does not guarantee that
* all directories will be filtered. GNU libc 
 documentation states the
* following: 
 @@ -531,6 +533,11 @@
   }
  
   globfree(globbuf);
 +
 + if (basedir_limit  
 !zend_hash_num_elements(Z_ARRVAL_P(return_value))) {
 + zval_dtor(return_value);
 + RETURN_FALSE;
 + }
  }
  /* }}} */
  #endif 
 
 -- 
 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/standard dir.c

2007-09-20 Thread Pierre
On 9/20/07, Dmitry Stogov [EMAIL PROTECTED] wrote:
 It seems you've broken ext/standard/tests/file/bug41655_1.phpt


The test has to be updated. The last fix seems to be the only way to
actually fix what was reported in #41655 (one can test if a file
exists outside open_basedir using glob) and to do not break old
applications: having glob returning false (error). We can introduce
again the warning but it may defeat again the main purpose of this
fix.

Cheers,
--Pierre

-- 
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/standard array.c

2007-09-20 Thread Dmitry Stogov
dmitry  Thu Sep 20 09:23:00 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-srcNEWS 
/php-src/ext/standard   array.c 
  Log:
  Improved speed of array_intersect_key(), array_intersect_assoc() and 
array_uintersect_assoc(). (100 times faster on arrays with 10 elements)
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.957r2=1.2027.2.547.2.958diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.957 php-src/NEWS:1.2027.2.547.2.958
--- php-src/NEWS:1.2027.2.547.2.957 Wed Sep 19 22:37:58 2007
+++ php-src/NEWSThu Sep 20 09:22:59 2007
@@ -5,6 +5,9 @@
 - Added optional parameter $provide_object to debug_backtrace(). (Sebastian)
 - Added alpha support for imagefilter() IMG_FILTER_COLORIZE. (Pierre)
 
+- Improved speed of array_intersect_key(), array_intersect_assoc() and
+  array_uintersect_assoc(). (Dmitry)
+
 - Fixed regression in glob() when enforcing safe_mode/open_basedir checks on
   paths containing '*'. (Ilia)
 - Fixed mail.force_extra_parameters php.ini directive not to be modifiable
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.308.2.21.2.32r2=1.308.2.21.2.33diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.308.2.21.2.32 
php-src/ext/standard/array.c:1.308.2.21.2.33
--- php-src/ext/standard/array.c:1.308.2.21.2.32Fri Aug 10 12:17:26 2007
+++ php-src/ext/standard/array.cThu Sep 20 09:22:59 2007
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.308.2.21.2.32 2007/08/10 12:17:26 jani Exp $ */
+/* $Id: array.c,v 1.308.2.21.2.33 2007/09/20 09:22:59 dmitry Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -86,6 +86,7 @@
 #define INTERSECT_NORMAL   1
 #define INTERSECT_KEY  2
 #define INTERSECT_ASSOC6
+#define INTERSECT_COMP_DATA_NONE-1
 #define INTERSECT_COMP_DATA_INTERNAL 0
 #define INTERSECT_COMP_DATA_USER 1
 #define INTERSECT_COMP_KEY_INTERNAL  0
@@ -2869,6 +2870,149 @@
 }
 /* }}} */
 
+static int zval_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */
+{
+   zval result;
+   zval *first;
+   zval *second;
+ 
+   first = *((zval **) a);
+   second = *((zval **) b);
+
+   if (string_compare_function(result, first, second TSRMLS_CC) == 
FAILURE) {
+   return 0;
+   } 
+
+   if (Z_TYPE(result) == IS_DOUBLE) {
+   if (Z_DVAL(result)  0) {
+   return -1;
+   } else if (Z_DVAL(result)  0) {
+   return 1;
+   } else {
+   return 0;
+   }
+   }
+
+   convert_to_long(result);
+
+   if (Z_LVAL(result)  0) {
+   return -1;
+   } else if (Z_LVAL(result)  0) {
+   return 1;
+   } 
+
+   return 0;
+}
+/* }}} */
+
+static int zval_user_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */
+{
+   zval **args[2];
+   zval *retval_ptr;
+   zend_fcall_info fci;
+
+   args[0] = (zval **) a;
+   args[1] = (zval **) b;
+
+   fci.size = sizeof(fci);
+   fci.function_table = EG(function_table);
+   fci.function_name = *BG(user_compare_func_name);
+   fci.symbol_table = NULL;
+   fci.object_pp = NULL;
+   fci.retval_ptr_ptr = retval_ptr;
+   fci.param_count = 2;
+   fci.params = args;
+   fci.no_separation = 0;
+
+   if (zend_call_function(fci, BG(user_compare_fci_cache) TSRMLS_CC)== 
SUCCESS
+retval_ptr) {
+   long retval;
+
+   convert_to_long_ex(retval_ptr);
+   retval = Z_LVAL_P(retval_ptr);
+   zval_ptr_dtor(retval_ptr);
+   return retval  0 ? -1 : retval  0 ? 1 : 0;;
+   } else {
+   return 0;
+   }
+}
+/* }}} */
+
+static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int 
data_compare_type) /* {{{ */
+{
+   Bucket *p;
+   int argc, i;
+   zval ***args;
+   int (*intersect_data_compare_func)(zval **, zval ** TSRMLS_DC) = NULL;
+   zend_bool ok;
+   zval **data;
+
+   /* Get the argument count */
+   argc = ZEND_NUM_ARGS();
+   /* Allocate arguments array and get the arguments, checking for errors. 
*/
+   args = (zval ***)safe_emalloc(argc, sizeof(zval **), 0);
+   if (argc  2 || zend_get_parameters_array_ex(argc, args) == FAILURE) {
+   efree(args);
+   WRONG_PARAM_COUNT;
+   }
+   if (data_compare_type == INTERSECT_COMP_DATA_USER) {
+   char *callback_name;
+
+   if (argc  3) {
+   efree(args);
+   WRONG_PARAM_COUNT;
+   }
+   argc--;
+   if (!zend_is_callable(*args[argc], 0, callback_name)) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, Not a 
valid callback %s, callback_name);
+   

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

2007-09-20 Thread Dmitry Stogov
dmitry  Thu Sep 20 09:23:11 2007 UTC

  Modified files:  
/php-src/ext/standard   array.c 
  Log:
  Improved speed of array_intersect_key(), array_intersect_assoc() and 
array_uintersect_assoc(). (100 times faster on arrays with 10 elements)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/array.c?r1=1.416r2=1.417diff_format=u
Index: php-src/ext/standard/array.c
diff -u php-src/ext/standard/array.c:1.416 php-src/ext/standard/array.c:1.417
--- php-src/ext/standard/array.c:1.416  Fri Aug 10 13:20:22 2007
+++ php-src/ext/standard/array.cThu Sep 20 09:23:11 2007
@@ -21,7 +21,7 @@
+--+
 */
 
-/* $Id: array.c,v 1.416 2007/08/10 13:20:22 tony2001 Exp $ */
+/* $Id: array.c,v 1.417 2007/09/20 09:23:11 dmitry Exp $ */
 
 #include php.h
 #include php_ini.h
@@ -81,6 +81,7 @@
 #define INTERSECT_NORMAL   1
 #define INTERSECT_KEY  2
 #define INTERSECT_ASSOC6
+#define INTERSECT_COMP_DATA_NONE-1
 #define INTERSECT_COMP_DATA_INTERNAL 0
 #define INTERSECT_COMP_DATA_USER 1
 #define INTERSECT_COMP_KEY_INTERNAL  0
@@ -2919,6 +2920,132 @@
 }
 /* }}} */
 
+static int zval_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */
+{
+   zval result;
+   zval *first;
+   zval *second;
+ 
+   first = *((zval **) a);
+   second = *((zval **) b);
+
+   if (string_compare_function(result, first, second TSRMLS_CC) == 
FAILURE) {
+   return 0;
+   } 
+
+   if (Z_TYPE(result) == IS_DOUBLE) {
+   if (Z_DVAL(result)  0) {
+   return -1;
+   } else if (Z_DVAL(result)  0) {
+   return 1;
+   } else {
+   return 0;
+   }
+   }
+
+   convert_to_long(result);
+
+   if (Z_LVAL(result)  0) {
+   return -1;
+   } else if (Z_LVAL(result)  0) {
+   return 1;
+   } 
+
+   return 0;
+}
+/* }}} */
+
+static int zval_user_compare(zval **a, zval **b TSRMLS_DC) /* {{{ */
+{
+   zval **args[2];
+   zval *retval_ptr;
+
+   args[0] = (zval **) a;
+   args[1] = (zval **) b;
+
+   BG(user_compare_fci).param_count = 2;
+   BG(user_compare_fci).params = args;
+   BG(user_compare_fci).retval_ptr_ptr = retval_ptr;
+   BG(user_compare_fci).no_separation = 0;
+   if (zend_call_function(BG(user_compare_fci), 
BG(user_compare_fci_cache) TSRMLS_CC)== SUCCESS
+retval_ptr) {
+   long retval;
+
+   convert_to_long_ex(retval_ptr);
+   retval = Z_LVAL_P(retval_ptr);
+   zval_ptr_dtor(retval_ptr);
+   return retval  0 ? -1 : retval  0 ? 1 : 0;;
+   } else {
+   return 0;
+   }
+}
+/* }}} */
+
+static void php_array_intersect_key(INTERNAL_FUNCTION_PARAMETERS, int 
data_compare_type) /* {{{ */
+{
+   Bucket *p;
+   int argc, i;
+   zval ***args;
+   int (*intersect_data_compare_func)(zval **, zval ** TSRMLS_DC) = NULL;
+   zend_bool ok;
+   zval **data;
+
+   /* Get the argument count */
+   argc = ZEND_NUM_ARGS();
+   if (data_compare_type == INTERSECT_COMP_DATA_USER) {
+   if (argc  3 ||
+   zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, +f, 
args,
+argc, BG(user_compare_fci), BG(user_compare_fci_cache)) 
== FAILURE) {
+   return;
+   }
+   intersect_data_compare_func = zval_user_compare;
+   } else {
+   if (argc  2 ||
+   zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, +, 
args, argc) == FAILURE) {
+   return;
+   }
+   if (data_compare_type == INTERSECT_COMP_DATA_INTERNAL) {
+   intersect_data_compare_func = zval_compare;
+   }
+   }
+
+   array_init(return_value);
+
+   for (p = Z_ARRVAL_PP(args[0])-pListHead; p != NULL; p = p-pListNext) {
+   if (p-nKeyLength == 0) {
+   ok = 1;
+   for (i = 1; i  argc; i++) {
+   if (zend_hash_index_find(Z_ARRVAL_PP(args[i]), 
p-h, (void**)data) == FAILURE ||
+   (intersect_data_compare_func 
+
intersect_data_compare_func((zval**)p-pData, data TSRMLS_CC) != 0)) {
+   ok = 0;
+   break;
+   }
+   }
+   if (ok) {
+   (*((zval**)p-pData))-refcount++;
+   
zend_hash_index_update(Z_ARRVAL_P(return_value), p-h, p-pData, sizeof(zval*), 
NULL);
+   }
+   } else {
+   ok = 1;
+   for (i = 1; i  

[PHP-CVS] cvs: php-src /ext/xmlreader php_xmlreader.c /ext/xmlreader/tests bug42139.phpt

2007-09-20 Thread Rob Richards
rrichards   Thu Sep 20 09:30:17 2007 UTC

  Added files: 
/php-src/ext/xmlreader/testsbug42139.phpt 

  Modified files:  
/php-src/ext/xmlreader  php_xmlreader.c 
  Log:
  fix bug #42139 (XMLReader option constants are broken using XML())
  add test
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xmlreader/php_xmlreader.c?r1=1.47r2=1.48diff_format=u
Index: php-src/ext/xmlreader/php_xmlreader.c
diff -u php-src/ext/xmlreader/php_xmlreader.c:1.47 
php-src/ext/xmlreader/php_xmlreader.c:1.48
--- php-src/ext/xmlreader/php_xmlreader.c:1.47  Thu Jul 26 13:19:22 2007
+++ php-src/ext/xmlreader/php_xmlreader.c   Thu Sep 20 09:30:16 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: php_xmlreader.c,v 1.47 2007/07/26 13:19:22 bjori Exp $ */
+/* $Id: php_xmlreader.c,v 1.48 2007/09/20 09:30:16 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1096,7 +1096,7 @@
xmlreader_object *intern = NULL;
zstr source;
char *uri = NULL, *encoding = NULL;
-   int resolved_path_len;
+   int resolved_path_len, ret = 0;
char *directory=NULL, resolved_path[MAXPATHLEN];
xmlParserInputBufferPtr inputbfr;
xmlTextReaderPtr reader = NULL;
@@ -1150,15 +1150,20 @@
xmlFree(uri);
}
if (reader != NULL) {
-   if (id == NULL) {
-   object_init_ex(return_value, 
xmlreader_class_entry);
-   intern = (xmlreader_object 
*)zend_objects_get_address(return_value TSRMLS_CC);
-   } else {
-   RETVAL_TRUE;
+#if LIBXML_VERSION = 20628
+   ret = xmlTextReaderSetup(reader, NULL, uri, encoding, 
options);
+#endif
+   if (ret == 0) {
+   if (id == NULL) {
+   object_init_ex(return_value, 
xmlreader_class_entry);
+   intern = (xmlreader_object 
*)zend_objects_get_address(return_value TSRMLS_CC);
+   } else {
+   RETVAL_TRUE;
+   }
+   intern-input = inputbfr;
+   intern-ptr = reader;
+   return;
}
-   intern-input = inputbfr;
-   intern-ptr = reader;
-   return;
}
}
 

http://cvs.php.net/viewvc.cgi/php-src/ext/xmlreader/tests/bug42139.phpt?view=markuprev=1.1
Index: php-src/ext/xmlreader/tests/bug42139.phpt
+++ php-src/ext/xmlreader/tests/bug42139.phpt
--TEST--
Bug #42139 (XMLReader option constants are broken using XML())
--SKIPIF--
?php if (!extension_loaded(xmlreader)) print skip;
if (LIBXML_VERSION  20628) die(skip: libxml2 2.6.28+ required);
?
--FILE--
?php

$xml = XML
?xml version=1.0 encoding=utf-8?
!DOCTYPE root [
!ELEMENT root ANY
!ENTITY x y
]
rootx;/root
XML;

$reader = new XMLReader;
$reader-XML( $xml, NULL, LIBXML_NOENT);
while ( $reader-read() ) {
  echo {$reader-nodeType}, {$reader-name}, {$reader-value}\n;
}
$reader-close();

?
--EXPECT--  
10, root, 
1, root, 
3, #text, y
15, root, 

-- 
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) /ext/xmlreader php_xmlreader.c /ext/xmlreader/tests bug42139.phpt

2007-09-20 Thread Rob Richards
rrichards   Thu Sep 20 09:30:45 2007 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/xmlreader/testsbug42139.phpt 

  Modified files:  
/php-src/ext/xmlreader  php_xmlreader.c 
  Log:
  MFH: fix bug #42139 (XMLReader option constants are broken using XML())
  add test
  
http://cvs.php.net/viewvc.cgi/php-src/ext/xmlreader/php_xmlreader.c?r1=1.13.2.14.2.8r2=1.13.2.14.2.9diff_format=u
Index: php-src/ext/xmlreader/php_xmlreader.c
diff -u php-src/ext/xmlreader/php_xmlreader.c:1.13.2.14.2.8 
php-src/ext/xmlreader/php_xmlreader.c:1.13.2.14.2.9
--- php-src/ext/xmlreader/php_xmlreader.c:1.13.2.14.2.8 Thu Jul 26 13:20:21 2007
+++ php-src/ext/xmlreader/php_xmlreader.c   Thu Sep 20 09:30:45 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: php_xmlreader.c,v 1.13.2.14.2.8 2007/07/26 13:20:21 bjori Exp $ */
+/* $Id: php_xmlreader.c,v 1.13.2.14.2.9 2007/09/20 09:30:45 rrichards Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -1060,7 +1060,7 @@
long options = 0;
xmlreader_object *intern = NULL;
char *source, *uri = NULL, *encoding = NULL;
-   int resolved_path_len;
+   int resolved_path_len, ret = 0;
char *directory=NULL, resolved_path[MAXPATHLEN];
xmlParserInputBufferPtr inputbfr;
xmlTextReaderPtr reader;
@@ -1105,15 +1105,20 @@
xmlFree(uri);
}
if (reader != NULL) {
-   if (id == NULL) {
-   object_init_ex(return_value, 
xmlreader_class_entry);
-   intern = (xmlreader_object 
*)zend_objects_get_address(return_value TSRMLS_CC);
-   } else {
-   RETVAL_TRUE;
+#if LIBXML_VERSION = 20628
+   ret = xmlTextReaderSetup(reader, NULL, uri, encoding, 
options);
+#endif
+   if (ret == 0) {
+   if (id == NULL) {
+   object_init_ex(return_value, 
xmlreader_class_entry);
+   intern = (xmlreader_object 
*)zend_objects_get_address(return_value TSRMLS_CC);
+   } else {
+   RETVAL_TRUE;
+   }
+   intern-input = inputbfr;
+   intern-ptr = reader;
+   return;
}
-   intern-input = inputbfr;
-   intern-ptr = reader;
-   return;
}
}
 

http://cvs.php.net/viewvc.cgi/php-src/ext/xmlreader/tests/bug42139.phpt?view=markuprev=1.1
Index: php-src/ext/xmlreader/tests/bug42139.phpt
+++ php-src/ext/xmlreader/tests/bug42139.phpt
--TEST--
Bug #42139 (XMLReader option constants are broken using XML())
--SKIPIF--
?php if (!extension_loaded(xmlreader)) print skip;
if (LIBXML_VERSION  20628) die(skip: libxml2 2.6.28+ required);
?
--FILE--
?php

$xml = XML
?xml version=1.0 encoding=utf-8?
!DOCTYPE root [
!ELEMENT root ANY
!ENTITY x y
]
rootx;/root
XML;

$reader = new XMLReader;
$reader-XML( $xml, NULL, LIBXML_NOENT);
while ( $reader-read() ) {
  echo {$reader-nodeType}, {$reader-name}, {$reader-value}\n;
}
$reader-close();

?
--EXPECT--  
10, root, 
1, root, 
3, #text, y
15, root, 

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

2007-09-20 Thread Rob Richards
rrichards   Thu Sep 20 09:32:31 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-srcNEWS 
  Log:
  BFN
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.958r2=1.2027.2.547.2.959diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.958 php-src/NEWS:1.2027.2.547.2.959
--- php-src/NEWS:1.2027.2.547.2.958 Thu Sep 20 09:22:59 2007
+++ php-src/NEWSThu Sep 20 09:32:31 2007
@@ -61,6 +61,7 @@
 - Fixed bug #42214 (SoapServer sends clients internal PHP errors). (Dmitry)
 - Fixed bug #42189 (xmlrpc_set_type() crashes php on invalid datetime
   values). (Ilia)
+- Fixed bug #42139 (XMLReader option constants are broken using XML()). (Rob)
 - Fixed bug #42086 (SoapServer return Procedure '' not present for WSIBasic
   compliant wsdl). (Dmitry)
 - Fixed bug #41561 (Values set with php_admin_* in httpd.conf can be 
overwritten

-- 
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) /ext/standard/tests/file bug41655_1.phpt

2007-09-20 Thread Ilia Alshanetsky
iliaa   Thu Sep 20 13:29:04 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard/tests/filebug41655_1.phpt 
  Log:
  
  Fixed test for glob() affected by previous patch
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug41655_1.phpt?r1=1.1.4.5r2=1.1.4.6diff_format=u
Index: php-src/ext/standard/tests/file/bug41655_1.phpt
diff -u php-src/ext/standard/tests/file/bug41655_1.phpt:1.1.4.5 
php-src/ext/standard/tests/file/bug41655_1.phpt:1.1.4.6
--- php-src/ext/standard/tests/file/bug41655_1.phpt:1.1.4.5 Mon Jun 25 
21:24:44 2007
+++ php-src/ext/standard/tests/file/bug41655_1.phpt Thu Sep 20 13:29:04 2007
@@ -5,6 +5,8 @@
 --FILE--
 ?php
$a=glob(./*.jpeg);
+
+echo Done\n;
 ?
---EXPECTF--
-Warning: glob(): open_basedir restriction in effect. File%s.) is not within 
the allowed path(s): (/tmp) in %s on line %d
+--EXPECT--
+Done
\ 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] cvs: php-src /ext/standard/tests/file bug41655_1.phpt

2007-09-20 Thread Ilia Alshanetsky
iliaa   Thu Sep 20 13:29:22 2007 UTC

  Modified files:  
/php-src/ext/standard/tests/filebug41655_1.phpt 
  Log:
  
  MFB: Fixed test for glob() affected by previous patch
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug41655_1.phpt?r1=1.5r2=1.6diff_format=u
Index: php-src/ext/standard/tests/file/bug41655_1.phpt
diff -u php-src/ext/standard/tests/file/bug41655_1.phpt:1.5 
php-src/ext/standard/tests/file/bug41655_1.phpt:1.6
--- php-src/ext/standard/tests/file/bug41655_1.phpt:1.5 Mon Jun 25 21:24:37 2007
+++ php-src/ext/standard/tests/file/bug41655_1.phpt Thu Sep 20 13:29:22 2007
@@ -5,6 +5,8 @@
 --FILE--
 ?php
$a=glob(./*.jpeg);
+
+echo Done\n;
 ?
---EXPECTF--
-Warning: glob(): open_basedir restriction in effect. File%s.) is not within 
the allowed path(s): (/tmp) in %s on line %d
+--EXPECT--
+Done
\ 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] cvs: php-src /ext/standard/tests/file bug41655_1.phpt bug41655_2.phpt

2007-09-20 Thread Jani Taskinen
janiThu Sep 20 13:39:04 2007 UTC

  Modified files:  
/php-src/ext/standard/tests/filebug41655_1.phpt bug41655_2.phpt 
  Log:
  - Fix test descriptions to be in sync
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug41655_1.phpt?r1=1.6r2=1.7diff_format=u
Index: php-src/ext/standard/tests/file/bug41655_1.phpt
diff -u php-src/ext/standard/tests/file/bug41655_1.phpt:1.6 
php-src/ext/standard/tests/file/bug41655_1.phpt:1.7
--- php-src/ext/standard/tests/file/bug41655_1.phpt:1.6 Thu Sep 20 13:29:22 2007
+++ php-src/ext/standard/tests/file/bug41655_1.phpt Thu Sep 20 13:39:04 2007
@@ -1,5 +1,5 @@
 --TEST--
-Bug #41655 (open_basedir bypass via glob())
+Bug #41655 (open_basedir bypass via glob()) 1/2
 --INI--
 open_basedir=/tmp
 --FILE--
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug41655_2.phpt?r1=1.3r2=1.4diff_format=u
Index: php-src/ext/standard/tests/file/bug41655_2.phpt
diff -u php-src/ext/standard/tests/file/bug41655_2.phpt:1.3 
php-src/ext/standard/tests/file/bug41655_2.phpt:1.4
--- php-src/ext/standard/tests/file/bug41655_2.phpt:1.3 Thu Sep 13 18:56:21 2007
+++ php-src/ext/standard/tests/file/bug41655_2.phpt Thu Sep 20 13:39:04 2007
@@ -1,5 +1,5 @@
 --TEST--
-Bug #41655: open_basedir bypass via glob()
+Bug #41655 (open_basedir bypass via glob()) 2/2
 --INI--
 open_basedir=/
 --FILE--

-- 
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) /ext/standard/tests/file bug41655_1.phpt bug41655_2.phpt

2007-09-20 Thread Jani Taskinen
janiThu Sep 20 13:49:34 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/standard/tests/filebug41655_1.phpt bug41655_2.phpt 
  Log:
  MFH
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug41655_1.phpt?r1=1.1.4.6r2=1.1.4.7diff_format=u
Index: php-src/ext/standard/tests/file/bug41655_1.phpt
diff -u php-src/ext/standard/tests/file/bug41655_1.phpt:1.1.4.6 
php-src/ext/standard/tests/file/bug41655_1.phpt:1.1.4.7
--- php-src/ext/standard/tests/file/bug41655_1.phpt:1.1.4.6 Thu Sep 20 
13:29:04 2007
+++ php-src/ext/standard/tests/file/bug41655_1.phpt Thu Sep 20 13:49:33 2007
@@ -1,5 +1,5 @@
 --TEST--
-Bug #41655 (open_basedir bypass via glob())
+Bug #41655 (open_basedir bypass via glob()) 1/2
 --INI--
 open_basedir=/tmp
 --FILE--
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug41655_2.phpt?r1=1.1.4.3r2=1.1.4.4diff_format=u
Index: php-src/ext/standard/tests/file/bug41655_2.phpt
diff -u php-src/ext/standard/tests/file/bug41655_2.phpt:1.1.4.3 
php-src/ext/standard/tests/file/bug41655_2.phpt:1.1.4.4
--- php-src/ext/standard/tests/file/bug41655_2.phpt:1.1.4.3 Thu Sep 13 
18:55:28 2007
+++ php-src/ext/standard/tests/file/bug41655_2.phpt Thu Sep 20 13:49:33 2007
@@ -1,5 +1,5 @@
 --TEST--
-Bug #41655: open_basedir bypass via glob()
+Bug #41655 (open_basedir bypass via glob()) 2/2
 --INI--
 open_basedir=/
 --FILE--

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



[PHP-CVS] cvs: php-src /ext/spl/tests bug42259.phpt

2007-09-20 Thread Jani Taskinen
janiThu Sep 20 14:27:58 2007 UTC

  Modified files:  
/php-src/ext/spl/tests  bug42259.phpt 
  Log:
  - Fixed skipif block
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug42259.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/spl/tests/bug42259.phpt
diff -u php-src/ext/spl/tests/bug42259.phpt:1.1 
php-src/ext/spl/tests/bug42259.phpt:1.2
--- php-src/ext/spl/tests/bug42259.phpt:1.1 Tue Aug 14 12:09:52 2007
+++ php-src/ext/spl/tests/bug42259.phpt Thu Sep 20 14:27:58 2007
@@ -1,10 +1,12 @@
 --TEST--
 Bug #42259 (SimpleXMLIterator loses ancestry)
 --SKIPIF--
+?php
 if (!extension_loaded(spl)) print skip;
 if (!extension_loaded('simplexml')) print 'skip';
 if (!extension_loaded(libxml)) print skip LibXML not present;
 if (!class_exists('RecursiveIteratorIterator')) print 'skip 
RecursiveIteratorIterator not available';
+?
 --FILE--
 ?php
 $xml =EOF

-- 
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) /ext/spl/tests bug42259.phpt

2007-09-20 Thread Jani Taskinen
janiThu Sep 20 14:28:12 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/spl/tests  bug42259.phpt 
  Log:
  MFH
  
http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug42259.phpt?r1=1.1.2.2r2=1.1.2.3diff_format=u
Index: php-src/ext/spl/tests/bug42259.phpt
diff -u php-src/ext/spl/tests/bug42259.phpt:1.1.2.2 
php-src/ext/spl/tests/bug42259.phpt:1.1.2.3
--- php-src/ext/spl/tests/bug42259.phpt:1.1.2.2 Tue Aug 14 12:10:46 2007
+++ php-src/ext/spl/tests/bug42259.phpt Thu Sep 20 14:28:12 2007
@@ -1,10 +1,12 @@
 --TEST--
 Bug #42259 (SimpleXMLIterator loses ancestry)
 --SKIPIF--
+?php
 if (!extension_loaded(spl)) print skip;
 if (!extension_loaded('simplexml')) print 'skip';
 if (!extension_loaded(libxml)) print skip LibXML not present;
 if (!class_exists('RecursiveIteratorIterator')) print 'skip 
RecursiveIteratorIterator not available';
+?
 --FILE--
 ?php
 $xml =EOF

-- 
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) /ext/standard/tests/general_functions dl-cve-2007-4887.phpt

2007-09-20 Thread Stanislav Malyshev
stasThu Sep 20 18:44:24 2007 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/standard/tests/general_functions   dl-cve-2007-4887.phpt 
  Log:
  add test for dl() with long name
  
  

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt?view=markuprev=1.1
Index: php-src/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt
+++ php-src/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt

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



[PHP-CVS] cvs: php-src /ext/standard/tests/general_functions dl-cve-2007-4887.phpt

2007-09-20 Thread Stanislav Malyshev
stasThu Sep 20 18:45:03 2007 UTC

  Modified files:  
/php-src/ext/standard/tests/general_functions   dl-cve-2007-4887.phpt 
  Log:
  add test for dl() with long name
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt
diff -u /dev/null 
php-src/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt:1.2
--- /dev/null   Thu Sep 20 18:45:03 2007
+++ php-src/ext/standard/tests/general_functions/dl-cve-2007-4887.phpt  Thu Sep 
20 18:45:03 2007
@@ -0,0 +1,10 @@
+--TEST--
+dl() filename length checks (CVE-2007-4887)
+--FILE--
+?php
+var_dump(dl(str_repeat(a, 8376757)));
+?
+--EXPECTF--
+
+Warning: dl(): File name exceeds the maximum allowed length of %d characters 
in %s on line %d
+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_2) /ext/iconv iconv.c

2007-09-20 Thread Stanislav Malyshev
stasThu Sep 20 21:55:15 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/iconv  iconv.c 
  Log:
  fix potential overflow (Mattias Bengtsson)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/iconv.c?r1=1.124.2.8.2.17r2=1.124.2.8.2.18diff_format=u
Index: php-src/ext/iconv/iconv.c
diff -u php-src/ext/iconv/iconv.c:1.124.2.8.2.17 
php-src/ext/iconv/iconv.c:1.124.2.8.2.18
--- php-src/ext/iconv/iconv.c:1.124.2.8.2.17Wed Sep 19 00:30:52 2007
+++ php-src/ext/iconv/iconv.c   Thu Sep 20 21:55:14 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: iconv.c,v 1.124.2.8.2.17 2007/09/19 00:30:52 stas Exp $ */
+/* $Id: iconv.c,v 1.124.2.8.2.18 2007/09/20 21:55:14 stas Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -700,11 +700,11 @@
}
}
 
-   if (offset = total_len) {
+   if (offset = total_len || len  total_len) {
return PHP_ICONV_ERR_SUCCESS;
}
 
-   if ((offset + len)  total_len) {
+   if ((offset + len)  total_len ) {
/* trying to compute the length */
len = total_len - offset;
}

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



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

2007-09-20 Thread Stanislav Malyshev
stasThu Sep 20 21:57:11 2007 UTC

  Modified files:  
/php-src/ext/iconv  iconv.c 
  Log:
  MFB length check fix (Mattias Bengtsson)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/iconv.c?r1=1.154r2=1.155diff_format=u
Index: php-src/ext/iconv/iconv.c
diff -u php-src/ext/iconv/iconv.c:1.154 php-src/ext/iconv/iconv.c:1.155
--- php-src/ext/iconv/iconv.c:1.154 Wed Sep 19 00:37:43 2007
+++ php-src/ext/iconv/iconv.c   Thu Sep 20 21:57:11 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: iconv.c,v 1.154 2007/09/19 00:37:43 stas Exp $ */
+/* $Id: iconv.c,v 1.155 2007/09/20 21:57:11 stas Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -765,7 +765,7 @@
}
}
 
-   if (offset = total_len) {
+   if (offset = total_len || len  total_len) {
return PHP_ICONV_ERR_SUCCESS;
}


-- 
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) /ext/tidy tidy.c /ext/tidy/tests 029.phpt

2007-09-20 Thread Nuno Lopes
nlopess Thu Sep 20 22:25:06 2007 UTC

  Added files: (Branch: PHP_5_2)
/php-src/ext/tidy/tests 029.phpt 

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  fix crash when fetching a node type that doesnt exist
  # reported in a manual user note
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.66.2.8.2.23r2=1.66.2.8.2.24diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.66.2.8.2.23 
php-src/ext/tidy/tidy.c:1.66.2.8.2.24
--- php-src/ext/tidy/tidy.c:1.66.2.8.2.23   Fri May  4 17:11:05 2007
+++ php-src/ext/tidy/tidy.c Thu Sep 20 22:25:05 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.66.2.8.2.23 2007/05/04 17:11:05 nlopess Exp $ */
+/* $Id: tidy.c,v 1.66.2.8.2.24 2007/09/20 22:25:05 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -870,35 +870,41 @@
return NULL;
 }
 
-static void php_tidy_create_node(INTERNAL_FUNCTION_PARAMETERS, 
tidy_base_nodetypes node)
+static void php_tidy_create_node(INTERNAL_FUNCTION_PARAMETERS, 
tidy_base_nodetypes node_type)
 {
PHPTidyObj *newobj;
+   TidyNode node;
TIDY_FETCH_OBJECT;
 
-   tidy_instanciate(tidy_ce_node, return_value TSRMLS_CC);
-   newobj = (PHPTidyObj *) zend_object_store_get_object(return_value 
TSRMLS_CC);
-   newobj-type = is_node;
-   newobj-ptdoc = obj-ptdoc;
-   newobj-ptdoc-ref_count++;
-
-   switch(node) {
+   switch (node_type) {
case is_root_node:
-   newobj-node = tidyGetRoot(newobj-ptdoc-doc);
+   node = tidyGetRoot(obj-ptdoc-doc);
break;
 
case is_html_node:
-   newobj-node = tidyGetHtml(newobj-ptdoc-doc);
+   node = tidyGetHtml(obj-ptdoc-doc);
break;
 
case is_head_node:
-   newobj-node = tidyGetHead(newobj-ptdoc-doc);
+   node = tidyGetHead(obj-ptdoc-doc);
break;
 
case is_body_node:
-   newobj-node = tidyGetBody(newobj-ptdoc-doc);
+   node = tidyGetBody(obj-ptdoc-doc);
break;
}
 
+   if (!node) {
+   RETURN_NULL();
+   }
+
+   tidy_instanciate(tidy_ce_node, return_value TSRMLS_CC);
+   newobj = (PHPTidyObj *) zend_object_store_get_object(return_value 
TSRMLS_CC);
+   newobj-type  = is_node;
+   newobj-ptdoc = obj-ptdoc;
+   newobj-node  = node;
+   newobj-ptdoc-ref_count++;
+
tidy_add_default_properties(newobj, is_node TSRMLS_CC);
 }
 
@@ -992,7 +998,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.66.2.8.2.23 2007/05/04 17:11:05 
nlopess Exp $));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.66.2.8.2.24 2007/09/20 22:25:05 
nlopess Exp $));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/029.phpt?view=markuprev=1.1
Index: php-src/ext/tidy/tests/029.phpt
+++ php-src/ext/tidy/tests/029.phpt

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



[PHP-CVS] cvs: php-src /ext/tidy tidy.c /ext/tidy/tests 029.phpt

2007-09-20 Thread Nuno Lopes
nlopess Thu Sep 20 22:30:49 2007 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
/php-src/ext/tidy/tests 029.phpt 
  Log:
  MFB: fix crash in tidy_get_body() and related functions when the node doesnt 
exist
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.113r2=1.114diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.113 php-src/ext/tidy/tidy.c:1.114
--- php-src/ext/tidy/tidy.c:1.113   Fri May  4 17:45:56 2007
+++ php-src/ext/tidy/tidy.c Thu Sep 20 22:30:48 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.113 2007/05/04 17:45:56 nlopess Exp $ */
+/* $Id: tidy.c,v 1.114 2007/09/20 22:30:48 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -902,37 +902,42 @@
return NULL;
 }
 
-static void php_tidy_create_node(INTERNAL_FUNCTION_PARAMETERS, 
tidy_base_nodetypes node)
+static void php_tidy_create_node(INTERNAL_FUNCTION_PARAMETERS, 
tidy_base_nodetypes node_type)
 {
PHPTidyObj *newobj;
+   TidyNode node;
TIDY_FETCH_OBJECT;
 
-   tidy_instanciate(tidy_ce_node, return_value TSRMLS_CC);
-   newobj = (PHPTidyObj *) zend_object_store_get_object(return_value 
TSRMLS_CC);
-   newobj-type = is_node;
-   newobj-ptdoc = obj-ptdoc;
-   newobj-ptdoc-ref_count++;
-   newobj-converter = obj-converter;
-   if (obj-converter) obj-converter-ref_count++;
-
-   switch(node) {
+   switch (node_type) {
case is_root_node:
-   newobj-node = tidyGetRoot(newobj-ptdoc-doc);
+   node = tidyGetRoot(obj-ptdoc-doc);
break;
 
case is_html_node:
-   newobj-node = tidyGetHtml(newobj-ptdoc-doc);
+   node = tidyGetHtml(obj-ptdoc-doc);
break;
 
case is_head_node:
-   newobj-node = tidyGetHead(newobj-ptdoc-doc);
+   node = tidyGetHead(obj-ptdoc-doc);
break;
 
case is_body_node:
-   newobj-node = tidyGetBody(newobj-ptdoc-doc);
+   node = tidyGetBody(obj-ptdoc-doc);
break;
}
 
+   if (!node) {
+   RETURN_NULL();
+   }
+
+   tidy_instanciate(tidy_ce_node, return_value TSRMLS_CC);
+   newobj = (PHPTidyObj *) zend_object_store_get_object(return_value 
TSRMLS_CC);
+   newobj-type = is_node;
+   newobj-ptdoc = obj-ptdoc;
+   newobj-ptdoc-ref_count++;
+   newobj-converter = obj-converter;
+   if (obj-converter) obj-converter-ref_count++;
+
tidy_add_default_properties(newobj, is_node TSRMLS_CC);
 }
 
@@ -1056,7 +1061,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.113 2007/05/04 17:45:56 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.114 2007/09/20 22:30:48 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tests/029.phpt?r1=1.1r2=1.2diff_format=u
Index: php-src/ext/tidy/tests/029.phpt
diff -u /dev/null php-src/ext/tidy/tests/029.phpt:1.2
--- /dev/null   Thu Sep 20 22:30:49 2007
+++ php-src/ext/tidy/tests/029.phpt Thu Sep 20 22:30:49 2007
@@ -0,0 +1,28 @@
+--TEST--
+tidy_get_body() crash
+--SKIPIF--
+?php if (!extension_loaded('tidy')) die('skip'); ?
+--FILE--
+?php
+
+// bug report taken from http://news.php.net/php.notes/130628
+
+$inputs = array(
+   'frameset  /frameset',
+   'htmlframeset /frameset /html',
+);
+
+
+foreach ($inputs as $input) { 
+
+   $t = tidy_parse_string($input);
+   $t-cleanRepair();
+   var_dump(tidy_get_body($t));
+}
+
+echo Done\n;
+?
+--EXPECT--
+NULL
+NULL
+Done

-- 
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) /ext/iconv iconv.c

2007-09-20 Thread Stanislav Malyshev
stasThu Sep 20 22:35:25 2007 UTC

  Modified files:  (Branch: PHP_5_2)
/php-src/ext/iconv  iconv.c 
  Log:
  better fix for iconv_substr
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/iconv.c?r1=1.124.2.8.2.18r2=1.124.2.8.2.19diff_format=u
Index: php-src/ext/iconv/iconv.c
diff -u php-src/ext/iconv/iconv.c:1.124.2.8.2.18 
php-src/ext/iconv/iconv.c:1.124.2.8.2.19
--- php-src/ext/iconv/iconv.c:1.124.2.8.2.18Thu Sep 20 21:55:14 2007
+++ php-src/ext/iconv/iconv.c   Thu Sep 20 22:35:24 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: iconv.c,v 1.124.2.8.2.18 2007/09/20 21:55:14 stas Exp $ */
+/* $Id: iconv.c,v 1.124.2.8.2.19 2007/09/20 22:35:24 stas Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -700,7 +700,12 @@
}
}
 
-   if (offset = total_len || len  total_len) {
+   if(len  total_len) {
+   len = total_len;
+   }
+
+
+   if (offset = total_len) {
return PHP_ICONV_ERR_SUCCESS;
}
 

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



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

2007-09-20 Thread Stanislav Malyshev
stasThu Sep 20 22:38:25 2007 UTC

  Modified files:  
/php-src/ext/iconv  iconv.c 
  Log:
  better fix for iconv_substr
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/iconv/iconv.c?r1=1.155r2=1.156diff_format=u
Index: php-src/ext/iconv/iconv.c
diff -u php-src/ext/iconv/iconv.c:1.155 php-src/ext/iconv/iconv.c:1.156
--- php-src/ext/iconv/iconv.c:1.155 Thu Sep 20 21:57:11 2007
+++ php-src/ext/iconv/iconv.c   Thu Sep 20 22:38:25 2007
@@ -18,7 +18,7 @@
+--+
  */
 
-/* $Id: iconv.c,v 1.155 2007/09/20 21:57:11 stas Exp $ */
+/* $Id: iconv.c,v 1.156 2007/09/20 22:38:25 stas Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -765,10 +765,14 @@
}
}
 
-   if (offset = total_len || len  total_len) {
+   if(len  total_len) {
+   len = total_len;
+   }
+
+   if (offset = total_len) {
return PHP_ICONV_ERR_SUCCESS;
}
-   
+
if ((offset + len)  total_len) {
/* trying to compute the length */
len = total_len - offset;

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



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

2007-09-20 Thread Nuno Lopes
nlopess Thu Sep 20 22:44:18 2007 UTC

  Modified files:  
/php-src/ext/tidy   tidy.c 
  Log:
  oops.. thats what you get for commiting code without compiling nor testing..
  
http://cvs.php.net/viewvc.cgi/php-src/ext/tidy/tidy.c?r1=1.114r2=1.115diff_format=u
Index: php-src/ext/tidy/tidy.c
diff -u php-src/ext/tidy/tidy.c:1.114 php-src/ext/tidy/tidy.c:1.115
--- php-src/ext/tidy/tidy.c:1.114   Thu Sep 20 22:30:48 2007
+++ php-src/ext/tidy/tidy.c Thu Sep 20 22:44:17 2007
@@ -16,7 +16,7 @@
   +--+
 */
 
-/* $Id: tidy.c,v 1.114 2007/09/20 22:30:48 nlopess Exp $ */
+/* $Id: tidy.c,v 1.115 2007/09/20 22:44:17 nlopess Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include config.h
@@ -932,8 +932,9 @@
 
tidy_instanciate(tidy_ce_node, return_value TSRMLS_CC);
newobj = (PHPTidyObj *) zend_object_store_get_object(return_value 
TSRMLS_CC);
-   newobj-type = is_node;
+   newobj-type  = is_node;
newobj-ptdoc = obj-ptdoc;
+   newobj-node  = node;
newobj-ptdoc-ref_count++;
newobj-converter = obj-converter;
if (obj-converter) obj-converter-ref_count++;
@@ -1061,7 +1062,7 @@
php_info_print_table_start();
php_info_print_table_header(2, Tidy support, enabled);
php_info_print_table_row(2, libTidy Release, (char 
*)tidyReleaseDate());
-   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.114 2007/09/20 22:30:48 nlopess Exp 
$));
+   php_info_print_table_row(2, Extension Version, 
PHP_TIDY_MODULE_VERSION  ($Id: tidy.c,v 1.115 2007/09/20 22:44:17 nlopess Exp 
$));
php_info_print_table_end();
 
DISPLAY_INI_ENTRIES();

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



[PHP-CVS] Re: Message Error

2007-09-20 Thread marcot

Please authenticate the secure message.



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