mirror of
https://github.com/php/php-src.git
synced 2024-12-03 23:05:57 +08:00
- 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:
parent
32ff00efce
commit
1e9fec2a49
@ -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);
|
||||
}
|
||||
}
|
||||
|
16
ext/standard/tests/network/getmxrr.phpt
Normal file
16
ext/standard/tests/network/getmxrr.phpt
Normal 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
|
Loading…
Reference in New Issue
Block a user