mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02: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
2 changed files with 17 additions and 2 deletions
|
@ -836,7 +836,6 @@ PHP_FUNCTION(dns_get_mx)
|
||||||
char *hostname;
|
char *hostname;
|
||||||
int hostname_len;
|
int hostname_len;
|
||||||
zval *mx_list, *weight_list = NULL;
|
zval *mx_list, *weight_list = NULL;
|
||||||
int need_weight = 0;
|
|
||||||
int count, qdc;
|
int count, qdc;
|
||||||
u_short type, weight;
|
u_short type, weight;
|
||||||
u_char ans[MAXPACKET];
|
u_char ans[MAXPACKET];
|
||||||
|
@ -891,7 +890,7 @@ PHP_FUNCTION(dns_get_mx)
|
||||||
}
|
}
|
||||||
cp += i;
|
cp += i;
|
||||||
add_next_index_rt_string(mx_list, buf, ZSTR_DUPLICATE);
|
add_next_index_rt_string(mx_list, buf, ZSTR_DUPLICATE);
|
||||||
if (need_weight) {
|
if (weight_list) {
|
||||||
add_next_index_long(weight_list, weight);
|
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…
Add table
Add a link
Reference in a new issue