junaidbhura / auto-cloudinary

Super simple Cloudinary auto-upload implementation for WordPress.
https://wordpress.org/plugins/auto-cloudinary/
MIT License
40 stars 9 forks source link

Wrong comparison for valid URL #16

Closed JimSeven closed 5 years ago

JimSeven commented 5 years ago

When validating the $original_url with $this->_options['upload_url'] the comparison should be made on TURE or FALSE and not on 0.

Change this in inc/class-core.php on line 86:

if (0 !== strpos($original_url, $this->_options['upload_url'])) {
     return $original_url;
}

To this:

if (strpos($original_url, $this->_options['upload_url']) !== false) {
     return $original_url;
}
junaidbhura commented 5 years ago

Hey @JimSeven the idea is to look for the URL in the beginning of the string, therefore it looks for 0 rather than boolean:

http://php.net/manual/en/function.strpos.php