#define PHP_HASHCONTEXT_VERIFY(func, hash) { \
if (!hash->context) { \
- php_error(E_WARNING, "%s(): supplied resource is not a valid Hash Context resource", func); \
- RETURN_NULL(); \
+ zend_throw_error(NULL, "%s(): supplied resource is not a valid Hash Context resource", func); \
+ return; \
} \
}
if (php_hashcontext_from_object(Z_OBJ_P(return_value))->context == NULL) {
zval_ptr_dtor(return_value);
- RETURN_FALSE;
+
+ zend_throw_error(NULL, "Cannot copy hash");
+ return;
}
}
/* }}} */
$h = hash_init('md5');
hash_final($h);
-hash_update($h, 'foo');
---EXPECTF--
-Warning: hash_update(): supplied resource is not a valid Hash Context resource in %s%eext%ehash%etests%ereuse.php on line %d
+try {
+ hash_update($h, 'foo');
+}
+catch (\Error $e) {
+ echo $e->getMessage() . "\n";
+}
+
+--EXPECT--
+hash_update(): supplied resource is not a valid Hash Context resource