Issues

ZF-4269: Zend_Captcha_Image should check if a file with the unique name already exists

Issue Type: Improvement Created: 2008-09-12T05:50:01.000+0000 Last Updated: 2009-06-17T14:32:52.000+0000 Status: Resolved Fix version(s): - 1.8.4 (23/Jun/09)

Reporter: Ota Mares (ota) Assignee: Stanislav Malyshev (stas) Tags: - Zend_Captcha

Related issues: Attachments: - zend_captcha_image.patch

Description

Zend_Captcha_Image should check if a file with the generated unique name already exists. On systems where there is a high load it could happen that a unique id gets generated twice. I know this is very unlikely but it could happen.

After generation of the id there should be an check if a file with that name already exists and if yes a new id should be generated. I have created a fix that i will append to this issue. If the unique id generation fails three times an exception will be thrown.

Comments

Posted by Ota Mares (ota) on 2008-09-12T05:56:18.000+0000

Added logic to the generate method to check if a filename with the generated it exists, if yes a new id will be generated. If the generation fails three times an exception will be thrown.

Posted by Ota Mares (ota) on 2008-09-12T08:28:27.000+0000

Ugh, i just saw that there is a suffix property that should be used instead of hardcoding the suffix into the path like in my patch file. Because there is no way to delete or reupload previously uploaded fixes i wont reprovide the changed verison to avoid confusion.

Posted by Stanislav Malyshev (stas) on 2008-10-23T12:30:19.000+0000

Did you actually see it happen? This requires that PHP random generator would give the same number in same microsecond for two processes. Is it a real problem?

Posted by Ota Mares (ota) on 2008-10-24T02:05:50.000+0000

I did not saw it happen but it could happen. And prevention is better then a late reaction.

Posted by Stanislav Malyshev (stas) on 2009-06-17T14:32:50.000+0000

fixed, thanks

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts