php-memcached-dev / php-memcached

memcached extension based on libmemcached library
Other
987 stars 322 forks source link

TypeError: Memcached::setMulti() #509

Open davidteruelguillem opened 2 years ago

davidteruelguillem commented 2 years ago

If php 8.1.13 i'm getting the next confusing error:

TypeError: Memcached::setMulti(): Argument #2 ($expiration) must be of type int, int given

This error does not happen in PHP 8.0

remicollet commented 2 years ago

Can you provide a simple script to reproduce ? (setMulti is covered by test suite, and tests are OK)

remicollet commented 2 years ago

And also confirm PHP and extension versions used

Krakozaber commented 2 years ago

Waiting for the release, not RC. Some sources do not compile it.

remicollet commented 2 years ago

Waiting for the release, not RC

GA won't happen if nobody check the RC :p

davidteruelguillem commented 2 years ago

Can you provide a simple script to reproduce ? (setMulti is covered by test suite, and tests are OK)

If you copy the next example from https://www.php.net/manual/es/memcached.setmulti.php

<?php
$m = new Memcached();
$m->addServer('localhost', 11211);

$items = array(
    'key1' => 'value1',
    'key2' => 'value2',
    'key3' => 'value3'
);
$m->setMulti($items, time() + 300);

You will get the error "PHP Fatal error: Uncaught TypeError: Memcached::setMulti(): Argument #2 ($expiration) must be of type int, int given" only in php8.1, but not in php8.0.

The Error " must be of type int, int given" is a bit confusing.

remicollet commented 2 years ago

Sorry, cannot reproduce (using 3.2.0)

justinclloyd commented 11 months ago

I am getting this issue on 3.2.0 on Ubuntu 22.04 with PHP 8.1 when trying to upgrade MediaWiki 1.38 (Ubuntu 20.04) to 1.39.

[3a60eedc77100f915aba205c] / TypeError: Memcached::cas(): Argument #4 ($expiration) must be of type int, int given

Backtrace:

from /path/to/site/includes/libs/objectcache/MemcachedPeclBagOStuff.php(224)
#0 /path/to/site/includes/libs/objectcache/MemcachedPeclBagOStuff.php(224): Memcached->cas()
#1 /path/to/site/includes/libs/objectcache/MediumSpecificBagOStuff.php(361): MemcachedPeclBagOStuff->doCas()
#2 /path/to/site/includes/libs/objectcache/MediumSpecificBagOStuff.php(321): MediumSpecificBagOStuff->cas()
#3 /path/to/site/includes/libs/objectcache/MediumSpecificBagOStuff.php(270): MediumSpecificBagOStuff->mergeViaCas()
#4 /path/to/site/includes/libs/objectcache/wancache/WANObjectCache.php(909): MediumSpecificBagOStuff->merge()
#5 /path/to/site/includes/language/MessageCache.php(962): WANObjectCache->set()
#6 /path/to/site/includes/language/MessageCache.php(902): MessageCache->setValidationHash()
#7 /path/to/site/includes/language/MessageCache.php(483): MessageCache->saveToCaches()
#8 /path/to/site/includes/language/MessageCache.php(398): MessageCache->loadFromDBWithMainLock()
#9 /path/to/site/includes/language/MessageCache.php(318): MessageCache->loadUnguarded()
#10 /path/to/site/includes/language/MessageCache.php(1199): MessageCache->load()
#11 /path/to/site/includes/language/MessageCache.php(1126): MessageCache->getMsgFromNamespace()
#12 /path/to/site/includes/language/MessageCache.php(1097): MessageCache->getMessageForLang()
#13 /path/to/site/includes/language/MessageCache.php(1039): MessageCache->getMessageFromFallbackChain()
#14 /path/to/site/includes/language/Message.php(1473): MessageCache->get()
#15 /path/to/site/includes/language/Message.php(970): Message->fetchMessage()
#16 /path/to/site/includes/language/Message.php(1053): Message->format()
#17 /path/to/site/includes/Title.php(715): Message->text()
#18 /path/to/site/includes/MediaWiki.php(142): Title::newMainPage()
#19 /path/to/site/includes/MediaWiki.php(162): MediaWiki->parseTitle()
#20 /path/to/site/includes/MediaWiki.php(860): MediaWiki->getTitle()
#21 /path/to/site/includes/MediaWiki.php(562): MediaWiki->main()
#22 /path/to/site/index.php(50): MediaWiki->run()
#23 /path/to/site/index.php(46): wfIndexMain()
#24 {main}