{"id":1074,"date":"2009-01-09T13:32:20","date_gmt":"2009-01-09T12:32:20","guid":{"rendered":"http:\/\/blog.ginchen.de\/?p=1074"},"modified":"2009-04-12T15:51:58","modified_gmt":"2009-04-12T13:51:58","slug":"schoenheitsfehler-im-wordpress-plugin-firestats","status":"publish","type":"post","link":"http:\/\/blog.ginchen.de\/en\/2009\/01\/09\/schoenheitsfehler-im-wordpress-plugin-firestats\/","title":{"rendered":"Blemish in WordPress plugin &#8220;FireStats&#8221;"},"content":{"rendered":"<figure id=\"attachment_1440\" aria-describedby=\"caption-attachment-1440\" style=\"width: 200px\" class=\"wp-caption alignright\"><a href=\"http:\/\/blog.ginchen.de\/wp-content\/uploads\/2009\/01\/firestats.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/blog.ginchen.de\/wp-content\/uploads\/2009\/01\/firestats-200x46.png\" alt=\"FireStats\" title=\"FireStats\" width=\"200\" height=\"46\" class=\"size-thumbnail wp-image-1440\" srcset=\"http:\/\/blog.ginchen.de\/wp-content\/uploads\/2009\/01\/firestats-200x46.png 200w, http:\/\/blog.ginchen.de\/wp-content\/uploads\/2009\/01\/firestats.png 263w\" sizes=\"(max-width: 200px) 100vw, 200px\" \/><\/a><figcaption id=\"caption-attachment-1440\" class=\"wp-caption-text\">FireStats<\/figcaption><\/figure>\r\n\r\n\r\n\r\n\r\n<p>Actually I didn&#8217;t want to write about this at all, but now I see that some people googled for the very same error message that I recently got from <a  rel=\"external\" href=\"http:\/\/firestats.cc\/\">FireStats<\/a> as well:<\/p>\r\n\r\n<blockquote><p>Wrong parameter count for debug_backtrace()<\/p><\/blockquote>\r\n\r\n<p>Obviously Google combed through my site just at the time when it was littered with that unlovely error message, and thereby a couple of searchers wound up here &#8211; who probably left soon, because there is really nothing to find about that subject here. :)<br \/>\r\nSo in order to not disappoint future guests, I will quickly explain how I got rid of that error again.<\/p>\r\n\r\n\r\n<!--more-->\r\n\r\n<p>Ganz am Ende der Datei <code>firestats\/php\/utils.php<\/code> befindet sich folgende Funktion:<\/p>\r\n\r\n<pre lang=\"php\" line=\"1040\">\r\nfunction fs_called_by($function)\r\n{\r\n\t$bt = debug_backtrace(false);\r\n\tfor($i = count($bt)-1;$i >= 0;$i--)\r\n\t{\r\n\t\t$frame = $bt[$i];\r\n\t\tif ($frame['function'] == $function) return true;\r\n\t}\r\n\treturn false;\r\n}\r\n<\/pre>\r\n\r\n<p>Die Funktion <code>debug_backtrace()<\/code> hatte urspr&#252;nglich gar keine Parameter. Erst seit PHP&nbsp;5.2.5 ist es m&#246;glich, der Funktion einen Boolean-Wert, also <code>true<\/code> oder <code>false<\/code>, zu &#252;bergeben:&#8221;debug_backtrace(php.net)&#8221;:http:\/\/www.php.net\/manual\/de\/function.debug-backtrace.php . Wenn man nun aber auf seinem Server ein &#228;lteres PHP laufen hat als Version&nbsp;5.2.5 &#8211; was heutzutage durchaus noch oft vorkommt &#8211; dann kennt er nat&#252;rlich nur eine Funktion <code>debug_backtrace()<\/code> <em>ohne<\/em> Parameter. Und deshalb streikt er dann auch, wenn FireStats versucht, der Funktion einen Wert zu &#252;bergeben.<\/p>\r\n\r\n<p>Die L&#246;sung ist simpel, man mu&#223; den Parameter einfach l&#246;schen &#8211; ich wei&#223; gar nicht, warum er da &#252;berhaupt steht, er wird ja sowieso nicht gebraucht. Also einfach Zeile 1042 &#228;ndern in:<\/p>\r\n\r\n<pre lang=\"php\" line=\"1042\">$bt = debug_backtrace();<\/pre>\r\n\r\n\r\n\r\n<p>At the very end of the file <code>firestats\/php\/utils.php<\/code>, you find the following function:<\/p>\r\n\r\n<pre lang=\"php\" line=\"1040\">\r\nfunction fs_called_by($function)\r\n{\r\n\t$bt = debug_backtrace(false);\r\n\tfor($i = count($bt)-1;$i >= 0;$i--)\r\n\t{\r\n\t\t$frame = $bt[$i];\r\n\t\tif ($frame['function'] == $function) return true;\r\n\t}\r\n\treturn false;\r\n}\r\n<\/pre>\r\n\r\n<p>Originally, the function <code>debug_backtrace()<\/code> had no parameters at all. Only since PHP&nbsp;5.2.5 it is possible to pass a Boolean value, i.&nbsp;e. <code>true<\/code> or <code>false<\/code>, to the function:&#8221;debug_backtrace(php.net)&#8221;:http:\/\/www.php.net\/manual\/en\/function.debug-backtrace.php . Now, if your server is running a PHP version prior to 5.2.5 &#8211; which still occurs quite often these days &#8211; it will only know a function <code>debug_backtrace()<\/code> <em>without<\/em> any parameters. And that causes it to fail as soon as FireStats tries to pass a value to the function.<\/p>\r\n\r\n<p>The solution is simple, you only have to delete the parameter &#8211; I don&#8217;t know why it&#8217;s there anyway, it isn&#8217;t needed at all. So, just change line 1042 into:<\/p>\r\n\r\n<pre lang=\"php\" line=\"1042\">$bt = debug_backtrace();<\/pre>","protected":false},"excerpt":{"rendered":"Actually I didn&#8217;t want to write about this at all, but now I see that some people googled for the very same error message that I recently got from FireStats as well: Wrong parameter count for debug_backtrace() Obviously Google combed through my site just at the time when it was littered with that unlovely error [&hellip;]","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[77],"tags":[196,197,144,606],"_links":{"self":[{"href":"http:\/\/blog.ginchen.de\/en\/wp-json\/wp\/v2\/posts\/1074"}],"collection":[{"href":"http:\/\/blog.ginchen.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.ginchen.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.ginchen.de\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.ginchen.de\/en\/wp-json\/wp\/v2\/comments?post=1074"}],"version-history":[{"count":25,"href":"http:\/\/blog.ginchen.de\/en\/wp-json\/wp\/v2\/posts\/1074\/revisions"}],"predecessor-version":[{"id":1083,"href":"http:\/\/blog.ginchen.de\/en\/wp-json\/wp\/v2\/posts\/1074\/revisions\/1083"}],"wp:attachment":[{"href":"http:\/\/blog.ginchen.de\/en\/wp-json\/wp\/v2\/media?parent=1074"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.ginchen.de\/en\/wp-json\/wp\/v2\/categories?post=1074"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.ginchen.de\/en\/wp-json\/wp\/v2\/tags?post=1074"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}