Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files submitted without any slash at all fail. #31

Closed
GoogleCodeExporter opened this issue Apr 10, 2016 · 2 comments
Closed

Files submitted without any slash at all fail. #31

GoogleCodeExporter opened this issue Apr 10, 2016 · 2 comments

Comments

@GoogleCodeExporter
Copy link

Lines 524-526

if(strpos($src, "/") == 0) {
    $src = substr($src, -(strlen($src) - 1));
}

Given the input "image.jpg", strpos will return false, which matches the 0
you are matching for. This is because, instead of strpos saying "there is a
slash in position 0", it is saying "there is no slash". It will be
evaluated as "if false == 0", which will come back as true. The if
statement will then execute, and it will cut the first character off $src,
despite it not being a slash. $src is now set to "mages.jpg".

Possible fix: Do an type-check (===) to make sure strpos is actually
returning an integer (0) as a position, and not a binary value (false) as a
report that there are no slashes.

Original issue reported on code.google.com by netri...@gmail.com on 10 May 2009 at 6:42

@GoogleCodeExporter
Copy link
Author

Sorry, slight inconsistency: I used "image.jpg" at the beginning of my report, 
and
assumed "images.jpg" at the end. The $src would actually be set to "mage.jpg" 
after
execution.

Original comment by netri...@gmail.com on 10 May 2009 at 6:49

@GoogleCodeExporter
Copy link
Author

a bit late but this is a valid report and I've now fixed it. Sorry it took so 
long to
sort it.

Original comment by BinaryMoon on 31 Dec 2009 at 5:02

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant