YOURLS/images

"preg_replace problem" when running YOURLS in a Docker container

pcolmer opened this issue · 3 comments

Describe the bug
I'm migrating from running YOURLS directly on a server to running within a Docker container. I'm using the official YOURLS container but volume-mounting a host directory to /var/www/html/user in a variant of the advice given in #16.

I've got the $yourls_user_passwords array defined. When I log on as a newly added admin, YOURLS reports:

Could not auto-encrypt passwords. Error was: "preg_replace problem".

If l look at the config file, though, the password has been encrypted.

I'm honestly not sure if this is a general YOURLS problem or specific to Dockerised YOURLs. Also, this only seems to happen during the browser session that the password is initially encrypted.

To Reproduce
Steps to reproduce the behavior:

  1. Create a user directory to be volume-mounted by Docker
  2. Run the YOURLS container, mapping the user directory to /var/www/html/user.
  3. Finish the initialisation of YOURLS then stop the container.
  4. Add a new user under $yourls_user_passwords and restart the container.
  5. Log in as the new user.
  6. Click on the "Admin interface" link.

Expected behavior
YOURLS refresh the admin display without error.

Actual behavior
The message provided above is displayed. Nothing is given in the output from the container to assist.

Versions
YOURLS Docker container - YOURLS version 1.7.4
Allow aliases, 1.0
Auth Manager Plus, 1.0.5
Update Shortened URL, 0.2.3

dgw commented

Whoops, missed this one. Thanks @LeoColomb!

This seems very close to #37, right?

@LeoColomb yes, I think this can probably be closed as a duplicate. What seems to be happening is that YOURLS is encrypting the password and writing it back to config.php but, as noted in #37, YOURLS doesn't seem to be re-reading the file so the change password process complains that the password isn't hashed.