http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.80&r2=1.81
and merged to head with:
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dns.c?r1=1.70.2.7.2.5&r2=1.70.2.7.2.5.2.1
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];
}
cp += i;
add_next_index_string(mx_list, buf, 1);
- if (need_weight) {
+ if (weight_list) {
add_next_index_long(weight_list, weight);
}
}
--- /dev/null
+--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