{"id":4711505,"date":"2014-03-16T00:50:30","date_gmt":"2014-03-16T00:50:30","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/incfunctionsip_in_rangephp-throws-error-when-exploded-array-lacks-2nd-val\/"},"modified":"2016-08-21T17:19:25","modified_gmt":"2016-08-21T17:19:25","slug":"incfunctionsip_in_rangephp-throws-error-when-exploded-array-lacks-2nd-val","status":"closed","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/incfunctionsip_in_rangephp-throws-error-when-exploded-array-lacks-2nd-val\/","title":{"rendered":"inc\/functions\/ip_in_range.php throws error when exploded array lacks 2nd val"},"content":{"rendered":"<p>I had to modify this<\/p>\n<pre><code>$pieces = explode (&quot;\/&quot;, $range_ip, 2);\n    $left_piece = $pieces[0];\n    $right_piece = $pieces[1];\n\n\/\/ Extract out the main IP pieces\n    $ip_pieces = explode(&quot;::&quot;, $left_piece, 2);\n    $main_ip_piece = $ip_pieces[0];\n    $last_ip_piece = $ip_pieces[1];<\/code><\/pre>\n<p>to something like this<\/p>\n<pre><code>$pieces = explode (&quot;\/&quot;, $range_ip, 2);\n\tif (count($pieces) &gt; 0)\n    $left_piece = $pieces[0];\n\tif (count($pieces) &gt; 1)\n    $right_piece = $pieces[1];\n\n\/\/ Extract out the main IP pieces\n    $ip_pieces = explode(&quot;::&quot;, $left_piece, 2);\n\tif (count($ip_pieces) &gt; 0)\n    $main_ip_piece = $ip_pieces[0];\n\tif (count($ip_pieces) &gt; 1)\n    $last_ip_piece = $ip_pieces[1];<\/code><\/pre>\n<p>and this<br \/>\n<code>if (trim($last_ip_piece) != &quot;&quot;) {<\/code><\/p>\n<p>to something like this<br \/>\n<code>if (isset($last_ip_piece) &amp;&amp; trim($last_ip_piece) != &quot;&quot;) {<\/code><\/p>\n<p>in two of the functions.<\/p>\n<p>https:\/\/wordpress.org\/plugins\/w3-total-cache\/<\/p>\n","protected":false},"template":"","class_list":["post-4711505","topic","type-topic","status-closed","hentry"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/4711505","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\/4711505\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=4711505"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}