Skip to content

TypeError: Memcached::setMulti() #509

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
davidteruelguillem opened this issue Mar 15, 2022 · 8 comments
Open

TypeError: Memcached::setMulti() #509

davidteruelguillem opened this issue Mar 15, 2022 · 8 comments

Comments

@davidteruelguillem
Copy link

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
Copy link
Collaborator

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

@remicollet
Copy link
Collaborator

remicollet commented Mar 15, 2022

And also confirm PHP and extension versions used

@Krakozaber
Copy link

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

@remicollet
Copy link
Collaborator

Waiting for the release, not RC

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

jasny added a commit to desarrolla2/Cache that referenced this issue Mar 29, 2022
@davidteruelguillem
Copy link
Author

davidteruelguillem commented Apr 11, 2022

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
Copy link
Collaborator

Sorry, cannot reproduce (using 3.2.0)

@justinclloyd
Copy link

justinclloyd commented Sep 27, 2023

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}

@justinclloyd
Copy link

I just tested this again on a new Ubuntu 22.04 server with the php-cli package version 8.1+92ubuntu1 and pecl-memcached 3.3.0. I used the little PHP test script but did not get the error message provided. So my next test will be a full test in my dev MediaWiki environmen on new 22.04 servers.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants