{"id":17986443,"date":"2024-08-31T01:06:34","date_gmt":"2024-08-31T01:06:34","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/windows-undefined-array-key\/"},"modified":"2024-08-31T01:06:34","modified_gmt":"2024-08-31T01:06:34","slug":"windows-undefined-array-key","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/windows-undefined-array-key\/","title":{"rendered":"Windows &#8211; Undefined array key"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Hi,<br \/>First of all, awesome plugin, use it every day in my workjob \ud83d\ude42<br \/><br \/>An annoying issue i&#8217;ve found is that QM is spamming my <strong>debug.log<\/strong> with this when i go to the frontend:<br \/><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code>&#091;31-Aug-2024 <em>00:51:38<\/em> UTC] PHP Warning: &nbsp;Undefined array key \"C:\/laragon_new\/www\/XXX\/wp-content\/themes\/XXX\/parts\/header.html\" in C:\\laragon_new\\www\\XXX\\wp-content\\plugins\\query-monitor\\output\\html\\theme.php on line 163<br \/>&#091;31-Aug-2024 <em>00:51:38<\/em> UTC] PHP Warning: &nbsp;Undefined array key \"C:\/laragon_new\/www\/XXX\/wp-content\/themes\/XXX\/parts\/footer.html\" in C:\\laragon_new\\www\\XXX\\wp-content\\plugins\\query-monitor\\output\\html\\theme.php on line 163<\/code><\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><br \/>For info, <strong>i use PHP 8.3<\/strong> at the moment but i don&#8217;t think <em>(not quite sure)<\/em> that&#8217;s it&#8217;s related.<br \/>What i found out is that QM seems to be collecting data differently about &#8220;paths&#8221; on Windows (which is causing the PHP Warnings.<br \/><br \/>When i log <strong>$parts<\/strong> and <strong>$data-&gt;count_template_parts<\/strong>, i can clearly see that <strong>one is using forward slashes<\/strong> but the <strong>other one<\/strong> <strong>is using a mix<\/strong>, the logs:<br \/><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#091;31-Aug-2024 00:59:27 UTC] DEBUG: $parts Array<br \/>(<br \/>&#091;C:\/laragon_new\/www\/XXX\/wp-content\/themes\/XXX\/parts\/header.html] =&gt; parts\/header.html<br \/>&#091;C:\/laragon_new\/www\/XXX\/wp-content\/themes\/XXX\/parts\/footer.html] =&gt; parts\/footer.html<br \/>)<br \/>&#091;31-Aug-2024 00:59:27 UTC] DEBUG: $data-&gt;count_template_parts Array<br \/>(<br \/>&#091;C:\\laragon_new\\www\\XXX\/wp-content\/themes\/XXX\/parts\/header.html] =&gt; 1<br \/>&#091;C:\\laragon_new\\www\\XXX\/wp-content\/themes\/XXX\/parts\/footer.html] =&gt; 1<br \/>)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><br \/>If you have an idea on how to fix this, that would be great \ud83d\ude42<br \/><br \/>Have a good day,<br \/>Damien<\/p>\n","protected":false},"template":"","class_list":["post-17986443","topic","type-topic","status-publish","hentry","topic-tag-array","topic-tag-key","topic-tag-path","topic-tag-undefined","topic-tag-windows"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17986443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/17986443\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=17986443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}