title: WordPress Comment Image plugin doesn't save uploaded image when Apache Requires are used
body: <p>I've got an Apache 2.4.7 box with a WordPress 4.1 installation and a plugin added which allows users to add images to comments on pages/posts (<a href="https://wordpress.org/plugins/comment-images/" rel="nofollow">https://wordpress.org/plugins/comment-images/</a>). The image upload feature isn't working when <code>Require</code> statements are added to restrict access to the site (it's a development environment so limited access is required).</p>
  
  <p>The image upload actually <strong>works with or without</strong> <code>Require</code> directives <strong>but</strong> when the directives are added, the reference to the uploaded image doesn't get saved to WordPress properly.</p>
  
  <p>The error from the log is:</p>
  
  <pre><code>PHP Warning:  preg_match_all() expects parameter 2 to be string, object given in /var/www/html/wp-content/plugins/comment-images/class-comment-image.php on line 480
  </code></pre>
  
  <p>I dumped the object being passed into a file (serialized):</p>
  
  <pre><code>O:8:"WP_Error":2:{s:16:"^@WP_Error^@errors";a:1:{s:8:"http_404";a:1:{i:0;s:12:"Unauthorized";}}s:20:"^@WP_Error^@error_data";a:0:{}}
  </code></pre>
  
  <p>I outputted the <code>print_debug_backtrace()</code> as well to show the calls. I've had to delete the comment data from the arrays for privacy reasons:</p>
  
  <pre><code>#0  Comment_Image-&gt;save_comment_image(63)
  #1  call_user_func_array(Array ([0] =&gt; Comment_Image Object ([] =&gt; 5000000,[] =&gt; ,[] =&gt; ),[1] =&gt; save_comment_image), Array ([0] =&gt; 63)) called at [/var/www/html/wp-includes/plugin.php:496]
  #2  do_action(wp_insert_comment, 63, stdClass Object ()) called at [/var/www/html/wp-includes/comment.php:1941]
  #3  wp_insert_comment(Array ()) called at [/var/www/html/wp-includes/comment.php:2083]
  #4  wp_new_comment(Array ()) called at [/var/www/html/wp-comments-post.php:137]
  </code></pre>
  
  <p>The directives for the <code>&lt;Directory&gt;</code> with the WP install in are (with IPs obfuscated):</p>
  
  <pre><code>AllowOverride All
  &lt;RequireAny&gt;
      AuthType Basic
      AuthName "Restricted Access"
      AuthBasicProvider file
      AuthUserFile /var/www/.htpasswd
      Require valid-user
      Require user dev www-data
      Require ip xx.xx.xx.xx/xx
      Require ip xx.xx.xx.xx
      Require local
  &lt;/RequireAny&gt;
  </code></pre>
  
  <p>If I add <code>Require all granted</code> (or just remove the <code>Require</code> directives), then the feature works as expected and uploaded images show up. Note <code>Require local</code> is there which as I understand it should cover everything for the local box.</p>
  
  <p>Things I've checked:</p>
  
  <ul>
  <li>Revised the configs in light of Apache 2.4 changes to auth modules and ordering importance etc.</li>
  <li>WordPress install folder is recursively chown'ed correctly</li>
  <li>Permissions on upload folder are 777'd, but shouldn't matter as the upload always succeeds</li>
  </ul>
  
  <p>Where does this issue lie??</p>