dockette / adminer

:whale: Tiniest boxed dockerized Adminer (MySQL, PostgreSQL, SQLite, Mongo, Oracle) Dockerfiles
MIT License
87 stars 29 forks source link

Adminer editor runtime PHP error: Cannot access offset of type string on string in /srv/adminer.php:450 #47

Open adambisek opened 2 years ago

adambisek commented 2 years ago

Hello there, I am experiencing problem below with adminer (4.8.1) while using latest Docker image dockette/adminer:editor

I am opening the bug report here, because I am convinced this is an runtime error somehow caused by the environment, because the same kind of URL works (in same version) Adminer editor demo with dirreferent runtime (https://demo.adminer.org/editor.php?username=&select=songs&where%5B0%5D%5Bcol%5D=album&where%5B0%5D%5Bop%5D=%3D&where%5B0%5D%5Bval%5D=1)


URL: http://localhost:8000/?pgsql=&username=admin&select=user&where%5B0%5D%5Bcol%5D=id&where%5B0%5D%5Bop%5D=%3D&where%5B0%5D%5Bval%5D=373b5863-4444-4001-98f5-097dc2ece295

HTTP request:

Request URL: http://localhost:8000/?pgsql=&username=admin&select=user&where%5B0%5D%5Bcol%5D=id&where%5B0%5D%5Bop%5D=%3D&where%5B0%5D%5Bval%5D=373b5863-4444-4001-98f5-097dc2ece295
Request Method: GET
Status Code: 500 Internal Server Error
Remote Address: [::1]:8000
Referrer Policy: origin-when-cross-origin

HTTP response:

Connection: close
Content-type: text/html; charset=UTF-8
Date: Wed, 03 Aug 2022 06:26:23 GMT
Host: localhost:8000
X-Powered-By: PHP/8.0.13

Docker logs:

database-editor_1  | [7] [Wed Aug  3 06:21:19 2022] 172.19.0.1:64412 [500]: GET /?pgsql=&username=admin&select=user&where%5B0%5D%5Bcol%5D=id&where%5B0%5D%5Bop%5D=%3D&where%5B0%5D%5Bval%5D=373b5863-4444-4001-98f5-097dc2ece295 - Uncaught TypeError: Cannot access offset of type string on string in /srv/adminer.php:450
database-editor_1  | Stack trace:
database-editor_1  | #0 /srv/adminer.php(1199): Min_Driver->convertSearch()
database-editor_1  | #1 /srv/adminer.php(1490): Adminer->selectSearchProcess()
database-editor_1  | #2 /srv/index.php(54): include('...')
database-editor_1  | #3 {main}
database-editor_1  |   thrown in /srv/adminer.php on line 450
database-editor_1  | [7] [Wed Aug  3 06:21:19 2022] 172.19.0.1:64412 Closing
adambisek commented 2 years ago

I have found workaround, just downgrade to PHP 7.4

FROM alpine:3.14

LABEL maintainer="Milan Sulc <sulcmil@gmail.com>"

ENV ADMINER_EDITOR_VERSION=4.8.1
ENV MEMORY=256M
ENV UPLOAD=2048M
ENV WORKERS=4
ENV PHP_CLI_SERVER_WORKERS=${WORKERS}

RUN echo '@community http://nl.alpinelinux.org/alpine/v3.14/community' >> /etc/apk/repositories && \
    apk update && \
    apk upgrade && \
    apk add \
        wget \
        ca-certificates \
        php7@community \
        php7-session@community \
        php7-mysqli@community \
        php7-pgsql@community \
        php7-json@community \
        php7-pecl-mongodb@community \
        tini && \
    wget https://github.com/vrana/adminer/releases/download/v$ADMINER_EDITOR_VERSION/editor-$ADMINER_EDITOR_VERSION.php -O /srv/index.php && \
    # ln -s /usr/bin/php7 /usr/bin/php && \
    apk del wget ca-certificates && \
    rm -rf /var/cache/apk/*

WORKDIR /srv
EXPOSE 80

ENTRYPOINT ["/sbin/tini", "--"]

CMD /usr/bin/php \
    -d memory_limit=$MEMORY \
    -d upload_max_filesize=$UPLOAD \
    -d post_max_size=$UPLOAD \
    -S 0.0.0.0:80