{"action":"closed","issue":{"url":"https://api.github.com/repos/SimpleMachines/SMF2.1/issues/3702","repository_url":"https://api.github.com/repos/SimpleMachines/SMF2.1","labels_url":"https://api.github.com/repos/SimpleMachines/SMF2.1/issues/3702/labels{/name}","comments_url":"https://api.github.com/repos/SimpleMachines/SMF2.1/issues/3702/comments","events_url":"https://api.github.com/repos/SimpleMachines/SMF2.1/issues/3702/events","html_url":"https://github.com/SimpleMachines/SMF2.1/issues/3702","id":193392247,"number":3702,"title":"set_tld_regex always causes modSettings cache to be invalid","user":{"login":"jdarwood007","id":732116,"avatar_url":"https://avatars.githubusercontent.com/u/732116?v=3","gravatar_id":"","url":"https://api.github.com/users/jdarwood007","html_url":"https://github.com/jdarwood007","followers_url":"https://api.github.com/users/jdarwood007/followers","following_url":"https://api.github.com/users/jdarwood007/following{/other_user}","gists_url":"https://api.github.com/users/jdarwood007/gists{/gist_id}","starred_url":"https://api.github.com/users/jdarwood007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jdarwood007/subscriptions","organizations_url":"https://api.github.com/users/jdarwood007/orgs","repos_url":"https://api.github.com/users/jdarwood007/repos","events_url":"https://api.github.com/users/jdarwood007/events{/privacy}","received_events_url":"https://api.github.com/users/jdarwood007/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-05T01:23:33Z","updated_at":"2016-12-13T04:21:41Z","closed_at":"2016-12-13T04:21:41Z","body":"This took me hours to figure out why modSettings kept getting a cache miss despite having a 90 second ttl.  Finally traced it back.\r\n\r\nIn Subs.php at around lines 963 we have\r\n````\r\n\t// Ensure $modSettings['tld_regex'] contains a valid regex for the autolinker\r\n\tif (!empty($modSettings['autoLinkUrls']))\r\n\t\tset_tld_regex();\r\n````\r\n\r\nIn the set_tld_regex we have this to start\r\n````\r\nfunction set_tld_regex($update = false)\r\n{\r\n\tglobal $sourcedir, $smcFunc;\r\n\tstatic $done = false;\r\n````\r\n\r\nAnd then later on\r\n````\r\n\t// If we aren't updating and the regex is valid, we're done\r\n\telseif (!empty($modSettings['tld_regex']) && @preg_match('~' . $modSettings['tld_regex'] . '~', null) !== false)\r\n```\r\n\r\nBecause modSettings isn't defined, we fail the test and the system falls back to going to the default tlds and then issues a updateSettings, which causes a invalidation of the cache.\r\n\r\n````\r\n\t// Remember the new regex in $modSettings\r\n\tupdateSettings(array('tld_regex' => $tld_regex));\r\n````\r\n"}}
{"actor":{"display_login":"Oldiesmann"}}