Preg_replace problem during auto-encryption

Hi everyone,

I’m running yourls under docker and the only issue I could found is related with auto-encryption of the password. As a test, I tried to encrypt it manually via md5, but also does not work.

The issue shows up as follows:

Due to this error, I decided to set debug to true to help me further:

Connected to database yourls on 192.168.1.76 
SQL: SELECT option_name, option_value FROM yourls_options WHERE 1=1 (0.00080 s)
Check for new version: no
Problem with preg_replace for password hash of user 0
SQL: SELECT option_value FROM yourls_options WHERE option_name = 'defer_hashing_error' LIMIT 1 (0.00090 s)
SQL: SELECT COUNT(keyword) as count, SUM(clicks) as sum FROM `yourls_url` WHERE 1=1  (0.00081 s)
SQL: SELECT * FROM `yourls_url` WHERE 1=1  ORDER BY `timestamp` desc LIMIT 0, 15; (0.00095 s)

I have no clue what could be wrong here. Any help would be appreciated.

I think most “could not auto encrypt” errors would be when the config file isn’t writable, see https://github.com/YOURLS/YOURLS/wiki/Username-Passwords#faq.

If I remember correctly, “preg_replace problem” would occur with malformed config.php where YOURLS cannot guess where the password is. You could check this code block and throw some var_dumps to further diagnose

In the end also remember you can disable this feature:
define( 'YOURLS_NO_HASH_PASSWORD', true );