fulltextsearch_elasticsearch icon indicating copy to clipboard operation
fulltextsearch_elasticsearch copied to clipboard

PHP Fatal error: Declaration of Elastic\Elasticsearch\Response\Elasticsearch::withStatus

Open 3038922 opened this issue 8 months ago โ€ข 13 comments

ubuntu 22.04. php 8.1 elasticsearch 8.6.1

 โšก root@nextcloud ๎‚ฐ ~ ๎‚ฐ sudo -u www-data php /var/www/nextcloud/occ  fulltextsearch:test

.Testing your current setup:
Creating mocked content provider. ok
Testing mocked provider: get indexable documents. (2 items) ok
Loading search platform. (Elasticsearch) ok
Testing search platform. PHP Fatal error:  Declaration of Elastic\Elasticsearch\Response\Elasticsearch::withStatus(int $code, string $reasonPhrase = ''): Psr\Http\Message\ResponseInterface must be compatible with Psr\Http\Message\ResponseInterface::withStatus($code, $reasonPhrase = '') in /var/www/nextcloud/apps/fulltextsearch_elasticsearch/vendor/elasticsearch/elasticsearch/src/Traits/MessageResponseTrait.php on line 87
 โšก root@nextcloud ๎‚ฐ ~ ๎‚ฐ sudo -u www-data php --ini
Configuration File (php.ini) Path: /etc/php/8.1/cli
Loaded Configuration File:         /etc/php/8.1/cli/php.ini
Scan for additional .ini files in: /etc/php/8.1/cli/conf.d
Additional .ini files parsed:      /etc/php/8.1/cli/conf.d/10-mysqlnd.ini,
/etc/php/8.1/cli/conf.d/10-opcache.ini,
/etc/php/8.1/cli/conf.d/10-pdo.ini,
/etc/php/8.1/cli/conf.d/15-xml.ini,
/etc/php/8.1/cli/conf.d/20-apcu.ini,
/etc/php/8.1/cli/conf.d/20-bcmath.ini,
/etc/php/8.1/cli/conf.d/20-bz2.ini,
/etc/php/8.1/cli/conf.d/20-calendar.ini,
/etc/php/8.1/cli/conf.d/20-ctype.ini,
/etc/php/8.1/cli/conf.d/20-curl.ini,
/etc/php/8.1/cli/conf.d/20-dom.ini,
/etc/php/8.1/cli/conf.d/20-exif.ini,
/etc/php/8.1/cli/conf.d/20-ffi.ini,
/etc/php/8.1/cli/conf.d/20-fileinfo.ini,
/etc/php/8.1/cli/conf.d/20-ftp.ini,
/etc/php/8.1/cli/conf.d/20-gd.ini,
/etc/php/8.1/cli/conf.d/20-gettext.ini,
/etc/php/8.1/cli/conf.d/20-gmp.ini,
/etc/php/8.1/cli/conf.d/20-iconv.ini,
/etc/php/8.1/cli/conf.d/20-igbinary.ini,
/etc/php/8.1/cli/conf.d/20-imagick.ini,
/etc/php/8.1/cli/conf.d/20-intl.ini,
/etc/php/8.1/cli/conf.d/20-ldap.ini,
/etc/php/8.1/cli/conf.d/20-mbstring.ini,
/etc/php/8.1/cli/conf.d/20-mysqli.ini,
/etc/php/8.1/cli/conf.d/20-pdo_mysql.ini,
/etc/php/8.1/cli/conf.d/20-phar.ini,
/etc/php/8.1/cli/conf.d/20-posix.ini,
/etc/php/8.1/cli/conf.d/20-readline.ini,
/etc/php/8.1/cli/conf.d/20-redis.ini,
/etc/php/8.1/cli/conf.d/20-shmop.ini,
/etc/php/8.1/cli/conf.d/20-simplexml.ini,
/etc/php/8.1/cli/conf.d/20-sockets.ini,
/etc/php/8.1/cli/conf.d/20-sysvmsg.ini,
/etc/php/8.1/cli/conf.d/20-sysvsem.ini,
/etc/php/8.1/cli/conf.d/20-sysvshm.ini,
/etc/php/8.1/cli/conf.d/20-tokenizer.ini,
/etc/php/8.1/cli/conf.d/20-xmlreader.ini,
/etc/php/8.1/cli/conf.d/20-xmlrpc.ini,
/etc/php/8.1/cli/conf.d/20-xmlwriter.ini,
/etc/php/8.1/cli/conf.d/20-xsl.ini,
/etc/php/8.1/cli/conf.d/20-zip.ini

3038922 avatar Dec 12 '23 05:12 3038922

Seems to be this issue: https://github.com/elastic/elasticsearch-php/issues/1342

timdodge avatar Dec 25 '23 12:12 timdodge

Same here, but I have no idea how to fix it with this: https://github.com/elastic/elasticsearch-php/issues/1342

Testing search platform. PHP Fatal error: Declaration of Elastic\Elasticsearch\Response\Elasticsearch::withStatus(int $code, string $reasonPhrase = ''): Psr\Http\Message\ResponseInterface must be compatible with Psr\Http\Message\ResponseInterface::withStatus($code, $reasonPhrase = '') in /var/www/nextcloud/apps/fulltextsearch_elasticsearch/vendor/elasticsearch/elasticsearch/src/Traits/MessageResponseTrait.php on line 87

I get this error:

โ”Œโ”€ Errors โ”€โ”€โ”€โ”€ โ”‚ Error: 1642/1642 โ”‚ Index: files:315863 โ”‚ Exception: Elastic\Elasticsearch\Exception\ServerResponseException โ”‚ Message: unknown error

jstampfer avatar Dec 25 '23 20:12 jstampfer

I get the same error message when I run sudo -u www-data php /var/www/nextcloud/occ fulltextsearch:test. I wonder if this indexing app is working for anybody, or is it just a few people running into problems?

edgeofthex avatar Dec 30 '23 11:12 edgeofthex

My instance is actually not throwing errors. I'm however not sure if it is doing the job as expected. Don't know how to test otherwise:

.Testing your current setup:  
Creating mocked content provider. ok  
Testing mocked provider: get indexable documents. (2 items) ok  
Loading search platform. (Elasticsearch) ok  
Testing search platform. ok  
Locking process ok  
Removing test. ok  
Pausing 3 seconds 1 2 3 ok  
Initializing index mapping. ok  
Indexing generated documents. ok  
Pausing 3 seconds 1 2 3 ok  
Retreiving content from a big index (license). (size: 32386) ok  
Comparing document with source. ok  
Searching basic keywords:  
 - 'test' (result: 1, expected: ["simple"]) ok  
 - 'document is a simple test' (result: 2, expected: ["simple","license"]) ok  
 - '"document is a test"' (result: 0, expected: []) ok  
 - '"document is a simple test"' (result: 1, expected: ["simple"]) ok  
 - 'document is a simple -test' (result: 1, expected: ["license"]) ok  
 - 'document is a simple +test' (result: 1, expected: ["simple"]) ok  
 - '-document is a simple test' (result: 0, expected: []) ok  
 - 'document is a simple +test +testing' (result: 1, expected: ["simple"]) ok  
 - 'document is a simple +test -testing' (result: 0, expected: []) ok  
 - 'document is a +simple -test -testing' (result: 0, expected: []) ok  
 - '+document is a simple -test -testing' (result: 1, expected: ["license"]) ok  
 - 'document is a +simple -license +testing' (result: 1, expected: ["simple"]) ok  
Updating documents access. Force Quit

Instance:

Rasperry Pi 4 Model B Rev 1.4 8GB
Debian GNU/linux 12 (bookworm)
NC "27.1.5.1"
Webserver "Apache/2.4.57 (Debian)"
PHP "8.2.14"
DB "PostgreSQL 16.1 (Debian 16.1-1.pgdg120+1) on aarch64-unknown-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit"
Full text search - Elasticsearch Platform 27.0.5
Full text search 27.0.3
Full text search - Files 27.0.1
Full text search - Files - Tesseract OCR 27.0.0
elasticsearch/stable,now 8.11.3 arm64 with readonlyrest

cheers

aakerbeere avatar Dec 30 '23 12:12 aakerbeere

I get the same error with nextcloud 28. All plugins have also been updated to version >28.

bt1v1 avatar Dec 30 '23 17:12 bt1v1

I get the same error with nextcloud 28. All plugins have also been updated to version >28.

I'm on 28 as well.

edgeofthex avatar Dec 30 '23 18:12 edgeofthex

If I make "sudo -u www-data php occ fulltextsearch:test" then I get the following errors:

.Testing your current setup: Creating mocked content provider. ok Testing mocked provider: get indexable documents. (2 items) ok Loading search platform. (Elasticsearch) ok Testing search platform. PHP Fatal error: Declaration of Elastic\Elasticsearch\Response\Elasticsearch::withStatus(int $code, string $reasonPhrase = ''): Psr\Http\Message\ResponseInterface must be compatible with Psr\Http\Message\ResponseInterface::withStatus($code, $reasonPhrase = '') in /var/www/nextcloud/apps/fulltextsearch_elasticsearch/vendor/elasticsearch/elasticsearch/src/Traits/MessageResponseTrait.php on line 87

Nextcloud version: 28.0.1 all updates installed

PHP-Version: 8.1.27

Elasticsearch: 8.11.3

I run the following Ubuntu: Distributor ID: Ubuntu Description: Ubuntu 20.04.6 LTS Release: 20.04 Codename: focal

jstampfer avatar Jan 07 '24 19:01 jstampfer

Hello, I'm on NC28 and ES 8.12.1, same error. Is it an Elastic error or a Nextcloud error? Who is responsible to solve it? THX, Michael

SanMichele avatar Feb 11 '24 15:02 SanMichele

I installed NC28 and ES 8.12 and hit the same error.

I'm not a coder but I followed up the error message and it seems working by making some changes to /var/www/nextcloud/apps/fulltextsearch_elasticsearch/vendor/elasticsearch/elasticsearch/src/Traits/MessageResponseTrait.php in lines 42, 57, 62, 67, and 87.

I have no idea how to show changes in the reply, please see the attached file. MessageResponseTrait.zip

After applying the changes, the fulltextsearch seems working. It ignores one of my external local storage folders however, this may be another issue.

Wish you guys good luck.

random6150 avatar Feb 16 '24 01:02 random6150

Hi, found it: With the app Carnet also comes ./apps/carnet/vendor/psr/http-message/src/ResponseInterface.php with the wrong declaration. Delete Carnet and the error is gone. Kind regards, Michael

SanMichele avatar Feb 19 '24 18:02 SanMichele

Hi, found it: With the app Carnet also comes ./apps/carnet/vendor/psr/http-message/src/ResponseInterface.php with the wrong declaration. Delete Carnet and the error is gone. Kind regards, Michael

Incomprehensible. Yes. It was enough to turn off the Carnet. But what is the problem? Carnet or Elasticsearch?

s90570 avatar Feb 29 '24 09:02 s90570

I guess the problem was caused by Carnet. I removed Carnet and reinstalled elasticsearch without any modification, everything works well.

From my previous modification, this might because Carnet incorporated and old version of psr components, which loaded first.

TomS @.***> ๆ–ผ 2024ๅนด2ๆœˆ29ๆ—ฅ ้€ฑๅ›› 17:28 ๅฏซ้“๏ผš

Hi, found it: With the app Carnet also comes ./apps/carnet/vendor/psr/http-message/src/ResponseInterface.php with the wrong declaration. Delete Carnet and the error is gone. Kind regards, Michael

Incomprehensible. Yes. It was enough to turn off the Carnet. But what is the problem? Carnet or Elasticsearch?

โ€” Reply to this email directly, view it on GitHub https://github.com/nextcloud/fulltextsearch_elasticsearch/issues/341#issuecomment-1970740521, or unsubscribe https://github.com/notifications/unsubscribe-auth/BGGFZ4Z5QDZJFRMUCCS5RKLYV32FLAVCNFSM6AAAAABAQ3KVD2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQG42DANJSGE . You are receiving this because you commented.Message ID: @.***>

random6150 avatar Feb 29 '24 09:02 random6150

I guess the problem was caused by Carnet. I removed Carnet and reinstalled elasticsearch without any modification, everything works well. From my previous modification, this might because Carnet incorporated and old version of psr components, which loaded first.

Exactly! I renamed /nextcloud/apps/carnet/vendor/psr/http-message to /nextcloud/apps/carnet/vendor/psr/http-messageOLD and made a symlink to /nextcloud/apps/fulltextsearch_elasticsearch/vendor/psr/http-message. Carnet still uses psr/http-message version 1.x while elasticsearch uses version 2.0 already.

And it seems to be working. Many thanks gentlemen!!!

s90570 avatar Feb 29 '24 11:02 s90570