drupal icon indicating copy to clipboard operation
drupal copied to clipboard

Return value must be of type array, null returned

Open a1exus opened this issue 2 months ago • 7 comments

Hello,

It appears latest Drupal image is broken(

$ docker pull drupal:latest
latest: Pulling from library/drupal
Digest: sha256:a819ef588c399ac362a2e0a85e2a89675b91ce19c26d9348f59f28cc89df3046
Status: Image is up to date for drupal:latest
docker.io/library/drupal:latest
$ docker compose up -d
[+] Running 1/1
 ✔ Container drupal  Started                                                                                                                                                                               0.5s
$ docker compose logs --follow
drupal  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.4. Set the 'ServerName' directive globally to suppress this message
drupal  | AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.20.0.4. Set the 'ServerName' directive globally to suppress this message
drupal  | [Sat Dec 27 15:23:13.154559 2025] [mpm_prefork:notice] [pid 1:tid 1] AH00163: Apache/2.4.65 (Debian) PHP/8.4.16 configured -- resuming normal operations
drupal  | [Sat Dec 27 15:23:13.154598 2025] [core:notice] [pid 1:tid 1] AH00094: Command line: 'apache2 -D FOREGROUND'
drupal  | [Sat Dec 27 15:23:27.887045 2025] [php:notice] [pid 17:tid 17] [client 172.18.0.21:48630] Uncaught PHP Exception TypeError: "Drupal\\Core\\Utility\\ThemeRegistry::getPreprocessInvokes(): Return value must be of type array, null returned" at /opt/drupal/web/core/lib/Drupal/Core/Utility/ThemeRegistry.php line 180
drupal  | 172.18.0.21 - - [27/Dec/2025:15:23:27 +0000] "GET / HTTP/1.1" 500 635 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36"
^Ccanceled
$

Please advise.

a1exus avatar Dec 27 '25 15:12 a1exus

Works for me (command output below). You appear to be using docker compose, so my guess would be you are mounting a volume that has a broken codebase or some other issue specific to your deployment.

$ docker pull drupal:latest
latest: Pulling from library/drupal
Digest: sha256:a819ef588c399ac362a2e0a85e2a89675b91ce19c26d9348f59f28cc89df3046
Status: Downloaded newer image for drupal:latest
docker.io/library/drupal:latest
$ docker run --rm drupal:latest
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.17.0.2. Set the 'ServerName' directive globally to suppress this message
[Sat Dec 27 21:02:33.562912 2025] [mpm_prefork:notice] [pid 1:tid 1] AH00163: Apache/2.4.65 (Debian) PHP/8.4.16 configured -- resuming normal operations
[Sat Dec 27 21:02:33.562947 2025] [core:notice] [pid 1:tid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

mstenta avatar Dec 27 '25 21:12 mstenta

I only see you pulled Drupal's latest image, but I don't see you tried to access it. Which is what I did, and I've got ISE 500 (last line in my logs).

a1exus avatar Dec 28 '25 01:12 a1exus

I tested again did not get that error when I tried to access it.

Do you get that error without any volume mounts, and with only docker run (not docker compose)?

mstenta avatar Dec 29 '25 13:12 mstenta

my docker-compose.yaml:

$ cat docker-compose.yaml
services:
  drupal:
    container_name: drupal
    expose:
      - 8080
    image: drupal:latest
    labels:
      - "traefik.enable=true"
      - "traefik.docker.network=traefik_traefik"
      - "traefik.http.routers.drupal.entrypoints=websecure"
      - 'traefik.http.routers.drupal.rule=Host(`ABC.XYZ`)||HostRegexp(`.+\.ABC\.XYZ`)'
      - "traefik.http.routers.drupal.tls.certresolver=myresolver"
    networks:
      - mariadb
      - traefik
    volumes:
      - ./var/www/html/modules:/var/www/html/modules
      - ./var/www/html/profiles:/var/www/html/profiles
      - ./var/www/html/themes:/var/www/html/themes
      - ./var/www/html/sites:/var/www/html/sites
    restart: always
networks:
  mariadb:
    name: mariadb_mariadb
    external: true
  traefik:
    name: traefik_traefik
    external: true
$

a1exus avatar Dec 29 '25 13:12 a1exus

so my guess would be you are mounting a volume that has a broken codebase or some other issue specific to your deployment

This is still my suspicion.

To isolate it, I would start with a blank database, then remove all of your volumes lines and restart the containers and see if you still get the error. If you do not, then it points to something in your volumes. You can then restore one of the volumes and try again. Repeat until you find which volume is causing the issue.

Also worth noting: you probably shouldn't use drupal:latest. That will change over time, as new versions of Drupal are released, and those may not be compatible with your other modules, themes, etc. Instead, use the specific version that you know has been tested and is working with your other code, and make your upgrade process incremental and intentional, so you know when upstream changes require updates to other parts of your code.

Ultimately, using Composer to build your codebase is the best way to manage dependencies and versions. Simply mounting /var/www/html/modules, /var/www/html/themes, etc has a high risk of incompatibilities between Drupal core and contrib modules/themes.

mstenta avatar Dec 29 '25 15:12 mstenta

Also worth noting: you probably shouldn't use drupal:latest. That will change over time, as new versions of Drupal are released, and those may not be compatible with your other modules, themes, etc. Instead, use the specific version that you know has been tested and is working with your other code, and make your upgrade process incremental and intentional, so you know when upstream changes require updates to other parts of your code.

i was using plain vanilla Drupal installation, however you're right on bad practice of using latest, and when I switched tag to "11.2.10", there is no more of ISE500 anymore ;-), hence why i thought latest is broken.

a1exus avatar Dec 29 '25 20:12 a1exus

A completely fresh instance seems fine here: :eyes:

$ docker run -dit --pull=always --name drupal drupal:latest
latest: Pulling from library/drupal
Digest: sha256:62ade4c94ac1be4526db2cac3b60f2a847710465bfce1265531c2411a514e4f9
Status: Image is up to date for drupal:latest
2b7182fcd8cd6649303bb733e859cc2d94db402330b08596eee913407feb5030

$ docker logs drupal
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.27.0.7. Set the 'ServerName' directive globally to suppress this message
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 172.27.0.7. Set the 'ServerName' directive globally to suppress this message
[Fri Jan 02 19:21:24.211351 2026] [mpm_prefork:notice] [pid 1:tid 1] AH00163: Apache/2.4.65 (Debian) PHP/8.4.16 configured -- resuming normal operations
[Fri Jan 02 19:21:24.211376 2026] [core:notice] [pid 1:tid 1] AH00094: Command line: 'apache2 -D FOREGROUND'

$ docker run -it --rm --network container:drupal tianon/network-toolbox curl localhost
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="refresh" content="0;url='/core/install.php'" />

        <title>Redirecting to /core/install.php</title>
    </head>
    <body>
        Redirecting to <a href="/core/install.php">/core/install.php</a>.
    </body>
</html>

Do you have more specific steps that can be used to reproduce?

tianon avatar Jan 02 '26 19:01 tianon

Do you have more specific steps that can be used to reproduce?

No, what you did is the correct way to reproduce the issue. However, in your case, you pulled an updated image because the hash sum changed, and the bug might have already been fixed.

a1exus avatar Jan 03 '26 12:01 a1exus