{"id":2694,"date":"2020-04-13T00:26:51","date_gmt":"2020-04-12T22:26:51","guid":{"rendered":"https:\/\/vielhuber.de\/?p=2694"},"modified":"2020-04-13T00:31:50","modified_gmt":"2020-04-12T22:31:50","slug":"quick-tip-php-clearstatcache","status":"publish","type":"post","link":"https:\/\/vielhuber.de\/blog\/quick-tip-php-clearstatcache\/","title":{"rendered":"Quick Tip: PHP clearstatcache"},"content":{"rendered":"\n<p>Finde den Fehler:<\/p>\n\n\n\n<p class=\"githubgist\" data-gist-file=\"1.php\">72aaa2dbd201d49fc2ee429ebf68f15b<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>PHP cacht die R\u00fcckgabewerte von <a href=\"https:\/\/www.php.net\/manual\/de\/function.stat.php\" target=\"_blank\" rel=\"noreferrer noopener\">stat()<\/a> und damit beispielsweise das Ergebnis von <a href=\"https:\/\/www.php.net\/manual\/de\/function.filesize.php\" target=\"_blank\" rel=\"noreferrer noopener\">filesize()<\/a>. So liefert dessen mehrfacher Aufruf auf dieselbe Datei stets den Wert des ersten Aufrufs zur\u00fcck, sodass in unserem Fall die nur die ersten drei Buchstaben ausgelesen werden.<\/p>\n\n\n\n<p>Um dieses Verhalten zu \u00e4ndern, empfiehlt es sich generell, nach jedem <a rel=\"noreferrer noopener\" href=\"https:\/\/www.php.net\/manual\/de\/function.fclose.php\" target=\"_blank\">fclose()<\/a> (oder <a rel=\"noreferrer noopener\" href=\"https:\/\/www.php.net\/manual\/de\/function.file-put-contents.php\" target=\"_blank\">file_put_contents()<\/a>) immer die Funktion <a rel=\"noreferrer noopener\" href=\"https:\/\/www.php.net\/manual\/de\/function.clearstatcache.php\" target=\"_blank\">clearstatcache()<\/a> auszuf\u00fchren, die genau diesen Cache leert:<\/p>\n\n\n\n<p class=\"githubgist\" data-gist-file=\"2.php\">72aaa2dbd201d49fc2ee429ebf68f15b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Finde den Fehler: 72aaa2dbd201d49fc2ee429ebf68f15b<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"gtbabel_prevent_lngs":"","gtbabel_alt_lng":"","footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-2694","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-blog"},"acf":[],"yoast_head":"<title>Quick Tip: PHP clearstatcache &#060; Vielhuber David<\/title>\n<meta name=\"description\" content=\"Finde den Fehler: 72aaa2dbd201d49fc2ee429ebf68f15b PHP cacht die R\u00fcckgabewerte von stat() und damit beispielsweise das Ergebnis von filesize(). So li...\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/vielhuber.de\/blog\/quick-tip-php-clearstatcache\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Quick Tip: PHP clearstatcache &#060; Vielhuber David\" \/>\n<meta property=\"og:description\" content=\"Finde den Fehler: 72aaa2dbd201d49fc2ee429ebf68f15b PHP cacht die R\u00fcckgabewerte von stat() und damit beispielsweise das Ergebnis von filesize(). So liefert\" \/>\n<meta property=\"og:url\" content=\"https:\/\/vielhuber.de\/blog\/quick-tip-php-clearstatcache\/\" \/>\n<meta property=\"og:site_name\" content=\"Vielhuber David\" \/>\n<meta property=\"article:published_time\" content=\"2020-04-12T22:26:51+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-04-12T22:31:50+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/vielhuber.de\/wp-content\/uploads\/about.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"700\" \/>\n\t<meta property=\"og:image:height\" content=\"552\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"David\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vielhuber\" \/>\n<meta name=\"twitter:site\" content=\"@vielhuber\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"David\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/quick-tip-php-clearstatcache\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/quick-tip-php-clearstatcache\\\/\"},\"author\":{\"name\":\"David\",\"@id\":\"https:\\\/\\\/vielhuber.de\\\/#\\\/schema\\\/person\\\/64d4ff14713d413ea4d9b210d0c2c6ef\"},\"headline\":\"Quick Tip: PHP clearstatcache\",\"datePublished\":\"2020-04-12T22:26:51+00:00\",\"dateModified\":\"2020-04-12T22:31:50+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/quick-tip-php-clearstatcache\\\/\"},\"wordCount\":92,\"publisher\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/#\\\/schema\\\/person\\\/64d4ff14713d413ea4d9b210d0c2c6ef\"},\"articleSection\":[\"Blog\"],\"inLanguage\":\"de\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/quick-tip-php-clearstatcache\\\/\",\"url\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/quick-tip-php-clearstatcache\\\/\",\"name\":\"Quick Tip: PHP clearstatcache &#060; Vielhuber David\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/#website\"},\"datePublished\":\"2020-04-12T22:26:51+00:00\",\"dateModified\":\"2020-04-12T22:31:50+00:00\",\"description\":\"Finde den Fehler: 72aaa2dbd201d49fc2ee429ebf68f15b PHP cacht die R\u00fcckgabewerte von stat() und damit beispielsweise das Ergebnis von filesize(). So liefert\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/quick-tip-php-clearstatcache\\\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/vielhuber.de\\\/blog\\\/quick-tip-php-clearstatcache\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/vielhuber.de\\\/blog\\\/quick-tip-php-clearstatcache\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/vielhuber.de\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Quick Tip: PHP clearstatcache\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/vielhuber.de\\\/#website\",\"url\":\"https:\\\/\\\/vielhuber.de\\\/\",\"name\":\"Vielhuber David\",\"description\":\"Full-Stack Developer\",\"publisher\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/#\\\/schema\\\/person\\\/64d4ff14713d413ea4d9b210d0c2c6ef\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/vielhuber.de\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"de\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/vielhuber.de\\\/#\\\/schema\\\/person\\\/64d4ff14713d413ea4d9b210d0c2c6ef\",\"name\":\"David\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\\\/\\\/vielhuber.de\\\/wp-content\\\/uploads\\\/about.jpg\",\"url\":\"https:\\\/\\\/vielhuber.de\\\/wp-content\\\/uploads\\\/about.jpg\",\"contentUrl\":\"https:\\\/\\\/vielhuber.de\\\/wp-content\\\/uploads\\\/about.jpg\",\"width\":700,\"height\":552,\"caption\":\"David\"},\"logo\":{\"@id\":\"https:\\\/\\\/vielhuber.de\\\/wp-content\\\/uploads\\\/about.jpg\"},\"sameAs\":[\"https:\\\/\\\/x.com\\\/vielhuber\"]}]}<\/script>","yoast_head_json":{"title":"Quick Tip: PHP clearstatcache &#060; Vielhuber David","description":"Finde den Fehler: 72aaa2dbd201d49fc2ee429ebf68f15b PHP cacht die R\u00fcckgabewerte von stat() und damit beispielsweise das Ergebnis von filesize(). So li...","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/vielhuber.de\/blog\/quick-tip-php-clearstatcache\/","og_locale":"de_DE","og_type":"article","og_title":"Quick Tip: PHP clearstatcache &#060; Vielhuber David","og_description":"Finde den Fehler: 72aaa2dbd201d49fc2ee429ebf68f15b PHP cacht die R\u00fcckgabewerte von stat() und damit beispielsweise das Ergebnis von filesize(). So liefert","og_url":"https:\/\/vielhuber.de\/blog\/quick-tip-php-clearstatcache\/","og_site_name":"Vielhuber David","article_published_time":"2020-04-12T22:26:51+00:00","article_modified_time":"2020-04-12T22:31:50+00:00","og_image":[{"width":700,"height":552,"url":"https:\/\/vielhuber.de\/wp-content\/uploads\/about.jpg","type":"image\/jpeg"}],"author":"David","twitter_card":"summary_large_image","twitter_creator":"@vielhuber","twitter_site":"@vielhuber","twitter_misc":{"Verfasst von":"David"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/vielhuber.de\/blog\/quick-tip-php-clearstatcache\/#article","isPartOf":{"@id":"https:\/\/vielhuber.de\/blog\/quick-tip-php-clearstatcache\/"},"author":{"name":"David","@id":"https:\/\/vielhuber.de\/#\/schema\/person\/64d4ff14713d413ea4d9b210d0c2c6ef"},"headline":"Quick Tip: PHP clearstatcache","datePublished":"2020-04-12T22:26:51+00:00","dateModified":"2020-04-12T22:31:50+00:00","mainEntityOfPage":{"@id":"https:\/\/vielhuber.de\/blog\/quick-tip-php-clearstatcache\/"},"wordCount":92,"publisher":{"@id":"https:\/\/vielhuber.de\/#\/schema\/person\/64d4ff14713d413ea4d9b210d0c2c6ef"},"articleSection":["Blog"],"inLanguage":"de"},{"@type":"WebPage","@id":"https:\/\/vielhuber.de\/blog\/quick-tip-php-clearstatcache\/","url":"https:\/\/vielhuber.de\/blog\/quick-tip-php-clearstatcache\/","name":"Quick Tip: PHP clearstatcache &#060; Vielhuber David","isPartOf":{"@id":"https:\/\/vielhuber.de\/#website"},"datePublished":"2020-04-12T22:26:51+00:00","dateModified":"2020-04-12T22:31:50+00:00","description":"Finde den Fehler: 72aaa2dbd201d49fc2ee429ebf68f15b PHP cacht die R\u00fcckgabewerte von stat() und damit beispielsweise das Ergebnis von filesize(). So liefert","breadcrumb":{"@id":"https:\/\/vielhuber.de\/blog\/quick-tip-php-clearstatcache\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/vielhuber.de\/blog\/quick-tip-php-clearstatcache\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/vielhuber.de\/blog\/quick-tip-php-clearstatcache\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/vielhuber.de\/"},{"@type":"ListItem","position":2,"name":"Quick Tip: PHP clearstatcache"}]},{"@type":"WebSite","@id":"https:\/\/vielhuber.de\/#website","url":"https:\/\/vielhuber.de\/","name":"Vielhuber David","description":"Full-Stack Developer","publisher":{"@id":"https:\/\/vielhuber.de\/#\/schema\/person\/64d4ff14713d413ea4d9b210d0c2c6ef"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/vielhuber.de\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"de"},{"@type":["Person","Organization"],"@id":"https:\/\/vielhuber.de\/#\/schema\/person\/64d4ff14713d413ea4d9b210d0c2c6ef","name":"David","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/vielhuber.de\/wp-content\/uploads\/about.jpg","url":"https:\/\/vielhuber.de\/wp-content\/uploads\/about.jpg","contentUrl":"https:\/\/vielhuber.de\/wp-content\/uploads\/about.jpg","width":700,"height":552,"caption":"David"},"logo":{"@id":"https:\/\/vielhuber.de\/wp-content\/uploads\/about.jpg"},"sameAs":["https:\/\/x.com\/vielhuber"]}]}},"_links":{"self":[{"href":"https:\/\/vielhuber.de\/fr\/wp-json\/wp\/v2\/posts\/2694","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vielhuber.de\/fr\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vielhuber.de\/fr\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vielhuber.de\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vielhuber.de\/fr\/wp-json\/wp\/v2\/comments?post=2694"}],"version-history":[{"count":4,"href":"https:\/\/vielhuber.de\/fr\/wp-json\/wp\/v2\/posts\/2694\/revisions"}],"predecessor-version":[{"id":2698,"href":"https:\/\/vielhuber.de\/fr\/wp-json\/wp\/v2\/posts\/2694\/revisions\/2698"}],"wp:attachment":[{"href":"https:\/\/vielhuber.de\/fr\/wp-json\/wp\/v2\/media?parent=2694"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vielhuber.de\/fr\/wp-json\/wp\/v2\/categories?post=2694"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vielhuber.de\/fr\/wp-json\/wp\/v2\/tags?post=2694"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}