desirepath41 / visualCaptcha

visualCaptcha's Main Repo. This is a collection of all the different versions/repos of visualCaptcha.
https://emotionloop.github.io/visualCaptcha-demo/
406 stars 43 forks source link

Captcha throws an ErrorException when using strict #13

Closed ghiscoding closed 9 years ago

ghiscoding commented 9 years ago

I just found an ErrorException thrown when trying the audio and I found out that it's because on my dev machine, I am in strict mode and I get an error because of the line 302 from catpcha.php. So I basically get the following error:

Type: ErrorException
Code: 2048
Message: Only variables should be passed by reference
File: F:\BtSyncDev\htdocs\investing\api\vendor\emotionloop\visualcaptcha\src\visualCaptcha\Captcha.php
Line: 302

In order to fix this issue and get rid of the ErrorException, it simply needs to be split into 2 lines of codes (instead of 1 line) with the following:

// previous code (1 line)
$extension = end( explode('.', $filePath) );

// new fix code (2 lines)
$tmp = explode('.', $filePath);
$extension = end($tmp);

an explanation could be found here on StackOverflow : Only variables should be passed by reference

BrunoBernardino commented 9 years ago

Thanks for catching that, do you want to make a PR with it? Instead of $tmp call it $fileProperties or something more meaningful, though :)

BrunoBernardino commented 9 years ago

Version 0.0.4 has your fix, thank you very much!