File tree 2 files changed +14
-6
lines changed
2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change @@ -414,8 +414,8 @@ PHP_FUNCTION(hash_init)
414
414
415
415
#define PHP_HASHCONTEXT_VERIFY (func , hash ) { \
416
416
if (!hash->context) { \
417
- php_error(E_WARNING , "%s(): supplied resource is not a valid Hash Context resource", func); \
418
- RETURN_NULL() ; \
417
+ zend_throw_error(NULL , "%s(): supplied resource is not a valid Hash Context resource", func); \
418
+ return ; \
419
419
} \
420
420
}
421
421
@@ -585,7 +585,9 @@ PHP_FUNCTION(hash_copy)
585
585
586
586
if (php_hashcontext_from_object (Z_OBJ_P (return_value ))-> context == NULL ) {
587
587
zval_ptr_dtor (return_value );
588
- RETURN_FALSE ;
588
+
589
+ zend_throw_error (NULL , "Cannot copy hash" );
590
+ return ;
589
591
}
590
592
}
591
593
/* }}} */
Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ Hash: Attempt to reuse a closed hash context
5
5
6
6
$ h = hash_init ('md5 ' );
7
7
hash_final ($ h );
8
- hash_update ($ h , 'foo ' );
9
- --EXPECTF --
10
- Warning: hash_update(): supplied resource is not a valid Hash Context resource in %s%eext%ehash%etests%ereuse.php on line %d
8
+ try {
9
+ hash_update ($ h , 'foo ' );
10
+ }
11
+ catch (\Error $ e ) {
12
+ echo $ e ->getMessage () . "\n" ;
13
+ }
14
+
15
+ --EXPECT --
16
+ hash_update(): supplied resource is not a valid Hash Context resource
You can’t perform that action at this time.
0 commit comments