uopz
uopz copied to clipboard
Uopz seems to kill composer autoload
PHP: 7.4.30 uopz: 6.1.1
Hi. I'm using this package as a dependency of PHP MockClock. Uopz is installed in a php docker container using the following:
# Build extensions
FROM bref/php-74-console:latest AS ext
# Setup php7.4 for build
RUN yum install -y amazon-linux-extras && amazon-linux-extras install php7.4
# Install packages
RUN yum install -y php-pear php-devel gcc make unzip zip
# Install mysql, zip, unzip from self-built
COPY config/serverless/layers/*.zip /tmp
RUN unzip /tmp/*.zip -d /tmp/mysql
# Build xdebug and uopz (for ClockMock)
RUN pecl channel-update pecl.php.net
RUN pecl install xdebug uopz-6.1.1
RUN cp /usr/lib64/php/modules/xdebug.so /tmp/xdebug.so
RUN cp /usr/lib64/php/modules/uopz.so /tmp/uopz.so
# Base image
FROM bref/php-74-fpm-dev:latest
# Copy things we installed to the final image
COPY --from=ext /tmp/xdebug.so /opt/bref/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so
COPY --from=ext /tmp/uopz.so /opt/bref/lib/php/extensions/no-debug-non-zts-20190902/uopz.so
COPY --from=ext /tmp/mysql /opt
# overwrite with our own php-fpm config (to allow concurrency)
COPY /php/php-fpm.conf /opt/bref/etc/php-fpm.conf
# Install things we need on final image
RUN yum install -y amazon-linux-extras file unzip zip
# Install gd
RUN amazon-linux-extras enable php7.4 && yum install -y php-gd
RUN cp /usr/lib64/php/modules/gd.so /opt/bref/lib/php/extensions/no-debug-non-zts-20190902/gd.so
# Run PHP-FPM as root
# opcache.validate_timestamps=1 : cancels the flag in the base configuration so that files are reloaded
CMD /opt/bin/php-fpm --nodaemonize --fpm-config /opt/bref/etc/php-fpm.conf -d opcache.validate_timestamps=1 --force-stderr --allow-to-run-as-root
This actually worked at one point, and I think it has something to do with composer installs. But on multiple instances of this docker setup, we are seeing the following error on ANY page load:
php | NOTICE: PHP message: PHP Fatal error: Uncaught Error: Call to undefined method ComposerAutoloaderInit51b2d8a3b9de3cdcc3490f52082af4ba::getLoader() in /var/task/vendor/autoload.php:7
php | Stack trace:
php | #0 /var/task/web/index.php(5): require_once()
php | #1 {main}
php | thrown in /var/task/vendor/autoload.php on line 7
Even if we manually follow that trace inside the container itself, the exact class and method it is complaining about being undefined, exist just fine. Also, if I remove extension = uopz
from the php.ini for the container and rebuild it, all is fine without any other interaction with code.
Any ideas?