Open Girgias opened 4 days ago
For php_network_connect_socket_to_host
, I think the union should probably be = {0}
'd, or actually set the fields, if they are important (Scope ID does matter with link-local, at least.). Snippet of the relevant code below:
union {
struct sockaddr common;
struct sockaddr_in in4;
#ifdef HAVE_IPV6
struct sockaddr_in6 in6;
#endif
} local_address;
int local_address_len = 0;
if (sa->sa_family == AF_INET) {
if (inet_pton(AF_INET, bindto, &local_address.in4.sin_addr) == 1) {
local_address_len = sizeof(struct sockaddr_in);
local_address.in4.sin_family = sa->sa_family;
local_address.in4.sin_port = htons(bindport);
memset(&(local_address.in4.sin_zero), 0, sizeof(local_address.in4.sin_zero));
}
}
#ifdef HAVE_IPV6
else { /* IPV6 */
if (inet_pton(AF_INET6, bindto, &local_address.in6.sin6_addr) == 1) {
local_address_len = sizeof(struct sockaddr_in6);
local_address.in6.sin6_family = sa->sa_family;
local_address.in6.sin6_port = htons(bindport);
}
}
#endif
#ifdef IP_BIND_ADDRESS_NO_PORT
{
int val = 1;
(void) setsockopt(sock, SOL_IP, IP_BIND_ADDRESS_NO_PORT, &val, sizeof(val));
}
#endif
if (local_address_len == 0) {
php_error_docref(NULL, E_WARNING, "Invalid IP Address: %s", bindto);
} else if (bind(sock, &local_address.common, local_address_len)) {
php_error_docref(NULL, E_WARNING, "Failed to bind to '%s:%d', system said: %s", bindto, bindport, strerror(errno));
}
@NattyNarwhal Yes that seems to be the most simple fix, just adding = {0}
. And for completeness, then also removing the then-useless memset(&(local_address.in4.sin_zero), 0, sizeof(local_address.in4.sin_zero));
.
I can't reproduce the results for Zend/tests/generators/errors/generator_extend_error.phpt
or Zend/tests/weakrefs/weakrefs_004.phpt
. What configuration options did you use and which compiler?
My configure command was:
./configure -C CC=gcc CFLAGS="-DPROFITABILITY_CHECKS=0 -DZEND_RC_DEBUG=1 -DZEND_VERIFY_FUNC_INFO=1 -DZEND_TRACK_ARENA_ALLOC=1 -ggdb3" --enable-debug --enable-tokenizer --enable-opcache --enable-zend-test --enable-dl-test=shared --enable-pcntl --enable-mbstring --enable-fpm --enable-posix --enable-bcmath --enable-calendar --enable-ctype --enable-exif --enable-fileinfo --enable-filter --enable-ftp --enable-gd --enable-session --enable-sockets --enable-sysvmsg --enable-shmop --enable-sysvsem --enable-sysvshm --enable-dba --with-qdbm --with-cdb --enable-flatfile --enable-inifile --with-lmdb --with-tcadb --with-zip --with-zlib --with-bz2 --with-curl --with-ffi --with-gmp --with-tidy --with-enchant --with-openssl --with-sodium --with-libxml --enable-dom --enable-simplexml --enable-xml --enable-xmlreader --enable-xmlwriter --with-xsl --enable-soap --with-sqlite3 --with-mysqli --with-unixODBC --enable-pdo --with-pdo-firebird --with-pdo-mysql --with-pdo-pgsql --with-pdo-sqlite --with-pgsql --with-iconv --disable-phar --with-readline --enable-intl --enable-simplexml --with-ffi --with-valgrind --prefix /home/girgias/Dev/custom-php/
Frustratingly, I don't have the test command as I was forced to reset my computer as it got very unresponsive and losing the terminal history/command. But I cannot reproduce them either now...
Description
Some of our tests when run under Valgrind seem to be leaking because of mistakes within php-src. I ran those tests while attempting to determine another issue, but those seem very unlikely related to my specific issue.
ext/standard/tests/network/bug74764.phpt
ext/standard/tests/strings/strtr_with_reference.phpt
Zend/tests/generators/errors/generator_extend_error.phpt
Zend/tests/weakrefs/weakrefs_004.phpt
PHP Version
master
Operating System
No response