From cd8179d7adfc2d8f50d2163def0f1042bede27dc Mon Sep 17 00:00:00 2001 From: Scato Eggen <seggen@ibuildings.nl> Date: Thu, 20 Jul 2017 11:42:25 +0200 Subject: [PATCH] Invalidate opcache after writing a file When opcache.validate_timestamps is disabled, then the new metadata will not be read after a metarefresh. This can be solved by adding the metadata file to an opcache blacklist, but calling opcache_invalidate() after writing a file is a nice out-of-the-box solution. Hopefully, this will enable everybody that is using simplesamlphp to disable opcache.validate_timestamps without running into problems. --- lib/SimpleSAML/Utils/System.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/SimpleSAML/Utils/System.php b/lib/SimpleSAML/Utils/System.php index 689dcf08d..ec8b8ba1a 100644 --- a/lib/SimpleSAML/Utils/System.php +++ b/lib/SimpleSAML/Utils/System.php @@ -203,5 +203,9 @@ class System 'Error moving "'.$tmpFile.'" to "'.$filename.'": '.$error['message'] ); } + + if (function_exists('opcache_invalidate')) { + opcache_invalidate($filename); + } } } -- GitLab