com php-src: Warnings become errors hash stream functions (other than hash_init): ext/hash/hash.c ext/hash/tests/reuse. phpt

From: Date: Thu, 29 Aug 2019 14:10:08 +0000
Subject: com php-src: Warnings become errors hash stream functions (other than hash_init): ext/hash/hash.c ext/hash/tests/reuse. phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-108135@lists.php.net to get a copy of this message
Commit: 960da6dff8e200465e0aafad26b339a54aea131e Author: Mark <mrandall@digitellinc.com> Mon, 26 Aug 2019 23:02:57 +0100 Committer: Joe Watkins <krakjoe@php.net> Thu, 29 Aug 2019 16:10:08 +0200 Parents: 14c07fef748126d634a5ef8115cf5f72b8903811 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=960da6dff8e200465e0aafad26b339a54aea131e Log: Warnings become errors hash stream functions (other than hash_init) Changed paths: M ext/hash/hash.c M ext/hash/tests/reuse.phpt Diff: diff --git a/ext/hash/hash.c b/ext/hash/hash.c index 82c27af..a26b9a3 100644 --- a/ext/hash/hash.c +++ b/ext/hash/hash.c @@ -414,8 +414,8 @@ PHP_FUNCTION(hash_init) #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; \ } \ } @@ -585,7 +585,9 @@ PHP_FUNCTION(hash_copy) 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; } } /* }}} */ diff --git a/ext/hash/tests/reuse.phpt b/ext/hash/tests/reuse.phpt index cd1419f..54ef56f 100644 --- a/ext/hash/tests/reuse.phpt +++ b/ext/hash/tests/reuse.phpt @@ -5,6 +5,12 @@ Hash: Attempt to reuse a closed hash context $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

« previous php.cvs (#108135) next »