- Fixed weights array, which was broken with:

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.80&r2=1.81
This commit is contained in:
Derick Rethans 2007-11-22 10:18:30 +00:00
parent 32ff00efce
commit 1e9fec2a49
2 changed files with 17 additions and 2 deletions

View File

@ -836,7 +836,6 @@ PHP_FUNCTION(dns_get_mx)
char *hostname;
int hostname_len;
zval *mx_list, *weight_list = NULL;
int need_weight = 0;
int count, qdc;
u_short type, weight;
u_char ans[MAXPACKET];
@ -891,7 +890,7 @@ PHP_FUNCTION(dns_get_mx)
}
cp += i;
add_next_index_rt_string(mx_list, buf, ZSTR_DUPLICATE);
if (need_weight) {
if (weight_list) {
add_next_index_long(weight_list, weight);
}
}

View File

@ -0,0 +1,16 @@
--TEST--
dns_check_record() segfault with empty host
--FILE--
<?php
$domains = array( 'php.net', 'ez.no' );
foreach ( $domains as $domain )
{
if ( getmxrr( $domain, $hosts, $weights ) )
{
echo "Hosts: " . count( $hosts ) . ", weights: " . count( $weights ) . "\n";
}
}
?>
--EXPECT--
Hosts: 2, weights: 2
Hosts: 1, weights: 1