thecodingmachine / docker-images-php

A set of PHP Docker images
MIT License
792 stars 140 forks source link

Add uopz extension #364

Open dretsa opened 1 year ago

dretsa commented 1 year ago

Expected Behavior

It would be nice if this extension is supported even more so when this image's purpose is for testing/development.

Context

It allows mocking of internal functions. My use case is mocking the DateTime constructor for unit tests.

dretsa commented 1 year ago

Managed to install it by adding the following to my Dockerfile:

USER root
RUN apt-get update
COPY --chmod=755 docker/install_uopz.sh /usr/local/lib/thecodingmachine-php/extensions/current/uopz/install_uopz.sh
RUN cd /usr/local/lib/thecodingmachine-php/extensions/current/uopz && ./install_uopz.sh
USER docker

One important workaround is that this extension breaks check_php_env_var_changes.php, which runs on container start. To fix it, you need disable the uopz.exit in php.ini, using:

ENV PHP_INI_UOPZ__EXIT=1

You could probably add this using your docker-compose.yml file too.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please update it if any action still required.