|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-09-25 21:51 UTC] terrafrost@php.net
Description: ------------ Calling mcrypt_generic_init() with bad values changes the resource type from mcrypt to Unknown. It seems like what should happen is that the resource type should remain the same and that mcrypt_generic_init should simply do nothing. Maybe output a warning (as it currently does) but not change the resource type. A bad call to curl_setopt(), for example, doesn't change the resource type from curl to Unknown as demonstrated thusly: <?php $curl = curl_init(); @curl_setopt($curl); var_dump($curl); ?> Per that it doesn't seem like a bad call to mcrypt_generic_init() ought to change anything either. Test script: --------------- <?php $mcrypt = @mcrypt_module_open(MCRYPT_DES, '', MCRYPT_MODE_ECB, ''); @mcrypt_generic_init($mcrypt, '', ''); var_dump($mcrypt); ?> Expected result: ---------------- resource(4) of type (mcrypt) Actual result: -------------- resource(4) of type (Unknown) PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 12:00:01 2025 UTC |
According to the code, this is required to prevent possible crash. See: result = mcrypt_generic_init(pm->td, key_s, key_size, iv_s); /* If this function fails, close the mcrypt module to prevent crashes * when further functions want to access this resource */ if (result < 0) { zend_list_delete(Z_LVAL_P(mcryptind));