{"id":384,"date":"2014-08-09T23:00:19","date_gmt":"2014-08-10T03:00:19","guid":{"rendered":"http:\/\/www.compdigitec.com\/labs\/?p=384"},"modified":"2014-08-09T23:00:19","modified_gmt":"2014-08-10T03:00:19","slug":"possible-crash-in-method_exists-with-php","status":"publish","type":"post","link":"http:\/\/www.compdigitec.com\/labs\/2014\/08\/09\/possible-crash-in-method_exists-with-php\/","title":{"rendered":"Possible crash in method_exists() with PHP 5.3"},"content":{"rendered":"<p>Apparently in some versions of PHP 5.3, calling method_exists() on a class which doesn&#8217;t exist seems to cause a crash. The solution, <a href=\"https:\/\/github.com\/Kunena\/Kunena-1.6\/issues\/249\">seen here<\/a>, apparently involves checking class_exists() to prevent a potentially crashing call to method_exists().<\/p>\n<p>This particular bug was causing the administration page of the <a href=\"http:\/\/wordpress.org\/plugins\/mathjax-latex\/\">MathJax-LaTeX WordPress plugin<\/a> to be blank in the admin interface.<\/p>\n<p>The trick is to replace the two lines in mathjax-latex-admin.php lines 91-92:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$wp_latex_disabled = method_exists('WP_LaTeX','init') ? &quot;disabled='true'&quot; : &quot;&quot;;\r\n$wp_latex_disabled_warning = method_exists('WP_LaTeX','init') ? &quot;Disable wp-latex to use this syntax.&quot; : &quot;&quot;;\r\n<\/pre>\n<p>with:<\/p>\n<pre class=\"brush: php; title: ; notranslate\" title=\"\">\r\n$wp_latex_disabled = (class_exists('WP_LaTeX', false) &amp;&amp; method_exists('WP_LaTeX','init')) ? &quot;disabled='true'&quot; : &quot;&quot;;\r\n$wp_latex_disabled_warning = (class_exists('WP_LaTeX', false) &amp;&amp; method_exists('WP_LaTeX','init')) ? &quot;Disable wp-latex to use this syntax.&quot; : &quot;&quot;;\r\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>Apparently in some versions of PHP 5.3, calling method_exists() on a class which doesn&#8217;t exist seems to cause a crash. The solution, seen here, apparently involves checking class_exists() to prevent a potentially crashing call to method_exists(). This particular bug was causing the administration page of the MathJax-LaTeX WordPress plugin to be blank in the admin [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[859,858,860,864,861],"_links":{"self":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/384"}],"collection":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/comments?post=384"}],"version-history":[{"count":0,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/posts\/384\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/media?parent=384"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/categories?post=384"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.compdigitec.com\/labs\/wp-json\/wp\/v2\/tags?post=384"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}