websupport-sk / pecl-memcache

PHP Extension - Memcache module with support of newer PHP 7.x and PHP 8.x
https://pecl.php.net/package/memcache
Other
328 stars 101 forks source link

Test 035 fails after update to PHP 8.1 #91

Open DaFox opened 2 years ago

DaFox commented 2 years ago

After updating to PHP 8.1 test 035 using a local memcached with domain sockets fails.

Build

✎ apt-get -y install --no-install-recommends zlib1g-dev memcached
✎ memcached -du www-data
✎ memcached -du www-data -p 11212
✎ mkdir /var/run/memcached
✎ chown www-data /var/run/memcached
✎ memcached -du www-data -s /var/run/memcached/memcached.sock -a 722
✎ rm -rf memcache*
✎ curl -fsSLOJ https://pecl.php.net/get/memcache/stable
✎ phpize
✎ ./configure
✎ make
✎ make test

Result

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
memcache::connect() with unix domain socket [tests/035.phpt]
=====================================================================
⚡ make: *** [Makefile:133: test] Error 1

The problem is, that passing NULL as the second argument to memcache_connect() is deprecated in PHP 8.1 and triggers an error during the tests. I managed to run the tests using the following patch.

Workaround

sed -i 's/memcache_connect(\$domainsocket, null)/memcache_connect(\$domainsocket, 0)/' tests/035.phpt

However, i guess that the whole test-case should be removed or only be executed conditionally.

TysonAndre commented 2 years ago

The problem is, that passing NULL as the second argument to memcache_connect() is deprecated in PHP 8.1 and triggers an error during the tests. I managed to run the tests using the following patch.

As you said, https://wiki.php.net/rfc/deprecate_null_to_scalar_internal_arg deprecated it deliberately. Possible solutions: The arginfo can be changed to make it nullable, or the test can be changed - https://www.php.net/manual/en/memcache.addserver.php already documents that 0 should be passed, not null