{"id":3012,"date":"2019-03-23T11:19:38","date_gmt":"2019-03-23T11:19:38","guid":{"rendered":"https:\/\/www.chihayafuru.jp\/tech\/?p=3012"},"modified":"2019-03-24T01:52:23","modified_gmt":"2019-03-24T01:52:23","slug":"wordpress-bugfix-the-crayon-syntax-highlighter-with-php-7-3","status":"publish","type":"post","link":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/archives\/3012","title":{"rendered":"[WordPress] BugFix the Crayon Syntax Highlighter with PHP 7.3"},"content":{"rendered":"<p>PHP 7.3 \u3078\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u306b\u4f34\u3046\u3001WordPress\u306e\u30d7\u30e9\u30b0\u30a4\u30f3 &quot;Crayon Syntax Highlighter&quot; \u306e\u4e0d\u5177\u5408\u4fee\u6b63\u65b9\u6cd5\u3002\u3061\u306a\u307f\u306b &quot;Crayon Syntax Highlighter&quot;\u306e\u66f4\u65b0\u306f3\u5e74\u524d\u306e2016\u5e74\u4ee5\u964d\u505c\u6b62\u3057\u3066\u3044\u308b\u305f\u3081\u3001\u4ed6\u306e\u30d7\u30e9\u30b0\u30a4\u30f3\u306b\u4e57\u308a\u63db\u3048\u305f\u65b9\u304c\u8ce2\u660e\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002<\/p>\n<p>&nbsp;<\/p>\n<h3>1. [\u6df1\u523b\u306a\u4e0d\u5177\u5408] \u6b63\u898f\u8868\u73fe\u306b\u304a\u3051\u308b\u30a8\u30b9\u30b1\u30fc\u30d7\u6f0f\u308c<\/h3>\n<h4>1.1. \u30a8\u30e9\u30fc\u30ed\u30b0<\/h4>\n<pre class=\"lang:default highlight:0 decode:true \" >[23-Mar-2019 09:53:22 UTC] PHP Warning:  preg_replace(): Compilation failed: invalid range in character class at offset 4 in \/var\/www\/html\/wp-content\/plugins\/crayon-syntax-highlighter\/crayon_langs.class.php on line 340<\/pre>\n<p><!--more--><\/p>\n<h4>1.2. \u4e0d\u5177\u5408\u306e\u539f\u56e0<\/h4>\n<p>\u30cf\u30a4\u30d5\u30f3 (<code>-<\/code>) \u306f <code>'[A-Z]'<\/code> \u306e\u3088\u3046\u306b\u6587\u5b57\u306e\u7bc4\u56f2\u3092\u793a\u3059\u305f\u3081\u306e\u30e1\u30bf\u6587\u5b57\u3002\u6587\u5b57\u3068\u3057\u3066\u6271\u3046\u3068\u304d\u306f <code>'&#92;'<\/code> \u3067\u30a8\u30b9\u30b1\u30fc\u30d7\u3059\u3079\u304d\u3002<\/p>\n<h4>1.3. \u4fee\u6b63\u65b9\u6cd5 (diff)<\/h4>\n<pre class=\"lang:diff decode:true \" >--- a\/html\/wp-content\/plugins\/crayon-syntax-highlighter\/crayon_langs.class.php\r\n+++ b\/html\/wp-content\/plugins\/crayon-syntax-highlighter\/crayon_langs.class.php\r\n@@ -337,7 +337,7 @@ class CrayonLang extends CrayonVersionResource {\r\n    \/\/ Override\r\n    function clean_id($id) {\r\n         $id = CrayonUtil::space_to_hyphen( strtolower(trim($id)) );\r\n-        return preg_replace('\/[^\\w-+#]\/msi', '', $id);\r\n+        return preg_replace('\/[^\\w\\-+#]\/msi', '', $id);\r\n    }<\/pre>\n<p>&nbsp;<\/p>\n<h3>2. [\u8efd\u5fae\u306a\u4e0d\u5177\u5408] \u6587\u5b57\u5217\u306b\u5bfe\u3059\u308b\u4e0d\u9069\u5207\u306a\u6570\u5024\u6f14\u7b97<\/h3>\n<h4>2.1. \u30a8\u30e9\u30fc\u30ed\u30b0<\/h4>\n<pre class=\"lang:default highlight:0 decode:true \" >[23-Mar-2019 10:00:21 UTC] PHP Notice:  A non well formed numeric value encountered in \/var\/www\/html\/wp-content\/plugins\/crayon-syntax-highlighter\/crayon_formatter.class.php on line 118<\/pre>\n<h4>2.2. \u4e0d\u5177\u5408\u306e\u539f\u56e0<\/h4>\n<p><code>$font_size<\/code> \u306b\u306f\u6570\u5024\u3078\u306e\u5909\u63db\u304c\u3067\u304d\u306a\u3044\u6587\u5b57\uff08\u30a2\u30eb\u30d5\u30a1\u30d9\u30c3\u30c8\u306a\u3069\uff09\u304c\u542b\u307e\u308c\u3066\u3044\u308b\u3002<\/p>\n<h4>2.3. \u4fee\u6b63\u65b9\u6cd5 (diff)<\/h4>\n<pre class=\"lang:diff decode:true \" >--- a\/html\/wp-content\/plugins\/crayon-syntax-highlighter\/crayon_formatter.class.php\r\n+++ b\/html\/wp-content\/plugins\/crayon-syntax-highlighter\/crayon_formatter.class.php\r\n@@ -115,8 +115,8 @@ class CrayonFormatter {\r\n             $_line_height = $hl-&gt;setting_val(CrayonSettings::LINE_HEIGHT);\r\n             \/\/ Don't allow line height to be less than font size\r\n             $line_height = ($_line_height &gt; $_font_size ? $_line_height : $_font_size) . 'px !important;';\r\n-            $toolbar_height = $font_size * 1.5 . 'px !important;';\r\n-            $info_height = $font_size * 1.4 . 'px !important;';\r\n+            $toolbar_height = $_font_size * 1.5 . 'px !important;';\r\n+            $info_height = $_font_size * 1.4 . 'px !important;';<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PHP 7.3 \u3078\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u30a2\u30c3\u30d7\u306b\u4f34\u3046\u3001WordPress\u306e\u30d7\u30e9\u30b0\u30a4\u30f3 &quot;Crayon Syntax Highlighter&quot; \u306e\u4e0d\u5177\u5408\u4fee\u6b63\u65b9\u6cd5\u3002\u3061\u306a\u307f\u306b &quot;Crayon Syntax  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[96],"class_list":["post-3012","post","type-post","status-publish","format-standard","hentry","category-memo","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/3012","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/comments?post=3012"}],"version-history":[{"count":8,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/3012\/revisions"}],"predecessor-version":[{"id":3020,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/posts\/3012\/revisions\/3020"}],"wp:attachment":[{"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/media?parent=3012"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/categories?post=3012"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chihayafuru.jp\/tech\/index.php\/wp-json\/wp\/v2\/tags?post=3012"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}