Em Dom, 2009-01-11 às 18:47 +0000, Felipe Pena escreveu:
> felipe                Sun Jan 11 18:47:17 2009 UTC
> 
>   Modified files:              (Branch: PHP_5_3)
>     /php-src/ext/standard     dns.c dns_win32.c 
>   Log:
>   MFH:
>   - Improved fix for #47035 (win32 part by Henrique M. Decaria)
>   [DOC] The TXT part needs be returned as an array of strings. 
> (dns_get_record())
>   
>   
Sorry, but ignores this [DOC]. NO BC! :þ

> http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.70.2.7.2.5.2.17&r2=1.70.2.7.2.5.2.18&diff_format=u
> Index: php-src/ext/standard/dns.c
> diff -u php-src/ext/standard/dns.c:1.70.2.7.2.5.2.17 
> php-src/ext/standard/dns.c:1.70.2.7.2.5.2.18
> --- php-src/ext/standard/dns.c:1.70.2.7.2.5.2.17      Thu Jan  8 17:19:50 2009
> +++ php-src/ext/standard/dns.c        Sun Jan 11 18:47:17 2009
> @@ -18,7 +18,7 @@
>     +----------------------------------------------------------------------+
>   */
>  
> -/* $Id: dns.c,v 1.70.2.7.2.5.2.17 2009/01/08 17:19:50 felipe Exp $ */
> +/* $Id: dns.c,v 1.70.2.7.2.5.2.18 2009/01/11 18:47:17 felipe Exp $ */
>  
>  /* {{{ includes */
>  #include "php.h"
> @@ -456,20 +456,29 @@
>                       break;
>               case DNS_T_TXT:
>                       {
> +                             zval *txtarray = NULL;
>                               int ll = 0;
> +                             char *txt = NULL;
>  
>                               add_assoc_string(*subarray, "type", "TXT", 1);
>                               tp = emalloc(dlen + 1);
>                               
> +                             MAKE_STD_ZVAL(txtarray);
> +                             array_init(txtarray);
> +                             
>                               while (ll < dlen) {
> +                                     txt = tp + ll;
>                                       n = cp[ll];
> -                                     memcpy(tp + ll , cp + ll + 1, n);
> +                                     memcpy(txt, cp + ll + 1, n);
>                                       ll = ll + n + 1;
> +                                     tp[ll] = '\0';
> +                                     add_next_index_stringl(txtarray, txt, 
> n, 1);    
>                               }
> -                             tp[dlen] = '\0';
> +
>                               cp += dlen;
>  
> -                             add_assoc_stringl(*subarray, "txt", tp, dlen - 
> 1, 0);
> +                             add_assoc_zval(*subarray, "txt", txtarray);
> +                             efree(tp);
>                       }
>                       break;
>               case DNS_T_SOA:
> http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns_win32.c?r1=1.1.2.4&r2=1.1.2.5&diff_format=u
> Index: php-src/ext/standard/dns_win32.c
> diff -u php-src/ext/standard/dns_win32.c:1.1.2.4 
> php-src/ext/standard/dns_win32.c:1.1.2.5
> --- php-src/ext/standard/dns_win32.c:1.1.2.4  Wed Jan  7 01:35:36 2009
> +++ php-src/ext/standard/dns_win32.c  Sun Jan 11 18:47:17 2009
> @@ -194,25 +194,24 @@
>                               int i = 0;
>                               DNS_TXT_DATA *data_txt = &pRec->Data.TXT;
>                               DWORD count = data_txt->dwStringCount;
> -                             char *txt, *txt_dst;
> +                             char *txt;
>                               long txt_len;
> +                             zval *txtarray;
>  
> -                             add_assoc_string(*subarray, "type", "TXT", 1);
> +                             MAKE_STD_ZVAL(txtarray);
> +                             array_init(txtarray);
>  
> -                             txt_len = 0;
> -                             for (i = 0; i < count; i++) {
> -                                     txt_len += 
> strlen(data_txt->pStringArray[i]) + 1;
> -                             }
> +                             add_assoc_string(*subarray, "type", "TXT", 1);
>  
> -                             txt = ecalloc(txt_len * 2, 1);
> -                             txt_dst = txt;
>                               for (i = 0; i < count; i++) {
> -                                     int len = 
> strlen(data_txt->pStringArray[i]);
> -                                     memcpy(txt_dst, 
> data_txt->pStringArray[i], len);
> -                                     txt_dst += len;
> +                                     txt_len = 
> strlen(data_txt->pStringArray[i]);
> +                                     txt = emalloc(txt_len + 1);
> +                                     memcpy(txt, data_txt->pStringArray[i], 
> txt_len);
> +                                     txt[txt_len] = '\0';
> +                                     add_next_index_stringl(txtarray, txt, 
> txt_len, 0);
>                               }
>  
> -                             add_assoc_string(*subarray, "txt", txt, 0);
> +                             add_assoc_zval(*subarray, "txt", txtarray);
>                       }
>                       break;
>  
> 
> 
> 
-- 
Regards,
Felipe Pena


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

Reply via email to