MFB51: Fixed bug #35303 (PDO prepare() crashes with invalid parameters).

This commit is contained in:
Ilia Alshanetsky 2005-11-20 20:07:38 +00:00
parent 895e795b53
commit 9979ac2215

View File

@ -508,7 +508,7 @@ static PHP_METHOD(PDO, prepare)
PDO_CONSTRUCT_CHECK;
if (ZEND_NUM_ARGS() > 1 && SUCCESS == zend_hash_index_find(Z_ARRVAL_P(options), PDO_ATTR_STATEMENT_CLASS, (void**)&opt)) {
if (zend_hash_index_find(Z_ARRVAL_PP(opt), 0, (void**)&item) == FAILURE
if (Z_TYPE_PP(opt) != IS_ARRAY || zend_hash_index_find(Z_ARRVAL_PP(opt), 0, (void**)&item) == FAILURE
|| !PDO_ZVAL_PP_IS_TEXT(item)
|| zend_u_lookup_class(Z_TYPE_PP(item), Z_UNIVAL_PP(item), Z_UNILEN_PP(item), &pce TSRMLS_CC) == FAILURE
) {