diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-05-31 11:51:54 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-06-03 09:17:12 +0200 |
commit | 1df8175b6153865e2f12394792e3ad4c7c8e48ea (patch) | |
tree | 7a5dc832d7457a180570e298761abf946dbabe3a | |
parent | 29d79dc2e55844cb42f975ef2f0c21aedbfef183 (diff) | |
download | php-git-1df8175b6153865e2f12394792e3ad4c7c8e48ea.tar.gz |
Convert fetch_resource warnings into TypeErrors
More type checks that are not part of zpp and should generate a
TypeError in PHP 8.
88 files changed, 958 insertions, 889 deletions
diff --git a/Zend/zend_list.c b/Zend/zend_list.c index b37c98185a..10293753bd 100644 --- a/Zend/zend_list.c +++ b/Zend/zend_list.c @@ -113,7 +113,7 @@ ZEND_API void *zend_fetch_resource2(zend_resource *res, const char *resource_typ if (resource_type_name) { const char *space; const char *class_name = get_active_class_name(&space); - zend_error(E_WARNING, "%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name); + zend_type_error("%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name); } return NULL; @@ -128,7 +128,7 @@ ZEND_API void *zend_fetch_resource(zend_resource *res, const char *resource_type if (resource_type_name) { const char *space; const char *class_name = get_active_class_name(&space); - zend_error(E_WARNING, "%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name); + zend_type_error("%s%s%s(): supplied resource is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name); } return NULL; @@ -140,14 +140,14 @@ ZEND_API void *zend_fetch_resource_ex(zval *res, const char *resource_type_name, if (res == NULL) { if (resource_type_name) { class_name = get_active_class_name(&space); - zend_error(E_WARNING, "%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(), resource_type_name); + zend_type_error("%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(), resource_type_name); } return NULL; } if (Z_TYPE_P(res) != IS_RESOURCE) { if (resource_type_name) { class_name = get_active_class_name(&space); - zend_error(E_WARNING, "%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name); + zend_type_error("%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name); } return NULL; } @@ -161,14 +161,14 @@ ZEND_API void *zend_fetch_resource2_ex(zval *res, const char *resource_type_name if (res == NULL) { if (resource_type_name) { class_name = get_active_class_name(&space); - zend_error(E_WARNING, "%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(), resource_type_name); + zend_type_error("%s%s%s(): no %s resource supplied", class_name, space, get_active_function_name(), resource_type_name); } return NULL; } if (Z_TYPE_P(res) != IS_RESOURCE) { if (resource_type_name) { class_name = get_active_class_name(&space); - zend_error(E_WARNING, "%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name); + zend_type_error("%s%s%s(): supplied argument is not a valid %s resource", class_name, space, get_active_function_name(), resource_type_name); } return NULL; } diff --git a/ext/bz2/tests/004.phpt b/ext/bz2/tests/004.phpt index 8ddefe7404..b9fa649b58 100644 --- a/ext/bz2/tests/004.phpt +++ b/ext/bz2/tests/004.phpt @@ -36,14 +36,30 @@ var_dump(bzerrstr($fd2)); var_dump(bzerrno($fd2)); bzclose($fd2); -var_dump(bzread($fd2)); -var_dump(bzerror($fd2)); -var_dump(bzerrstr($fd2)); -var_dump(bzerrno($fd2)); +try { + var_dump(bzread($fd2)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(bzerror($fd2)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(bzerrstr($fd2)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(bzerrno($fd2)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- array(2) { ["errno"]=> int(0) @@ -96,16 +112,8 @@ array(2) { } string(10) "DATA_ERROR" int(-4) - -Warning: bzread(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: bzerror(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: bzerrstr(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: bzerrno(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +bzread(): supplied resource is not a valid stream resource +bzerror(): supplied resource is not a valid stream resource +bzerrstr(): supplied resource is not a valid stream resource +bzerrno(): supplied resource is not a valid stream resource Done diff --git a/ext/curl/tests/curl_multi_close_basic001.phpt b/ext/curl/tests/curl_multi_close_basic001.phpt index 0cabf2cbad..cf47668b30 100644 --- a/ext/curl/tests/curl_multi_close_basic001.phpt +++ b/ext/curl/tests/curl_multi_close_basic001.phpt @@ -11,15 +11,17 @@ var_dump($cmh); $multi_close_result = curl_multi_close($cmh); var_dump($multi_close_result); var_dump($cmh); -$bad_mh_close_result = curl_multi_close($cmh); -var_dump($bad_mh_close_result); +try { + $bad_mh_close_result = curl_multi_close($cmh); + var_dump($bad_mh_close_result); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== --EXPECTF-- resource(%d) of type (curl_multi) NULL resource(%d) of type (Unknown) - -Warning: curl_multi_close(): supplied resource is not a valid cURL Multi Handle resource in %s on line %d -bool(false) +curl_multi_close(): supplied resource is not a valid cURL Multi Handle resource ===DONE=== diff --git a/ext/fileinfo/tests/finfo_close_error.phpt b/ext/fileinfo/tests/finfo_close_error.phpt index 865fa567b2..789fc1014d 100644 --- a/ext/fileinfo/tests/finfo_close_error.phpt +++ b/ext/fileinfo/tests/finfo_close_error.phpt @@ -14,15 +14,17 @@ echo "*** Testing finfo_close() : error conditions ***\n"; echo "\n-- Testing finfo_close() function with wrong resource type --\n"; $fp = fopen( __FILE__, 'r' ); -var_dump( finfo_close( $fp ) ); +try { + var_dump( finfo_close( $fp ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing finfo_close() : error conditions *** -- Testing finfo_close() function with wrong resource type -- - -Warning: finfo_close(): supplied resource is not a valid file_info resource in %s on line %d -bool(false) +finfo_close(): supplied resource is not a valid file_info resource ===DONE=== diff --git a/ext/ftp/tests/007.phpt b/ext/ftp/tests/007.phpt index eebe8cf1e3..0520b37293 100644 --- a/ext/ftp/tests/007.phpt +++ b/ext/ftp/tests/007.phpt @@ -11,138 +11,205 @@ require 'skipif.inc'; <?php $ftp = tmpfile(); -var_dump(ftp_login($ftp, 'user', 'pass')); -var_dump(ftp_pwd($ftp)); -var_dump(ftp_cdup($ftp)); -var_dump(ftp_chdir($ftp, '~')); -var_dump(ftp_exec($ftp, 'x')); -var_dump(ftp_raw($ftp, 'x')); -var_dump(ftp_mkdir($ftp, '/')); -var_dump(ftp_rmdir($ftp, '/')); -var_dump(ftp_chmod($ftp, 7777, '/')); -var_dump(ftp_alloc($ftp, 7777)); -var_dump(ftp_nlist($ftp, '/')); -var_dump(ftp_rawlist($ftp, '~')); -var_dump(ftp_mlsd($ftp, '~')); -var_dump(ftp_systype($ftp)); -var_dump(ftp_fget($ftp, $ftp, 'remote', 7777)); -var_dump(ftp_nb_fget($ftp, $ftp, 'remote', 7777)); -var_dump(ftp_pasv($ftp, false)); -var_dump(ftp_get($ftp, 'local', 'remote', 7777)); -var_dump(ftp_nb_get($ftp, 'local', 'remote', 7777)); -var_dump(ftp_nb_continue($ftp)); -var_dump(ftp_fput($ftp, 'remote', $ftp, 9999)); -var_dump(ftp_nb_fput($ftp, 'remote', $ftp, 9999)); -var_dump(ftp_put($ftp, 'remote', 'local', 9999)); -var_dump(ftp_append($ftp, 'remote', 'local', 9999)); -var_dump(ftp_nb_put($ftp, 'remote', 'local', 9999)); -var_dump(ftp_size($ftp, '~')); -var_dump(ftp_mdtm($ftp, '~')); -var_dump(ftp_rename($ftp, 'old', 'new')); -var_dump(ftp_delete($ftp, 'gone')); -var_dump(ftp_site($ftp, 'localhost')); -var_dump(ftp_close($ftp)); -var_dump(ftp_set_option($ftp, 1, 2)); -var_dump(ftp_get_option($ftp, 1)); +try { + var_dump(ftp_login($ftp, 'user', 'pass')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_pwd($ftp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_cdup($ftp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_chdir($ftp, '~')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_exec($ftp, 'x')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_raw($ftp, 'x')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_mkdir($ftp, '/')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_rmdir($ftp, '/')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_chmod($ftp, 7777, '/')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_alloc($ftp, 7777)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_nlist($ftp, '/')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_rawlist($ftp, '~')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_mlsd($ftp, '~')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_systype($ftp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_fget($ftp, $ftp, 'remote', 7777)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_nb_fget($ftp, $ftp, 'remote', 7777)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_pasv($ftp, false)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_get($ftp, 'local', 'remote', 7777)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_nb_get($ftp, 'local', 'remote', 7777)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_nb_continue($ftp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_fput($ftp, 'remote', $ftp, 9999)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_nb_fput($ftp, 'remote', $ftp, 9999)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_put($ftp, 'remote', 'local', 9999)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_append($ftp, 'remote', 'local', 9999)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_nb_put($ftp, 'remote', 'local', 9999)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_size($ftp, '~')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_mdtm($ftp, '~')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_rename($ftp, 'old', 'new')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_delete($ftp, 'gone')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_site($ftp, 'localhost')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_close($ftp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_set_option($ftp, 1, 2)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(ftp_get_option($ftp, 1)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} fclose($ftp); ?> ---EXPECTF-- -Warning: ftp_login(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_pwd(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_cdup(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_chdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_exec(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_raw(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_mkdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_rmdir(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_chmod(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_alloc(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_nlist(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_rawlist(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_mlsd(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_systype(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_fget(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_nb_fget(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_pasv(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_get(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_nb_get(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_nb_continue(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_fput(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_nb_fput(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_put(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_append(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_nb_put(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_size(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_mdtm(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_rename(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_delete(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_site(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_close(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_set_option(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) - -Warning: ftp_get_option(): supplied resource is not a valid FTP Buffer resource in %s007.php on line %d -bool(false) +--EXPECT-- +ftp_login(): supplied resource is not a valid FTP Buffer resource +ftp_pwd(): supplied resource is not a valid FTP Buffer resource +ftp_cdup(): supplied resource is not a valid FTP Buffer resource +ftp_chdir(): supplied resource is not a valid FTP Buffer resource +ftp_exec(): supplied resource is not a valid FTP Buffer resource +ftp_raw(): supplied resource is not a valid FTP Buffer resource +ftp_mkdir(): supplied resource is not a valid FTP Buffer resource +ftp_rmdir(): supplied resource is not a valid FTP Buffer resource +ftp_chmod(): supplied resource is not a valid FTP Buffer resource +ftp_alloc(): supplied resource is not a valid FTP Buffer resource +ftp_nlist(): supplied resource is not a valid FTP Buffer resource +ftp_rawlist(): supplied resource is not a valid FTP Buffer resource +ftp_mlsd(): supplied resource is not a valid FTP Buffer resource +ftp_systype(): supplied resource is not a valid FTP Buffer resource +ftp_fget(): supplied resource is not a valid FTP Buffer resource +ftp_nb_fget(): supplied resource is not a valid FTP Buffer resource +ftp_pasv(): supplied resource is not a valid FTP Buffer resource +ftp_get(): supplied resource is not a valid FTP Buffer resource +ftp_nb_get(): supplied resource is not a valid FTP Buffer resource +ftp_nb_continue(): supplied resource is not a valid FTP Buffer resource +ftp_fput(): supplied resource is not a valid FTP Buffer resource +ftp_nb_fput(): supplied resource is not a valid FTP Buffer resource +ftp_put(): supplied resource is not a valid FTP Buffer resource +ftp_append(): supplied resource is not a valid FTP Buffer resource +ftp_nb_put(): supplied resource is not a valid FTP Buffer resource +ftp_size(): supplied resource is not a valid FTP Buffer resource +ftp_mdtm(): supplied resource is not a valid FTP Buffer resource +ftp_rename(): supplied resource is not a valid FTP Buffer resource +ftp_delete(): supplied resource is not a valid FTP Buffer resource +ftp_site(): supplied resource is not a valid FTP Buffer resource +ftp_close(): supplied resource is not a valid FTP Buffer resource +ftp_set_option(): supplied resource is not a valid FTP Buffer resource +ftp_get_option(): supplied resource is not a valid FTP Buffer resource diff --git a/ext/gd/tests/imageantialias_error1.phpt b/ext/gd/tests/imageantialias_error1.phpt index 8a9d5315a6..d74a2ad9a2 100644 --- a/ext/gd/tests/imageantialias_error1.phpt +++ b/ext/gd/tests/imageantialias_error1.phpt @@ -11,8 +11,11 @@ if (!extension_loaded("gd")) die("skip GD not present"); <?php $image = tmpfile(); -var_dump(imageantialias($image, true)); +try { + var_dump(imageantialias($image, true)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imageantialias(): supplied resource is not a valid Image resource in %s on line %d -bool(false) +--EXPECT-- +imageantialias(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagechar_error2.phpt b/ext/gd/tests/imagechar_error2.phpt index 1666788ead..a829282307 100644 --- a/ext/gd/tests/imagechar_error2.phpt +++ b/ext/gd/tests/imagechar_error2.phpt @@ -10,8 +10,12 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php -$result = imagechar(tmpfile(), 1, 5, 5, 'C', 1); +try { + $result = imagechar(tmpfile(), 1, 5, 5, 'C', 1); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagechar(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imagechar(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagecharup_error2.phpt b/ext/gd/tests/imagecharup_error2.phpt index e2db7bb558..f8b0bc4ebf 100644 --- a/ext/gd/tests/imagecharup_error2.phpt +++ b/ext/gd/tests/imagecharup_error2.phpt @@ -10,8 +10,12 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php -$result = imagecharup(tmpfile(), 1, 5, 5, 'C', 1); +try { + $result = imagecharup(tmpfile(), 1, 5, 5, 'C', 1); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagecharup(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imagecharup(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagecolorallocatealpha_error1.phpt b/ext/gd/tests/imagecolorallocatealpha_error1.phpt index cdc83d8479..ea490dd526 100644 --- a/ext/gd/tests/imagecolorallocatealpha_error1.phpt +++ b/ext/gd/tests/imagecolorallocatealpha_error1.phpt @@ -9,7 +9,11 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php $resource = tmpfile(); -imagecolorallocatealpha($resource, 255, 255, 255, 50); +try { + imagecolorallocatealpha($resource, 255, 255, 255, 50); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagecolorallocatealpha(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imagecolorallocatealpha(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagecolordeallocate_error1.phpt b/ext/gd/tests/imagecolordeallocate_error1.phpt index 82460139b6..3c75055a5f 100644 --- a/ext/gd/tests/imagecolordeallocate_error1.phpt +++ b/ext/gd/tests/imagecolordeallocate_error1.phpt @@ -15,8 +15,12 @@ $white = imagecolorallocate($image, 255, 255, 255); $resource = tmpfile(); -$result = imagecolordeallocate($resource, $white); +try { + $result = imagecolordeallocate($resource, $white); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagecolordeallocate(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imagecolordeallocate(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagecolorstotal_error.phpt b/ext/gd/tests/imagecolorstotal_error.phpt index 328cf12e7c..e05c6894db 100644 --- a/ext/gd/tests/imagecolorstotal_error.phpt +++ b/ext/gd/tests/imagecolorstotal_error.phpt @@ -22,16 +22,18 @@ echo "*** Testing imagecolorstotal() : error conditions ***\n"; $im = fopen(__FILE__, 'r'); echo "\n-- Testing imagecolorstotal() function with a invalid resource\n"; -var_dump( imagecolorstotal($im) ); +try { + var_dump( imagecolorstotal($im) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} fclose($im); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- *** Testing imagecolorstotal() : error conditions *** -- Testing imagecolorstotal() function with a invalid resource - -Warning: imagecolorstotal(): supplied resource is not a valid Image resource in %s on line %d -bool(false) +imagecolorstotal(): supplied resource is not a valid Image resource ===DONE=== diff --git a/ext/gd/tests/imageellipse_error7.phpt b/ext/gd/tests/imageellipse_error7.phpt index 0b4c1f549d..bc78875d3d 100644 --- a/ext/gd/tests/imageellipse_error7.phpt +++ b/ext/gd/tests/imageellipse_error7.phpt @@ -14,7 +14,11 @@ if (!extension_loaded("gd")) die("skip GD not present"); $image = tmpfile(); // try to draw a white ellipse -imageellipse($image, 200, 150, 300, 200, 16777215); +try { + imageellipse($image, 200, 150, 300, 200, 16777215); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imageellipse(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imageellipse(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagefilltoborder_error6.phpt b/ext/gd/tests/imagefilltoborder_error6.phpt index 421c5932ee..5a77db798e 100644 --- a/ext/gd/tests/imagefilltoborder_error6.phpt +++ b/ext/gd/tests/imagefilltoborder_error6.phpt @@ -20,8 +20,12 @@ imageellipse( $image, 50, 50, 50, 50, imagecolorallocate( $image, 0, 0, 0 ) ); // Try to fill border $image_foo = tmpfile(); -imagefilltoborder( $image_foo, 50, 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) ); +try { + imagefilltoborder( $image_foo, 50, 50, imagecolorallocate( $image, 0, 0, 0 ), imagecolorallocate( $image, 255, 0, 0 ) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagefilltoborder(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imagefilltoborder(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagefilter_error10.phpt b/ext/gd/tests/imagefilter_error10.phpt index 0cea9aa3c1..07aecee632 100644 --- a/ext/gd/tests/imagefilter_error10.phpt +++ b/ext/gd/tests/imagefilter_error10.phpt @@ -11,8 +11,11 @@ if (!extension_loaded("gd")) die("skip GD not present"); <?php $image = tmpfile(); -var_dump(imagefilter($image, IMG_FILTER_EMBOSS)); +try { + var_dump(imagefilter($image, IMG_FILTER_EMBOSS)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d -bool(false) +--EXPECT-- +imagefilter(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagefilter_error11.phpt b/ext/gd/tests/imagefilter_error11.phpt deleted file mode 100644 index 2f162045b8..0000000000 --- a/ext/gd/tests/imagefilter_error11.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter resource passing of EDGEDETECT in imagefilter() of GD library ---CREDITS-- -Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$image = tmpfile(); - -var_dump(imagefilter($image, IMG_FILTER_EDGEDETECT)); -?> ---EXPECTF-- -Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error12.phpt b/ext/gd/tests/imagefilter_error12.phpt deleted file mode 100644 index 29664518a0..0000000000 --- a/ext/gd/tests/imagefilter_error12.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter resource of COLORIZE in imagefilter() of GD library ---CREDITS-- -Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$image = tmpfile(); - -var_dump(imagefilter($image, IMG_FILTER_COLORIZE, 255, 255, 255)); -?> ---EXPECTF-- -Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error15.phpt b/ext/gd/tests/imagefilter_error15.phpt deleted file mode 100644 index 9c76bf24ab..0000000000 --- a/ext/gd/tests/imagefilter_error15.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter resource of CONTRAST in imagefilter() of GD library ---CREDITS-- -Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$image = tmpfile(); - -var_dump(imagefilter($image, IMG_FILTER_CONTRAST, 2)); -?> ---EXPECTF-- -Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error17.phpt b/ext/gd/tests/imagefilter_error17.phpt deleted file mode 100644 index 9a3ba39439..0000000000 --- a/ext/gd/tests/imagefilter_error17.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter resource of GRAYSCALE in imagefilter() of GD library ---CREDITS-- -Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$image = tmpfile(); - -var_dump(imagefilter($image, IMG_FILTER_GRAYSCALE)); -?> ---EXPECTF-- -Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error18.phpt b/ext/gd/tests/imagefilter_error18.phpt deleted file mode 100644 index d96d02426f..0000000000 --- a/ext/gd/tests/imagefilter_error18.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter resource of NEGATE in imagefilter() of GD library ---CREDITS-- -Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$image = tmpfile(); - -var_dump(imagefilter($image, IMG_FILTER_NEGATE)); -?> ---EXPECTF-- -Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error20.phpt b/ext/gd/tests/imagefilter_error20.phpt deleted file mode 100644 index f1a330dbed..0000000000 --- a/ext/gd/tests/imagefilter_error20.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter resource of BRIGHTNESS in imagefilter() of GD library ---CREDITS-- -Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$image = tmpfile(); - -var_dump(imagefilter($image, IMG_FILTER_BRIGHTNESS, 1)); -?> ---EXPECTF-- -Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error4.phpt b/ext/gd/tests/imagefilter_error4.phpt deleted file mode 100644 index f60ce11b42..0000000000 --- a/ext/gd/tests/imagefilter_error4.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter resource of PIXELATE in imagefilter() of GD library ---CREDITS-- -Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$image = tmpfile(); - -var_dump(imagefilter($image, IMG_FILTER_PIXELATE, 3)); -?> ---EXPECTF-- -Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error6.phpt b/ext/gd/tests/imagefilter_error6.phpt deleted file mode 100644 index 1ace03cba3..0000000000 --- a/ext/gd/tests/imagefilter_error6.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter resource of SMOOTH in imagefilter() of GD library ---CREDITS-- -Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$image = tmpfile(); - -var_dump(imagefilter($image, IMG_FILTER_SMOOTH, 3.0)); -?> ---EXPECTF-- -Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error7.phpt b/ext/gd/tests/imagefilter_error7.phpt deleted file mode 100644 index 4e095801e8..0000000000 --- a/ext/gd/tests/imagefilter_error7.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter resource of MEAN_REMOVAL in imagefilter() of GD library ---CREDITS-- -Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$image = tmpfile(); - -var_dump(imagefilter($image, IMG_FILTER_MEAN_REMOVAL)); -?> ---EXPECTF-- -Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error8.phpt b/ext/gd/tests/imagefilter_error8.phpt deleted file mode 100644 index 5086e6421d..0000000000 --- a/ext/gd/tests/imagefilter_error8.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter resource of SELECTIVE_BLUR in imagefilter() of GD library ---CREDITS-- -Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$image = tmpfile(); - -var_dump(imagefilter($image, IMG_FILTER_SELECTIVE_BLUR)); -?> ---EXPECTF-- -Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagefilter_error9.phpt b/ext/gd/tests/imagefilter_error9.phpt deleted file mode 100644 index 268a65f0f7..0000000000 --- a/ext/gd/tests/imagefilter_error9.phpt +++ /dev/null @@ -1,18 +0,0 @@ ---TEST-- -Testing wrong parameter resource of GAUSSIAN_BLUR in imagefilter() of GD library ---CREDITS-- -Guilherme Blanco <guilhermeblanco [at] hotmail [dot] com> -#testfest PHPSP on 2009-06-20 ---SKIPIF-- -<?php -if (!extension_loaded("gd")) die("skip GD not present"); -?> ---FILE-- -<?php -$image = tmpfile(); - -var_dump(imagefilter($image, IMG_FILTER_GAUSSIAN_BLUR)); -?> ---EXPECTF-- -Warning: imagefilter(): supplied resource is not a valid Image resource in %s on line %d -bool(false) diff --git a/ext/gd/tests/imagegammacorrect_error2.phpt b/ext/gd/tests/imagegammacorrect_error2.phpt index fd6d136ae8..013dd67b9a 100644 --- a/ext/gd/tests/imagegammacorrect_error2.phpt +++ b/ext/gd/tests/imagegammacorrect_error2.phpt @@ -10,8 +10,12 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php $image = tmpfile(); -$gamma = imagegammacorrect($image, 1, 5); +try { + $gamma = imagegammacorrect($image, 1, 5); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagegammacorrect(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imagegammacorrect(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imageinterlace_error2.phpt b/ext/gd/tests/imageinterlace_error2.phpt index e20f3ae901..e906c61261 100644 --- a/ext/gd/tests/imageinterlace_error2.phpt +++ b/ext/gd/tests/imageinterlace_error2.phpt @@ -10,8 +10,11 @@ if (!extension_loaded("gd")) die("skip GD not present"); --FILE-- <?php $image = fopen('php://stdin', 'r'); -var_dump(imageinterlace($image)); +try { + var_dump(imageinterlace($image)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imageinterlace(): supplied resource is not a valid Image resource in %s on line %d -bool(false) +--EXPECT-- +imageinterlace(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imageistruecolor_error1.phpt b/ext/gd/tests/imageistruecolor_error1.phpt index e2364bcec6..b99dd93b00 100644 --- a/ext/gd/tests/imageistruecolor_error1.phpt +++ b/ext/gd/tests/imageistruecolor_error1.phpt @@ -10,7 +10,11 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php $resource = tmpfile(); -imageistruecolor($resource); +try { + imageistruecolor($resource); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imageistruecolor(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imageistruecolor(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagelayereffect_error3.phpt b/ext/gd/tests/imagelayereffect_error3.phpt index 63d1e0e951..c3b793c45d 100644 --- a/ext/gd/tests/imagelayereffect_error3.phpt +++ b/ext/gd/tests/imagelayereffect_error3.phpt @@ -11,7 +11,11 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php $resource = tmpfile(); -$layer = imagelayereffect($resource, IMG_EFFECT_REPLACE); +try { + $layer = imagelayereffect($resource, IMG_EFFECT_REPLACE); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagelayereffect(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imagelayereffect(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagepalettetotruecolor_error3.phpt b/ext/gd/tests/imagepalettetotruecolor_error3.phpt index 42a7e71773..09a7d9ab06 100644 --- a/ext/gd/tests/imagepalettetotruecolor_error3.phpt +++ b/ext/gd/tests/imagepalettetotruecolor_error3.phpt @@ -9,7 +9,11 @@ Carlos André Ferrari <caferrari [at] gmail [dot] com> --FILE-- <?php $im = fopen('php://memory', 'w'); -imagepalettetotruecolor($im); +try { + imagepalettetotruecolor($im); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagepalettetotruecolor(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imagepalettetotruecolor(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagerectangle_error2.phpt b/ext/gd/tests/imagerectangle_error2.phpt index 4e2e665bda..fdc4678d57 100644 --- a/ext/gd/tests/imagerectangle_error2.phpt +++ b/ext/gd/tests/imagerectangle_error2.phpt @@ -13,7 +13,11 @@ if ( ! extension_loaded('gd') ) die( 'skip GD not present; skipping test' ); $image = tmpfile(); // Draw a rectangle -imagerectangle( $image, 0, 0, 50, 50, 2 ); +try { + imagerectangle( $image, 0, 0, 50, 50, 2 ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagerectangle(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imagerectangle(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagesetthickness_error1.phpt b/ext/gd/tests/imagesetthickness_error1.phpt index 2542444c87..a9ee7f9fcc 100644 --- a/ext/gd/tests/imagesetthickness_error1.phpt +++ b/ext/gd/tests/imagesetthickness_error1.phpt @@ -9,7 +9,11 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php $resource = tmpfile(); -imagesetthickness($resource, 5); +try { + imagesetthickness($resource, 5); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagesetthickness(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imagesetthickness(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagestring_error2.phpt b/ext/gd/tests/imagestring_error2.phpt index e4b22651c6..ff9032a312 100644 --- a/ext/gd/tests/imagestring_error2.phpt +++ b/ext/gd/tests/imagestring_error2.phpt @@ -10,8 +10,12 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php -$result = imagestring(tmpfile(), 1, 5, 5, 'String', 1); +try { + $result = imagestring(tmpfile(), 1, 5, 5, 'String', 1); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagestring(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imagestring(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagestringup_error2.phpt b/ext/gd/tests/imagestringup_error2.phpt index 871dd54fde..c09792c982 100644 --- a/ext/gd/tests/imagestringup_error2.phpt +++ b/ext/gd/tests/imagestringup_error2.phpt @@ -10,8 +10,12 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php -$result = imagestringup(tmpfile(), 1, 5, 5, 'String', 1); +try { + $result = imagestringup(tmpfile(), 1, 5, 5, 'String', 1); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagestringup(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imagestringup(): supplied resource is not a valid Image resource diff --git a/ext/gd/tests/imagetruecolortopalette_error1.phpt b/ext/gd/tests/imagetruecolortopalette_error1.phpt index a4d3bdfc16..dcdcfaea20 100644 --- a/ext/gd/tests/imagetruecolortopalette_error1.phpt +++ b/ext/gd/tests/imagetruecolortopalette_error1.phpt @@ -10,7 +10,11 @@ Rafael Dohms <rdohms [at] gmail [dot] com> --FILE-- <?php $resource = tmpfile(); -imagetruecolortopalette($resource, true, 2); +try { + imagetruecolortopalette($resource, true, 2); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: imagetruecolortopalette(): supplied resource is not a valid Image resource in %s on line %d +--EXPECT-- +imagetruecolortopalette(): supplied resource is not a valid Image resource diff --git a/ext/odbc/tests/odbc_free_result_001.phpt b/ext/odbc/tests/odbc_free_result_001.phpt index e17b4de1b9..223b3f0a4c 100644 --- a/ext/odbc/tests/odbc_free_result_001.phpt +++ b/ext/odbc/tests/odbc_free_result_001.phpt @@ -22,9 +22,21 @@ $res = odbc_exec($conn, 'SELECT * FROM FOO'); var_dump(odbc_fetch_row($res)); var_dump(odbc_result($res, 'test')); var_dump(odbc_free_result($res)); -var_dump(odbc_free_result($conn)); -var_dump(odbc_fetch_row($res)); -var_dump(odbc_result($res, 'test')); +try { + var_dump(odbc_free_result($conn)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(odbc_fetch_row($res)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(odbc_result($res, 'test')); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} odbc_exec($conn, 'DROP TABLE FOO'); @@ -35,12 +47,6 @@ odbc_exec($conn, 'DROP DATABASE odbcTEST'); bool(true) string(1) "1" bool(true) - -Warning: odbc_free_result(): supplied resource is not a valid ODBC result resource in %s on line %d -bool(false) - -Warning: odbc_fetch_row(): supplied resource is not a valid ODBC result resource in %s on line %d -bool(false) - -Warning: odbc_result(): supplied resource is not a valid ODBC result resource in %s on line %d -bool(false) +odbc_free_result(): supplied resource is not a valid ODBC result resource +odbc_fetch_row(): supplied resource is not a valid ODBC result resource +odbc_result(): supplied resource is not a valid ODBC result resource diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 8cf294b361..31c2fcce0d 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -1848,7 +1848,9 @@ PHP_FUNCTION(openssl_spki_new) pkey = php_openssl_evp_from_zval(zpkey, 0, challenge, challenge_len, 1, &keyresource); if (pkey == NULL) { - php_error_docref(NULL, E_WARNING, "Unable to use supplied private key"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "Unable to use supplied private key"); + } goto cleanup; } @@ -2848,7 +2850,9 @@ PHP_FUNCTION(openssl_pkcs12_export_to_file) } priv_key = php_openssl_evp_from_zval(zpkey, 0, "", 0, 1, &keyresource); if (priv_key == NULL) { - php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3"); + } goto cleanup; } if (!X509_check_private_key(cert, priv_key)) { @@ -2941,7 +2945,9 @@ PHP_FUNCTION(openssl_pkcs12_export) } priv_key = php_openssl_evp_from_zval(zpkey, 0, "", 0, 1, &keyresource); if (priv_key == NULL) { - php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3"); + } goto cleanup; } if (!X509_check_private_key(cert, priv_key)) { @@ -3344,7 +3350,9 @@ PHP_FUNCTION(openssl_csr_export_to_file) csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource); if (csr == NULL) { - php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1"); + } return; } @@ -3393,7 +3401,9 @@ PHP_FUNCTION(openssl_csr_export) csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource); if (csr == NULL) { - php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1"); + } return; } @@ -3444,7 +3454,9 @@ PHP_FUNCTION(openssl_csr_sign) csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource); if (csr == NULL) { - php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "cannot get CSR from parameter 1"); + } return; } if (zcert) { @@ -3456,7 +3468,9 @@ PHP_FUNCTION(openssl_csr_sign) } priv_key = php_openssl_evp_from_zval(zpkey, 0, "", 0, 1, &keyresource); if (priv_key == NULL) { - php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "cannot get private key from parameter 3"); + } goto cleanup; } if (cert && !X509_check_private_key(cert, priv_key)) { @@ -4563,7 +4577,9 @@ PHP_FUNCTION(openssl_pkey_export_to_file) key = php_openssl_evp_from_zval(zpkey, 0, passphrase, passphrase_len, 0, &key_resource); if (key == NULL) { - php_error_docref(NULL, E_WARNING, "cannot get key from parameter 1"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "cannot get key from parameter 1"); + } RETURN_FALSE; } @@ -4648,7 +4664,9 @@ PHP_FUNCTION(openssl_pkey_export) key = php_openssl_evp_from_zval(zpkey, 0, passphrase, passphrase_len, 0, &key_resource); if (key == NULL) { - php_error_docref(NULL, E_WARNING, "cannot get key from parameter 1"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "cannot get key from parameter 1"); + } RETURN_FALSE; } @@ -5524,7 +5542,9 @@ PHP_FUNCTION(openssl_pkcs7_sign) privkey = php_openssl_evp_from_zval(zprivkey, 0, "", 0, 0, &keyresource); if (privkey == NULL) { - php_error_docref(NULL, E_WARNING, "error getting private key"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "error getting private key"); + } goto clean_exit; } @@ -5633,7 +5653,9 @@ PHP_FUNCTION(openssl_pkcs7_decrypt) key = php_openssl_evp_from_zval(recipkey ? recipkey : recipcert, 0, "", 0, 0, &keyresval); if (key == NULL) { - php_error_docref(NULL, E_WARNING, "unable to get private key"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "unable to get private key"); + } goto clean_exit; } @@ -5701,7 +5723,9 @@ PHP_FUNCTION(openssl_private_encrypt) pkey = php_openssl_evp_from_zval(key, 0, "", 0, 0, &keyresource); if (pkey == NULL) { - php_error_docref(NULL, E_WARNING, "key param is not a valid private key"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "key param is not a valid private key"); + } RETURN_FALSE; } @@ -5762,7 +5786,9 @@ PHP_FUNCTION(openssl_private_decrypt) pkey = php_openssl_evp_from_zval(key, 0, "", 0, 0, &keyresource); if (pkey == NULL) { - php_error_docref(NULL, E_WARNING, "key parameter is not a valid private key"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "key parameter is not a valid private key"); + } RETURN_FALSE; } @@ -5829,7 +5855,9 @@ PHP_FUNCTION(openssl_public_encrypt) pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, 0, &keyresource); if (pkey == NULL) { - php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key"); + } RETURN_FALSE; } @@ -5891,7 +5919,9 @@ PHP_FUNCTION(openssl_public_decrypt) pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, 0, &keyresource); if (pkey == NULL) { - php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "key parameter is not a valid public key"); + } RETURN_FALSE; } @@ -5990,7 +6020,9 @@ PHP_FUNCTION(openssl_sign) } pkey = php_openssl_evp_from_zval(key, 0, "", 0, 0, &keyresource); if (pkey == NULL) { - php_error_docref(NULL, E_WARNING, "supplied key param cannot be coerced into a private key"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "supplied key param cannot be coerced into a private key"); + } RETURN_FALSE; } @@ -6075,7 +6107,9 @@ PHP_FUNCTION(openssl_verify) pkey = php_openssl_evp_from_zval(key, 1, NULL, 0, 0, &keyresource); if (pkey == NULL) { - php_error_docref(NULL, E_WARNING, "supplied key param cannot be coerced into a public key"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "supplied key param cannot be coerced into a public key"); + } RETURN_FALSE; } @@ -6155,7 +6189,9 @@ PHP_FUNCTION(openssl_seal) ZEND_HASH_FOREACH_VAL(pubkeysht, pubkey) { pkeys[i] = php_openssl_evp_from_zval(pubkey, 1, NULL, 0, 0, &key_resources[i]); if (pkeys[i] == NULL) { - php_error_docref(NULL, E_WARNING, "not a public key (%dth member of pubkeys)", i+1); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "not a public key (%dth member of pubkeys)", i+1); + } RETVAL_FALSE; goto clean_exit; } @@ -6253,7 +6289,9 @@ PHP_FUNCTION(openssl_open) pkey = php_openssl_evp_from_zval(privkey, 0, "", 0, 0, &keyresource); if (pkey == NULL) { - php_error_docref(NULL, E_WARNING, "unable to coerce parameter 4 into a private key"); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "unable to coerce parameter 4 into a private key"); + } RETURN_FALSE; } diff --git a/ext/openssl/tests/bug68912.phpt b/ext/openssl/tests/bug68912.phpt index 724a96017a..0b796b7683 100644 --- a/ext/openssl/tests/bug68912.phpt +++ b/ext/openssl/tests/bug68912.phpt @@ -12,9 +12,11 @@ $var1=fopen(__FILE__, 'r'); $var2=2; $var3=3; -openssl_spki_new($var1, $var2, $var3); +try { + openssl_spki_new($var1, $var2, $var3); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- -Warning: openssl_spki_new(): supplied resource is not a valid OpenSSL X.509/key resource in %sbug68912.php on line %d - -Warning: openssl_spki_new(): Unable to use supplied private key in %sbug68912.php on line %d +--EXPECT-- +openssl_spki_new(): supplied resource is not a valid OpenSSL X.509/key resource diff --git a/ext/openssl/tests/openssl_csr_export_bacis.phpt b/ext/openssl/tests/openssl_csr_export_bacis.phpt index e9c89d6c01..3a252d8a8f 100644 --- a/ext/openssl/tests/openssl_csr_export_bacis.phpt +++ b/ext/openssl/tests/openssl_csr_export_bacis.phpt @@ -32,15 +32,15 @@ try { } catch (TypeError $e) { echo $e->getMessage(), "\n"; } -var_dump(openssl_csr_export($privkey, $output)); +try { + var_dump(openssl_csr_export($privkey, $output)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(openssl_csr_export($csr, $output, false)); ?> ---EXPECTF-- +--EXPECT-- bool(true) openssl_csr_export() expects parameter 1 to be resource, string given - -Warning: openssl_csr_export(): supplied resource is not a valid OpenSSL X.509 CSR resource in %s on line %d - -Warning: openssl_csr_export(): cannot get CSR from parameter 1 in %s on line %d -bool(false) +openssl_csr_export(): supplied resource is not a valid OpenSSL X.509 CSR resource bool(true) diff --git a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt index 8c8169e785..57092293db 100644 --- a/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt +++ b/ext/openssl/tests/openssl_csr_export_to_file_basic.phpt @@ -41,7 +41,11 @@ try { } catch (TypeError $e) { echo $e->getMessage(), "\n"; } -var_dump(openssl_csr_export_to_file($dh, $csrfile)); +try { + var_dump(openssl_csr_export_to_file($dh, $csrfile)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(openssl_csr_export_to_file($csr, $csrfile, false)); ?> --CLEAN-- @@ -51,7 +55,7 @@ if (file_exists($csrfile)) { unlink($csrfile); } ?> ---EXPECTF-- +--EXPECT-- bool(true) string(1086) "-----BEGIN CERTIFICATE REQUEST----- MIIC6jCCAdICAQAwgaQxCzAJBgNVBAYTAkJSMRowGAYDVQQIExFSaW8gR3JhbmRl @@ -73,9 +77,5 @@ JViHkCA9x6m8RJXAFvqmgLlWlUzbDv/cRrDfjWjR -----END CERTIFICATE REQUEST----- " openssl_csr_export_to_file() expects parameter 1 to be resource, string given - -Warning: openssl_csr_export_to_file(): supplied resource is not a valid OpenSSL X.509 CSR resource in %s on line %d - -Warning: openssl_csr_export_to_file(): cannot get CSR from parameter 1 in %s on line %d -bool(false) +openssl_csr_export_to_file(): supplied resource is not a valid OpenSSL X.509 CSR resource bool(true) diff --git a/ext/openssl/tests/openssl_pkcs12_export_basic.phpt b/ext/openssl/tests/openssl_pkcs12_export_basic.phpt index 08e56d92a5..c6082bc645 100644 --- a/ext/openssl/tests/openssl_pkcs12_export_basic.phpt +++ b/ext/openssl/tests/openssl_pkcs12_export_basic.phpt @@ -30,7 +30,11 @@ var_dump(count($opts)); // should be 3 certificates, priv, pub, extra optional c var_dump(openssl_pkcs12_export($invalid, $output, $invalid, $pass)); var_dump(openssl_pkcs12_export($invalid_path, $output, $invalid_path, $pass)); -var_dump(openssl_pkcs12_export($priv_res, $output, $cert_res, $pass)); +try { + var_dump(openssl_pkcs12_export($priv_res, $output, $cert_res, $pass)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} //var_dump(openssl_pkcs12_export($cert, $output, $priv, $pass, array("foo"))); ?> --EXPECTF-- @@ -50,7 +54,5 @@ bool(false) Warning: openssl_pkcs12_export(): cannot get cert from parameter 1 in %s on line %d bool(false) -Warning: openssl_pkcs12_export(): supplied resource is not a valid OpenSSL X.509 resource in %s on line %d - Warning: openssl_pkcs12_export(): cannot get cert from parameter 1 in %s on line %d -bool(false) +openssl_pkcs12_export(): supplied resource is not a valid OpenSSL X.509 resource diff --git a/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt b/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt index ccc9104d34..f079ec8aac 100644 --- a/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt +++ b/ext/openssl/tests/openssl_pkcs12_export_to_file_basic.phpt @@ -30,7 +30,11 @@ var_dump(openssl_pkcs12_read(file_get_contents($pkcsfile), $opts, $pass)); var_dump(openssl_pkcs12_export_to_file($invalid, $pkcsfile, $invalid, $pass)); var_dump(openssl_pkcs12_export_to_file($invalid_path, $pkcsfile, $invalid_path, $pass)); -var_dump(openssl_pkcs12_export_to_file($priv_res, $pkcsfile, $cert_res, $pass)); +try { + var_dump(openssl_pkcs12_export_to_file($priv_res, $pkcsfile, $cert_res, $pass)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> --CLEAN-- <?php @@ -55,7 +59,5 @@ bool(false) Warning: openssl_pkcs12_export_to_file(): cannot get cert from parameter 1 in %s on line %d bool(false) -Warning: openssl_pkcs12_export_to_file(): supplied resource is not a valid OpenSSL X.509 resource in %s on line %d - Warning: openssl_pkcs12_export_to_file(): cannot get cert from parameter 1 in %s on line %d -bool(false) +openssl_pkcs12_export_to_file(): supplied resource is not a valid OpenSSL X.509 resource diff --git a/ext/pgsql/tests/bug72197.phpt b/ext/pgsql/tests/bug72197.phpt index bf9c16978b..7732bfddfc 100644 --- a/ext/pgsql/tests/bug72197.phpt +++ b/ext/pgsql/tests/bug72197.phpt @@ -7,7 +7,11 @@ Bug #72197 pg_lo_create arbitrary read /* This shouldn't crash. */ $var1=-32768; $var2="12"; -pg_lo_create($var1, $var2); +try { + pg_lo_create($var1, $var2); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} /* This should work correctly. */ include('config.inc'); @@ -28,7 +32,7 @@ pg_close($conn); ?> ==DONE== --EXPECTF-- -Warning: pg_lo_create(): supplied resource is not a valid PostgreSQL link resource in %sbug72197.php on line %d%w +pg_lo_create(): supplied resource is not a valid PostgreSQL link resource%w int(%d) int(%d) ==DONE== diff --git a/ext/posix/posix.c b/ext/posix/posix.c index e95064d0fa..3626fd02a1 100644 --- a/ext/posix/posix.c +++ b/ext/posix/posix.c @@ -769,7 +769,6 @@ static int php_posix_stream_get_fd(zval *zfp, int *fd) /* {{{ */ php_stream_from_zval_no_verify(stream, zfp); if (stream == NULL) { - php_error_docref(NULL, E_WARNING, "expects argument 1 to be a valid stream resource"); return 0; } if (php_stream_can_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT) == SUCCESS) { diff --git a/ext/posix/tests/posix_ttyname_error_wrongparams.phpt b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt index ba340db300..6dcb1d324d 100644 --- a/ext/posix/tests/posix_ttyname_error_wrongparams.phpt +++ b/ext/posix/tests/posix_ttyname_error_wrongparams.phpt @@ -20,15 +20,15 @@ PHP Testfest Berlin 2009-05-10 ?> --FILE-- <?php - var_dump(posix_ttyname(0)); // param not a ressource +var_dump(posix_ttyname(0)); // param not a ressource +try { var_dump(posix_ttyname(imagecreate(1, 1))); // wrong resource type +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== ---EXPECTF-- -bool(false) - -Warning: posix_ttyname(): supplied resource is not a valid stream resource in %s on line %d - -Warning: posix_ttyname(): expects argument 1 to be a valid stream resource in %s on line %d +--EXPECT-- bool(false) +posix_ttyname(): supplied resource is not a valid stream resource ===DONE=== diff --git a/ext/sockets/tests/socket_export_stream-2.phpt b/ext/sockets/tests/socket_export_stream-2.phpt index fb89bd28d7..e95945038a 100644 --- a/ext/sockets/tests/socket_export_stream-2.phpt +++ b/ext/sockets/tests/socket_export_stream-2.phpt @@ -8,24 +8,31 @@ if (!extension_loaded('sockets')) { --FILE-- <?php -var_dump(socket_export_stream(fopen(__FILE__, "rb"))); -var_dump(socket_export_stream(stream_socket_server("udp://127.0.0.1:58392", $errno, $errstr, STREAM_SERVER_BIND))); +try { + var_dump(socket_export_stream(fopen(__FILE__, "rb"))); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump(socket_export_stream(stream_socket_server("udp://127.0.0.1:58392", $errno, $errstr, STREAM_SERVER_BIND))); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} $s = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP); var_dump($s); socket_close($s); -var_dump(socket_export_stream($s)); +try { + var_dump(socket_export_stream($s)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done."; ?> --EXPECTF-- -Warning: socket_export_stream(): supplied resource is not a valid Socket resource in %s on line %d -bool(false) - -Warning: socket_export_stream(): supplied resource is not a valid Socket resource in %s on line %d -bool(false) +socket_export_stream(): supplied resource is not a valid Socket resource +socket_export_stream(): supplied resource is not a valid Socket resource resource(%d) of type (Socket) - -Warning: socket_export_stream(): supplied resource is not a valid Socket resource in %s on line %d -bool(false) +socket_export_stream(): supplied resource is not a valid Socket resource Done. diff --git a/ext/sockets/tests/socket_export_stream-4-win.phpt b/ext/sockets/tests/socket_export_stream-4-win.phpt index cd118c034a..260fbb24d5 100644 --- a/ext/sockets/tests/socket_export_stream-4-win.phpt +++ b/ext/sockets/tests/socket_export_stream-4-win.phpt @@ -14,15 +14,27 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) { function test($stream, $sock) { if ($stream !== null) { echo "stream_set_blocking "; - print_r(stream_set_blocking($stream, 0)); + try { + print_r(stream_set_blocking($stream, 0)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } echo "\n"; } if ($sock !== null) { echo "socket_set_block "; - print_r(socket_set_block($sock)); + try { + print_r(socket_set_block($sock)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } echo "\n"; echo "socket_get_option "; - print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); + try { + print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } echo "\n"; } echo "\n"; @@ -80,8 +92,7 @@ stream_set_blocking 1 close stream -stream_set_blocking -Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d +stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource socket_set_block Warning: socket_set_block(): unable to set blocking mode [%d]: An operation was attempted on something that is not a socket. @@ -94,14 +105,11 @@ Warning: socket_get_option(): unable to retrieve socket option [%d]: An operatio close socket -stream_set_blocking -Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d +stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource -socket_set_block -Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d +socket_set_block socket_set_block(): supplied resource is not a valid Socket resource -socket_get_option -Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d +socket_get_option socket_get_option(): supplied resource is not a valid Socket resource Done. diff --git a/ext/sockets/tests/socket_export_stream-4.phpt b/ext/sockets/tests/socket_export_stream-4.phpt index ff329ec795..668ac648d3 100644 --- a/ext/sockets/tests/socket_export_stream-4.phpt +++ b/ext/sockets/tests/socket_export_stream-4.phpt @@ -14,15 +14,27 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) { function test($stream, $sock) { if ($stream !== null) { echo "stream_set_blocking "; - print_r(stream_set_blocking($stream, 0)); + try { + print_r(stream_set_blocking($stream, 0)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } echo "\n"; } if ($sock !== null) { echo "socket_set_block "; - print_r(socket_set_block($sock)); + try { + print_r(socket_set_block($sock)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } echo "\n"; echo "socket_get_option "; - print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); + try { + print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } echo "\n"; } echo "\n"; @@ -80,8 +92,7 @@ stream_set_blocking 1 close stream -stream_set_blocking -Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d +stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource socket_set_block Warning: socket_set_block(): unable to set blocking mode [%d]: %s in %s on line %d @@ -92,14 +103,11 @@ Warning: socket_get_option(): unable to retrieve socket option [%d]: %s in %s on close socket -stream_set_blocking -Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d +stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource -socket_set_block -Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d +socket_set_block socket_set_block(): supplied resource is not a valid Socket resource -socket_get_option -Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d +socket_get_option socket_get_option(): supplied resource is not a valid Socket resource Done. diff --git a/ext/sockets/tests/socket_import_stream-2.phpt b/ext/sockets/tests/socket_import_stream-2.phpt index 8464b46039..19b3bf1029 100644 --- a/ext/sockets/tests/socket_import_stream-2.phpt +++ b/ext/sockets/tests/socket_import_stream-2.phpt @@ -9,23 +9,27 @@ if (!extension_loaded('sockets')) { <?php var_dump(socket_import_stream(fopen(__FILE__, "rb"))); -var_dump(socket_import_stream(socket_create(AF_INET, SOCK_DGRAM, SOL_UDP))); +try { + var_dump(socket_import_stream(socket_create(AF_INET, SOCK_DGRAM, SOL_UDP))); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} $s = stream_socket_server("udp://127.0.0.1:58392", $errno, $errstr, STREAM_SERVER_BIND); var_dump($s); var_dump(fclose($s)); -var_dump(socket_import_stream($s)); +try { + var_dump(socket_import_stream($s)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done."; ?> --EXPECTF-- Warning: socket_import_stream(): cannot represent a stream of type STDIO as a Socket Descriptor in %s on line %d bool(false) - -Warning: socket_import_stream(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +socket_import_stream(): supplied resource is not a valid stream resource resource(%d) of type (stream) bool(true) - -Warning: socket_import_stream(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +socket_import_stream(): supplied resource is not a valid stream resource Done. diff --git a/ext/sockets/tests/socket_import_stream-4-win.phpt b/ext/sockets/tests/socket_import_stream-4-win.phpt index a281cbcbce..35d8a99fc8 100644 --- a/ext/sockets/tests/socket_import_stream-4-win.phpt +++ b/ext/sockets/tests/socket_import_stream-4-win.phpt @@ -14,15 +14,27 @@ if(substr(PHP_OS, 0, 3) != 'WIN' ) { function test($stream, $sock) { if ($stream !== null) { echo "stream_set_blocking "; - print_r(stream_set_blocking($stream, 0)); + try { + print_r(stream_set_blocking($stream, 0)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } echo "\n"; } if ($sock !== null) { echo "socket_set_block "; - print_r(socket_set_block($sock)); + try { + print_r(socket_set_block($sock)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } echo "\n"; echo "socket_get_option "; - print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); + try { + print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } echo "\n"; } echo "\n"; @@ -75,8 +87,7 @@ stream_set_blocking 1 close stream -stream_set_blocking -Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d +stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource socket_set_block Warning: socket_set_block(): unable to set blocking mode [10038]: %s @@ -89,14 +100,11 @@ Warning: socket_get_option(): unable to retrieve socket option [10038]: %s close socket -stream_set_blocking -Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d +stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource -socket_set_block -Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d +socket_set_block socket_set_block(): supplied resource is not a valid Socket resource -socket_get_option -Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d +socket_get_option socket_get_option(): supplied resource is not a valid Socket resource Done. diff --git a/ext/sockets/tests/socket_import_stream-4.phpt b/ext/sockets/tests/socket_import_stream-4.phpt index f124161e10..5a528c6e33 100644 --- a/ext/sockets/tests/socket_import_stream-4.phpt +++ b/ext/sockets/tests/socket_import_stream-4.phpt @@ -14,15 +14,27 @@ if(substr(PHP_OS, 0, 3) == 'WIN' ) { function test($stream, $sock) { if ($stream !== null) { echo "stream_set_blocking "; - print_r(stream_set_blocking($stream, 0)); + try { + print_r(stream_set_blocking($stream, 0)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } echo "\n"; } if ($sock !== null) { echo "socket_set_block "; - print_r(socket_set_block($sock)); + try { + print_r(socket_set_block($sock)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } echo "\n"; echo "socket_get_option "; - print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); + try { + print_r(socket_get_option($sock, SOL_SOCKET, SO_TYPE)); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } echo "\n"; } echo "\n"; @@ -75,8 +87,7 @@ stream_set_blocking 1 close stream -stream_set_blocking -Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d +stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource socket_set_block Warning: socket_set_block(): unable to set blocking mode [%d]: %s in %s on line %d @@ -87,14 +98,11 @@ Warning: socket_get_option(): unable to retrieve socket option [%d]: %s in %s on close socket -stream_set_blocking -Warning: stream_set_blocking(): supplied resource is not a valid stream resource in %s on line %d +stream_set_blocking stream_set_blocking(): supplied resource is not a valid stream resource -socket_set_block -Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d +socket_set_block socket_set_block(): supplied resource is not a valid Socket resource -socket_get_option -Warning: socket_get_option(): supplied resource is not a valid Socket resource in %s on line %d +socket_get_option socket_get_option(): supplied resource is not a valid Socket resource Done. diff --git a/ext/sockets/tests/socket_set_block-retval.phpt b/ext/sockets/tests/socket_set_block-retval.phpt index 88e0029989..89dcc7ab4f 100644 --- a/ext/sockets/tests/socket_set_block-retval.phpt +++ b/ext/sockets/tests/socket_set_block-retval.phpt @@ -15,14 +15,16 @@ socket_close($socket); $socket2 = socket_create_listen(31340); socket_close($socket2); -var_dump(socket_set_block($socket2)); +try { + var_dump(socket_set_block($socket2)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- +--EXPECT-- bool(true) - -Warning: socket_set_block(): supplied resource is not a valid Socket resource in %s on line %d -bool(false) +socket_set_block(): supplied resource is not a valid Socket resource --CREDITS-- Robin Mehner, robin@coding-robin.de PHP Testfest Berlin 2009-05-09 diff --git a/ext/sockets/tests/socket_set_nonblock-retval.phpt b/ext/sockets/tests/socket_set_nonblock-retval.phpt index c9bb1150ab..fb0e593810 100644 --- a/ext/sockets/tests/socket_set_nonblock-retval.phpt +++ b/ext/sockets/tests/socket_set_nonblock-retval.phpt @@ -15,14 +15,16 @@ socket_close($socket); $socket2 = socket_create_listen(31340); socket_close($socket2); -var_dump(socket_set_nonblock($socket2)); +try { + var_dump(socket_set_nonblock($socket2)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ---EXPECTF-- +--EXPECT-- bool(true) - -Warning: socket_set_nonblock(): supplied resource is not a valid Socket resource in %s on line %d -bool(false) +socket_set_nonblock(): supplied resource is not a valid Socket resource --CREDITS-- Robin Mehner, robin@coding-robin.de PHP Testfest Berlin 2009-05-09 diff --git a/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt b/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt index 07b9ab869a..26d410f4bd 100644 --- a/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt +++ b/ext/standard/tests/dir/closedir_variation2-win32-mb.phpt @@ -32,7 +32,11 @@ echo "Directory Handle: "; var_dump($dh); echo "\n-- Close directory handle second time: --\n"; -var_dump(closedir($dh)); +try { + var_dump(closedir($dh)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Directory Handle: "; var_dump($dh); ?> @@ -50,8 +54,6 @@ NULL Directory Handle: resource(%d) of type (Unknown) -- Close directory handle second time: -- - -Warning: closedir(): %s is not a valid Directory resource in %s on line %d -bool(false) +closedir(): %s is not a valid Directory resource Directory Handle: resource(%d) of type (Unknown) ===DONE=== diff --git a/ext/standard/tests/dir/closedir_variation2.phpt b/ext/standard/tests/dir/closedir_variation2.phpt index cb85750e71..7c814a4926 100644 --- a/ext/standard/tests/dir/closedir_variation2.phpt +++ b/ext/standard/tests/dir/closedir_variation2.phpt @@ -26,7 +26,11 @@ echo "Directory Handle: "; var_dump($dh); echo "\n-- Close directory handle second time: --\n"; -var_dump(closedir($dh)); +try { + var_dump(closedir($dh)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Directory Handle: "; var_dump($dh); ?> @@ -44,8 +48,6 @@ NULL Directory Handle: resource(%d) of type (Unknown) -- Close directory handle second time: -- - -Warning: closedir(): supplied resource is not a valid Directory resource in %s on line %d -bool(false) +closedir(): supplied resource is not a valid Directory resource Directory Handle: resource(%d) of type (Unknown) ===DONE=== diff --git a/ext/standard/tests/dir/dir_basic-win32-mb.phpt b/ext/standard/tests/dir/dir_basic-win32-mb.phpt index d643846852..2106bc37d6 100644 --- a/ext/standard/tests/dir/dir_basic-win32-mb.phpt +++ b/ext/standard/tests/dir/dir_basic-win32-mb.phpt @@ -44,8 +44,12 @@ echo "\nClose directory:\n"; var_dump( $d->close() ); var_dump( $d ); -echo "\nTest read after closing the dir:"; -var_dump( $d->read() ); +echo "\nTest read after closing the dir:\n"; +try { + var_dump( $d->read() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // delete temp files delete_files($dir_path, 3, "私はガラスを食べられますdir_basic", 1, ".tmp"); @@ -87,6 +91,5 @@ object(Directory)#%d (2) { } Test read after closing the dir: -Warning: Directory::read(): %s is not a valid Directory resource in %s on line %d -bool(false) +Directory::read(): %s is not a valid Directory resource Done diff --git a/ext/standard/tests/dir/dir_basic.phpt b/ext/standard/tests/dir/dir_basic.phpt index 4360a749c7..15f8061b7b 100644 --- a/ext/standard/tests/dir/dir_basic.phpt +++ b/ext/standard/tests/dir/dir_basic.phpt @@ -38,8 +38,12 @@ echo "\nClose directory:\n"; var_dump( $d->close() ); var_dump( $d ); -echo "\nTest read after closing the dir:"; -var_dump( $d->read() ); +echo "\nTest read after closing the dir:\n"; +try { + var_dump( $d->read() ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // delete temp files delete_files($dir_path, 3, "dir_basic", 1, ".tmp"); @@ -81,6 +85,5 @@ object(Directory)#%d (2) { } Test read after closing the dir: -Warning: Directory::read(): supplied resource is not a valid Directory resource in %s on line %d -bool(false) +Directory::read(): supplied resource is not a valid Directory resource Done diff --git a/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt b/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt index e46640c41e..d38571c88a 100644 --- a/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt +++ b/ext/standard/tests/dir/rewinddir_variation2-win32-mb.phpt @@ -29,7 +29,11 @@ var_dump(readdir($dir_handle)); closedir($dir_handle); echo "\n-- Call to rewinddir() --\n"; -var_dump(rewinddir($dir_handle)); +try { + var_dump(rewinddir($dir_handle)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== --CLEAN-- @@ -45,7 +49,5 @@ resource(%d) of type (stream) string(%d) "%s" -- Call to rewinddir() -- - -Warning: rewinddir(): %s is not a valid Directory resource in %s on line %d -bool(false) +rewinddir(): %s is not a valid Directory resource ===DONE=== diff --git a/ext/standard/tests/dir/rewinddir_variation2.phpt b/ext/standard/tests/dir/rewinddir_variation2.phpt index 02654aa80c..ca646f2002 100644 --- a/ext/standard/tests/dir/rewinddir_variation2.phpt +++ b/ext/standard/tests/dir/rewinddir_variation2.phpt @@ -23,7 +23,11 @@ var_dump(readdir($dir_handle)); closedir($dir_handle); echo "\n-- Call to rewinddir() --\n"; -var_dump(rewinddir($dir_handle)); +try { + var_dump(rewinddir($dir_handle)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== --CLEAN-- @@ -39,7 +43,5 @@ resource(%d) of type (stream) string(%d) "%s" -- Call to rewinddir() -- - -Warning: rewinddir(): supplied resource is not a valid Directory resource in %s on line %d -bool(false) +rewinddir(): supplied resource is not a valid Directory resource ===DONE=== diff --git a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt index ed68c2a7d7..d4d3eb9295 100644 --- a/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt +++ b/ext/standard/tests/directory/DirectoryClass_error_001-mb.phpt @@ -10,9 +10,21 @@ mkdir($d); echo "\n--> Try all methods with bad handle:\n"; $d = new Directory($d); $d->handle = "Havoc!"; -var_dump($d->read()); -var_dump($d->rewind()); -var_dump($d->close()); +try { + var_dump($d->read()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump($d->rewind()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump($d->close()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n--> Try all methods with no handle:\n"; $d = new Directory($d); @@ -30,15 +42,9 @@ rmdir($d); ?> --EXPECTF-- --> Try all methods with bad handle: - -Warning: Directory::read(): supplied argument is not a valid Directory resource in %s on line %d -bool(false) - -Warning: Directory::rewind(): supplied argument is not a valid Directory resource in %s on line %d -bool(false) - -Warning: Directory::close(): supplied argument is not a valid Directory resource in %s on line %d -bool(false) +Directory::read(): supplied argument is not a valid Directory resource +Directory::rewind(): supplied argument is not a valid Directory resource +Directory::close(): supplied argument is not a valid Directory resource --> Try all methods with no handle: diff --git a/ext/standard/tests/directory/DirectoryClass_error_001.phpt b/ext/standard/tests/directory/DirectoryClass_error_001.phpt index 0a693dd9b7..3ff3370e4b 100644 --- a/ext/standard/tests/directory/DirectoryClass_error_001.phpt +++ b/ext/standard/tests/directory/DirectoryClass_error_001.phpt @@ -6,9 +6,21 @@ Directory class behaviour. echo "\n--> Try all methods with bad handle:\n"; $d = new Directory(getcwd()); $d->handle = "Havoc!"; -var_dump($d->read()); -var_dump($d->rewind()); -var_dump($d->close()); +try { + var_dump($d->read()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump($d->rewind()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump($d->close()); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n--> Try all methods with no handle:\n"; $d = new Directory(getcwd()); @@ -20,15 +32,9 @@ var_dump($d->close()); ?> --EXPECTF-- --> Try all methods with bad handle: - -Warning: Directory::read(): supplied argument is not a valid Directory resource in %s on line %d -bool(false) - -Warning: Directory::rewind(): supplied argument is not a valid Directory resource in %s on line %d -bool(false) - -Warning: Directory::close(): supplied argument is not a valid Directory resource in %s on line %d -bool(false) +Directory::read(): supplied argument is not a valid Directory resource +Directory::rewind(): supplied argument is not a valid Directory resource +Directory::close(): supplied argument is not a valid Directory resource --> Try all methods with no handle: diff --git a/ext/standard/tests/file/007_basic.phpt b/ext/standard/tests/file/007_basic.phpt index fd2e5575a9..fa25431580 100644 --- a/ext/standard/tests/file/007_basic.phpt +++ b/ext/standard/tests/file/007_basic.phpt @@ -51,9 +51,17 @@ for( $i=0; $i<count($modes); $i++ ) { // check fclose() var_dump( fclose($handle) ); var_dump( $handle ); - // confirm the closure, using ftell() and feof(), expect, false - var_dump( ftell($handle) ); - var_dump( feof($handle) ); + // confirm the closure, using ftell() and feof() + try { + var_dump( ftell($handle) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( feof($handle) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } // remove the temp file @@ -78,9 +86,17 @@ for( $i=0; $i<count($x_modes); $i++ ) { // check fclose() var_dump( fclose($handle) ); var_dump( $handle ); - // confirm the closure, using ftell() and feof(), expect, false - var_dump( ftell($handle) ); - var_dump( feof($handle) ); + // confirm the closure, using ftell() and feof() + try { + var_dump( ftell($handle) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } + try { + var_dump( feof($handle) ); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } var_dump( $handle ); // remove the file @@ -97,12 +113,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'wb' -- resource(%d) of type (stream) @@ -110,12 +122,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'wt' -- resource(%d) of type (stream) @@ -123,12 +131,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'w+' -- resource(%d) of type (stream) @@ -136,12 +140,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'w+b' -- resource(%d) of type (stream) @@ -149,12 +149,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'w+t' -- resource(%d) of type (stream) @@ -162,12 +158,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'r' -- resource(%d) of type (stream) @@ -175,12 +167,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'rb' -- resource(%d) of type (stream) @@ -188,12 +176,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'rt' -- resource(%d) of type (stream) @@ -201,12 +185,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'r+' -- resource(%d) of type (stream) @@ -214,12 +194,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'r+b' -- resource(%d) of type (stream) @@ -227,12 +203,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'r+t' -- resource(%d) of type (stream) @@ -240,12 +212,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'a' -- resource(%d) of type (stream) @@ -253,12 +221,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'ab' -- resource(%d) of type (stream) @@ -266,12 +230,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'at' -- resource(%d) of type (stream) @@ -279,12 +239,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'a+' -- resource(%d) of type (stream) @@ -292,12 +248,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'a+t' -- resource(%d) of type (stream) @@ -305,12 +257,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'a+b' -- resource(%d) of type (stream) @@ -318,12 +266,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource -- Iteration with mode 'x' -- resource(%d) of type (stream) @@ -331,12 +275,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource resource(%d) of type (Unknown) -- Iteration with mode 'xb' -- @@ -345,12 +285,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource resource(%d) of type (Unknown) -- Iteration with mode 'xt' -- @@ -359,12 +295,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource resource(%d) of type (Unknown) -- Iteration with mode 'x+' -- @@ -373,12 +305,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource resource(%d) of type (Unknown) -- Iteration with mode 'x+b' -- @@ -387,12 +315,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource resource(%d) of type (Unknown) -- Iteration with mode 'x+t' -- @@ -401,12 +325,8 @@ int(0) bool(false) bool(true) resource(%d) of type (Unknown) - -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource +feof(): supplied resource is not a valid stream resource resource(%d) of type (Unknown) *** Done *** diff --git a/ext/standard/tests/file/fclose_variation1.phpt b/ext/standard/tests/file/fclose_variation1.phpt index ba3631e50d..8d3e1a1805 100644 --- a/ext/standard/tests/file/fclose_variation1.phpt +++ b/ext/standard/tests/file/fclose_variation1.phpt @@ -7,9 +7,13 @@ function separate_zval(&$var) { } $s2 = $s; separate_zval($s2); fclose($s); -echo fread($s2, strlen("<?php")); +try { + echo fread($s2, strlen("<?php")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\nDone.\n"; ---EXPECTF-- -Warning: fread(): supplied resource is not a valid stream resource in %s on line %d +--EXPECT-- +fread(): supplied resource is not a valid stream resource Done. diff --git a/ext/standard/tests/file/feof_basic.phpt b/ext/standard/tests/file/feof_basic.phpt index 2fc2e4b855..0711a3468d 100644 --- a/ext/standard/tests/file/feof_basic.phpt +++ b/ext/standard/tests/file/feof_basic.phpt @@ -64,13 +64,17 @@ var_dump(feof($h)); echo "*** closing file, testing eof ***\n"; fclose($h); -feof($h); +try { + feof($h); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} unlink($tmpFile1); unlink($tmpFile2); echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing feof() : basic functionality *** *** testing reading complete file using feof to stop *** @@ -96,6 +100,5 @@ bool(false) *** testing feof after a seek passed the end *** bool(false) *** closing file, testing eof *** - -Warning: feof(): supplied resource is not a valid stream resource in %s on line %d +feof(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/fgetc_variation2.phpt b/ext/standard/tests/file/fgetc_variation2.phpt index dd0dbb2096..d67e56e56a 100644 --- a/ext/standard/tests/file/fgetc_variation2.phpt +++ b/ext/standard/tests/file/fgetc_variation2.phpt @@ -24,14 +24,16 @@ $file_handle = fopen(__FILE__, "r"); fclose($file_handle); // read from closed file -var_dump( fgetc($file_handle) ); +try { + var_dump( fgetc($file_handle) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing fgetc() : usage variations *** -- Testing fgetc() with closed handle -- - -Warning: fgetc(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +fgetc(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/fgets_variation2.phpt b/ext/standard/tests/file/fgets_variation2.phpt index aa8beb2d4d..2626139dcb 100644 --- a/ext/standard/tests/file/fgets_variation2.phpt +++ b/ext/standard/tests/file/fgets_variation2.phpt @@ -24,18 +24,22 @@ $file_handle = fopen(__FILE__, "r"); fclose($file_handle); // read from closed file -var_dump( fgets($file_handle) ); // default length -var_dump( fgets($file_handle, 10) ); // with specific length +try { + var_dump( fgets($file_handle) ); // default length +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + var_dump( fgets($file_handle, 10) ); // with specific length +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing fgets() : usage variations *** -- Testing fgets() with closed handle -- - -Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d -bool(false) - -Warning: fgets(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +fgets(): supplied resource is not a valid stream resource +fgets(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/file_put_contents.phpt b/ext/standard/tests/file/file_put_contents.phpt index be2a6ca0ac..f9dc6d1b8e 100644 --- a/ext/standard/tests/file/file_put_contents.phpt +++ b/ext/standard/tests/file/file_put_contents.phpt @@ -11,22 +11,27 @@ $file = __DIR__."/file_put_contents.txt"; $context = stream_context_create(); -var_dump(file_put_contents($file, $context)); +try { + var_dump(file_put_contents($file, $context)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} var_dump(file_put_contents($file, new stdClass)); var_dump(file_put_contents($file, new foo)); $fp = fopen($file, "r"); -var_dump(file_put_contents($file, "string", 0, $fp)); +try { + var_dump(file_put_contents($file, "string", 0, $fp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} @unlink($file); echo "Done\n"; ?> ---EXPECTF-- -Warning: file_put_contents(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +--EXPECT-- +file_put_contents(): supplied resource is not a valid stream resource bool(false) int(15) - -Warning: file_put_contents(): supplied resource is not a valid Stream-Context resource in %s on line %d -int(6) +file_put_contents(): supplied resource is not a valid Stream-Context resource Done diff --git a/ext/standard/tests/file/flock.phpt b/ext/standard/tests/file/flock.phpt index fd5f5f51fc..48cba22729 100644 --- a/ext/standard/tests/file/flock.phpt +++ b/ext/standard/tests/file/flock.phpt @@ -8,7 +8,11 @@ $file = __DIR__."/flock.dat"; $fp = fopen($file, "w"); fclose($fp); -var_dump(flock($fp, LOCK_SH|LOCK_NB)); +try { + var_dump(flock($fp, LOCK_SH|LOCK_NB)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} $fp = fopen($file, "w"); @@ -38,8 +42,7 @@ $file = __DIR__."/flock.dat"; unlink($file); ?> --EXPECTF-- -Warning: flock(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +flock(): supplied resource is not a valid stream resource bool(true) bool(true) bool(true) diff --git a/ext/standard/tests/file/flock_error.phpt b/ext/standard/tests/file/flock_error.phpt index 56290f428c..7c820d212b 100644 --- a/ext/standard/tests/file/flock_error.phpt +++ b/ext/standard/tests/file/flock_error.phpt @@ -41,7 +41,11 @@ foreach($operations as $operation) { /* Invalid arguments */ $fp = fopen($file, "w"); fclose($fp); -var_dump(flock($fp, LOCK_SH|LOCK_NB)); +try { + var_dump(flock($fp, LOCK_SH|LOCK_NB)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n*** Done ***\n"; ?> @@ -83,8 +87,6 @@ flock() expects parameter 2 to be int, string given --- Iteration 8 --- flock() expects parameter 2 to be int, string given - -Warning: flock(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +flock(): supplied resource is not a valid stream resource *** Done *** diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf_error.phpt index 0724d6c539..1df1a699cb 100644 --- a/ext/standard/tests/file/fscanf_error.phpt +++ b/ext/standard/tests/file/fscanf_error.phpt @@ -18,7 +18,11 @@ fwrite($file_handle, "hello world"); fclose($file_handle); // invalid file handle -var_dump( fscanf($file_handle, "%s") ); +try { + var_dump( fscanf($file_handle, "%s") ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // number of formats in format strings not matching the no of variables $file_handle = fopen($filename, 'r'); @@ -52,9 +56,7 @@ unlink($filename); ?> --EXPECTF-- *** Testing fscanf() for error conditions *** - -Warning: fscanf(): supplied resource is not a valid File-Handle resource in %s on line %d -bool(false) +fscanf(): supplied resource is not a valid File-Handle resource Warning: fscanf(): Different numbers of variable names and field specifiers in %s on line %d int(-1) diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt index c39b3bcbe5..cd58c30f20 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error1.phpt @@ -16,16 +16,19 @@ Test fseek(), ftell() & rewind() functions : error conditions - fseek() echo "*** Testing fseek() : error conditions ***\n"; // fseek() on a file handle which is already closed -echo "-- Testing fseek() with closed/unset file handle --"; +echo "-- Testing fseek() with closed/unset file handle --\n"; $fp = fopen(__FILE__, "r"); fclose($fp); -var_dump(fseek($fp,10)); +try { + var_dump(fseek($fp,10)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing fseek() : error conditions *** -- Testing fseek() with closed/unset file handle -- -Warning: fseek(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +fseek(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt index 87f70b8717..45f1298951 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error2.phpt @@ -16,16 +16,19 @@ Test fseek(), ftell() & rewind() functions : error conditions - ftell() echo "*** Testing ftell() : error conditions ***\n"; // ftell on a file handle which is already closed -echo "-- Testing ftell with closed/unset file handle --"; +echo "-- Testing ftell with closed/unset file handle --\n"; $fp = fopen(__FILE__, "r"); fclose($fp); -var_dump(ftell($fp)); +try { + var_dump(ftell($fp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing ftell() : error conditions *** -- Testing ftell with closed/unset file handle -- -Warning: ftell(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftell(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt index edbb9e22f2..e698bca463 100644 --- a/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt +++ b/ext/standard/tests/file/fseek_ftell_rewind_error3.phpt @@ -16,16 +16,19 @@ Test fseek(), ftell() & rewind() functions : error conditions - rewind() echo "*** Testing rewind() : error conditions ***\n"; // rewind on a file handle which is already closed -echo "-- Testing rewind() with closed/unset file handle --"; +echo "-- Testing rewind() with closed/unset file handle --\n"; $fp = fopen(__FILE__, "r"); fclose($fp); -var_dump(rewind($fp)); +try { + var_dump(rewind($fp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- *** Testing rewind() : error conditions *** -- Testing rewind() with closed/unset file handle -- -Warning: rewind(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +rewind(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/fstat.phpt b/ext/standard/tests/file/fstat.phpt index 415124046e..b48b06cfe5 100644 --- a/ext/standard/tests/file/fstat.phpt +++ b/ext/standard/tests/file/fstat.phpt @@ -8,7 +8,11 @@ $filename = __DIR__."/fstat.dat"; $fp = fopen($filename, "w"); var_dump(fstat($fp)); fclose($fp); -var_dump(fstat($fp)); +try { + var_dump(fstat($fp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} @unlink($filename); echo "Done\n"; @@ -68,7 +72,5 @@ array(26) { ["blocks"]=> int(%i) } - -Warning: fstat(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +fstat(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/ftruncate_error.phpt b/ext/standard/tests/file/ftruncate_error.phpt index 32c767828e..83569c47d8 100644 --- a/ext/standard/tests/file/ftruncate_error.phpt +++ b/ext/standard/tests/file/ftruncate_error.phpt @@ -20,7 +20,11 @@ echo "-- Testing ftruncate() with closed/unset file handle --\n"; // ftruncate on close file handle fclose($file_handle); -var_dump( ftruncate($file_handle,10) ); +try { + var_dump( ftruncate($file_handle,10) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} // check the first size var_dump( filesize($filename) ); @@ -31,13 +35,11 @@ echo "Done\n"; $filename = __DIR__."/ftruncate_error.tmp"; unlink( $filename ); ?> ---EXPECTF-- +--EXPECT-- *** Testing ftruncate() : error conditions *** Initial file size = 36 -- Testing ftruncate() with closed/unset file handle -- - -Warning: ftruncate(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +ftruncate(): supplied resource is not a valid stream resource int(36) Done diff --git a/ext/standard/tests/file/fwrite_error.phpt b/ext/standard/tests/file/fwrite_error.phpt index c18290105d..236c4601b0 100644 --- a/ext/standard/tests/file/fwrite_error.phpt +++ b/ext/standard/tests/file/fwrite_error.phpt @@ -29,7 +29,11 @@ var_dump( fwrite($file_handle, $data, $len) ); // fwrite() on a file handle which is already closed echo "-- Testing fwrite() with closed/unset file handle --\n"; fclose($file_handle); -var_dump(fwrite($file_handle,"data")); +try { + var_dump(fwrite($file_handle,"data")); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -38,13 +42,11 @@ echo "Done\n"; $filename = __DIR__."/fwrite_error.tmp"; unlink( $filename ); ?> ---EXPECTF-- +--EXPECT-- *** Testing fwrite() : error conditions *** -- Testing fwrite() with invalid length arguments -- int(0) int(0) -- Testing fwrite() with closed/unset file handle -- - -Warning: fwrite(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +fwrite(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/stream_supports_lock.phpt b/ext/standard/tests/file/stream_supports_lock.phpt index 38a84dd7c2..0d2f04b72d 100644 --- a/ext/standard/tests/file/stream_supports_lock.phpt +++ b/ext/standard/tests/file/stream_supports_lock.phpt @@ -26,7 +26,11 @@ fclose($fp); $sock = stream_context_create(); var_dump($sock); -var_dump(stream_supports_lock($sock)); +try { + var_dump(stream_supports_lock($sock)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -40,7 +44,5 @@ bool(false) resource(%d) of type (stream) bool(false) resource(%d) of type (stream-context) - -Warning: stream_supports_lock(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +stream_supports_lock(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/file/userstreams_002.phpt b/ext/standard/tests/file/userstreams_002.phpt index 81f463ddd2..3068c93b46 100644 --- a/ext/standard/tests/file/userstreams_002.phpt +++ b/ext/standard/tests/file/userstreams_002.phpt @@ -22,7 +22,11 @@ function test($name, $fd, $return_value) { $data['wrapper_data']->return_value = $return_value; $r = array($fd); $w = $e = null; - var_dump(stream_select($r, $w, $e, 0) !== false); + try { + var_dump(stream_select($r, $w, $e, 0) !== false); + } catch (TypeError $e) { + echo $e->getMessage(), "\n"; + } } var_dump(stream_wrapper_register('test', 'test_wrapper')); @@ -64,14 +68,12 @@ bool(false) ------ return value not a stream resource: ------- -Warning: stream_select(): supplied argument is not a valid stream resource in %s - Warning: stream_select(): test_wrapper::stream_cast must return a stream resource in %s Warning: stream_select(): cannot represent a stream of type user-space as a select()able descriptor in %s Warning: stream_select(): No stream arrays were passed in %s -bool(false) +stream_select(): supplied argument is not a valid stream resource ------ return value is stream itself: ------- diff --git a/ext/standard/tests/streams/bug54623.phpt b/ext/standard/tests/streams/bug54623.phpt index c21dc82019..02b1924eea 100644 --- a/ext/standard/tests/streams/bug54623.phpt +++ b/ext/standard/tests/streams/bug54623.phpt @@ -9,9 +9,12 @@ $sock2 = pfsockopen('udp://127.0.0.1', '63844'); var_dump((int)$sock2); @fwrite($sock2, "2"); fclose($sock2); -fwrite($sock, "3"); +try { + fwrite($sock, "3"); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} --EXPECTF-- int(%d) int(%d) - -Warning: fwrite(): supplied resource is not a valid stream resource in %s on line %d +fwrite(): supplied resource is not a valid stream resource diff --git a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt index 5530322fec..7bfa4f0510 100644 --- a/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt +++ b/ext/standard/tests/streams/stream_get_meta_data_file_error.phpt @@ -13,15 +13,17 @@ echo "*** Testing stream_get_meta_data() : error conditions ***\n"; echo "\n-- Testing stream_get_meta_data() function with closed stream resource --\n"; $fp = fopen(__FILE__, 'r'); fclose($fp); -var_dump(stream_get_meta_data($fp)); +try { + var_dump(stream_get_meta_data($fp)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done"; ?> ---EXPECTF-- +--EXPECT-- *** Testing stream_get_meta_data() : error conditions *** -- Testing stream_get_meta_data() function with closed stream resource -- - -Warning: stream_get_meta_data(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +stream_get_meta_data(): supplied resource is not a valid stream resource Done diff --git a/ext/standard/tests/streams/stream_set_timeout_error.phpt b/ext/standard/tests/streams/stream_set_timeout_error.phpt index 6c5b992dd5..7dcc645422 100644 --- a/ext/standard/tests/streams/stream_set_timeout_error.phpt +++ b/ext/standard/tests/streams/stream_set_timeout_error.phpt @@ -26,7 +26,11 @@ $microseconds = 10; echo "\n-- Testing stream_set_timeout() function with a closed socket --\n"; fclose($client); -var_dump( stream_set_timeout($client, $seconds) ); +try { + var_dump( stream_set_timeout($client, $seconds) ); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "\n-- Testing stream_set_timeout() function with a stream that does not support timeouts --\n"; $filestream = fopen(__FILE__, "r"); @@ -41,9 +45,7 @@ echo "Done"; *** Testing stream_set_timeout() : error conditions *** -- Testing stream_set_timeout() function with a closed socket -- - -Warning: stream_set_timeout(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +stream_set_timeout(): supplied resource is not a valid stream resource -- Testing stream_set_timeout() function with a stream that does not support timeouts -- bool(false) diff --git a/ext/sysvshm/tests/003.phpt b/ext/sysvshm/tests/003.phpt index da9075090c..a7fe128aa5 100644 --- a/ext/sysvshm/tests/003.phpt +++ b/ext/sysvshm/tests/003.phpt @@ -13,8 +13,16 @@ $key = ftok(__DIR__."/003.phpt", 'q'); $s = shm_attach($key); var_dump(shm_detach($s)); -var_dump(shm_detach($s)); -shm_remove($s); +try { + var_dump(shm_detach($s)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} +try { + shm_remove($s); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> @@ -26,11 +34,8 @@ $s = shm_attach($key); shm_remove($s); ?> ---EXPECTF-- +--EXPECT-- bool(true) - -Warning: shm_detach(): supplied resource is not a valid sysvshm resource in %s003.php on line %d -bool(false) - -Warning: shm_remove(): supplied resource is not a valid sysvshm resource in %s003.php on line %d +shm_detach(): supplied resource is not a valid sysvshm resource +shm_remove(): supplied resource is not a valid sysvshm resource Done diff --git a/ext/sysvshm/tests/007.phpt b/ext/sysvshm/tests/007.phpt index 747d401333..730e9a3fbd 100644 --- a/ext/sysvshm/tests/007.phpt +++ b/ext/sysvshm/tests/007.phpt @@ -14,13 +14,15 @@ $s = shm_attach($key, 1024); var_dump(shm_remove($s)); shm_detach($s); -var_dump(shm_remove($s)); +try { + var_dump(shm_remove($s)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Done\n"; ?> ---EXPECTF-- +--EXPECT-- bool(true) - -Warning: shm_remove(): supplied resource is not a valid sysvshm resource in %s007.php on line %d -bool(false) +shm_remove(): supplied resource is not a valid sysvshm resource Done diff --git a/ext/zip/tests/doubleclose.phpt b/ext/zip/tests/doubleclose.phpt index 48547e3c72..771801952b 100644 --- a/ext/zip/tests/doubleclose.phpt +++ b/ext/zip/tests/doubleclose.phpt @@ -11,9 +11,13 @@ echo "Procedural\n"; $zip = zip_open(__DIR__ . '/test.zip'); if (!is_resource($zip)) { die("Failure"); - } -var_dump(zip_close($zip)); +} var_dump(zip_close($zip)); +try { + var_dump(zip_close($zip)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} echo "Object\n"; $zip = new ZipArchive(); @@ -32,12 +36,10 @@ Done --EXPECTF-- Procedural NULL - -Warning: zip_close(): supplied resource is not a valid Zip Directory resource in %s -bool(false) +zip_close(): supplied resource is not a valid Zip Directory resource Object bool(true) -Warning: ZipArchive::close(): Invalid or uninitialized Zip object in %s +Warning: ZipArchive::close(): Invalid or uninitialized Zip object in %s on line %d bool(false) Done diff --git a/ext/zip/tests/zip_entry_close.phpt b/ext/zip/tests/zip_entry_close.phpt index 2f2581b2d0..f11f3112a9 100644 --- a/ext/zip/tests/zip_entry_close.phpt +++ b/ext/zip/tests/zip_entry_close.phpt @@ -10,14 +10,16 @@ $zip = zip_open(__DIR__."/test_procedural.zip"); $entry = zip_read($zip); echo "entry_open: "; var_dump(zip_entry_open($zip, $entry, "r")); echo "entry_close: "; var_dump(zip_entry_close($entry)); -echo "entry_close: "; var_dump(zip_entry_close($entry)); +try { + echo "entry_close: "; var_dump(zip_entry_close($entry)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} zip_close($zip); ?> Done ---EXPECTF-- +--EXPECT-- entry_open: bool(true) entry_close: bool(true) -entry_close: -Warning: zip_entry_close(): supplied resource is not a valid Zip Entry resource in %s -bool(false) +entry_close: zip_entry_close(): supplied resource is not a valid Zip Entry resource Done diff --git a/ext/zlib/tests/gzclose_basic.phpt b/ext/zlib/tests/gzclose_basic.phpt index 0393db2c57..df8ab9c614 100644 --- a/ext/zlib/tests/gzclose_basic.phpt +++ b/ext/zlib/tests/gzclose_basic.phpt @@ -17,23 +17,29 @@ gzread($h, 20); var_dump(gzclose($h)); //should fail. -gzread($h, 20); +try { + gzread($h, 20); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} $h = gzopen($f, 'r'); gzread($h, 20); var_dump(fclose($h)); //should fail. -gzread($h, 20); +try { + gzread($h, 20); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} ?> ===DONE=== ---EXPECTF-- +--EXPECT-- bool(true) - -Warning: gzread(): supplied resource is not a valid stream resource in %s on line %d +gzread(): supplied resource is not a valid stream resource bool(true) - -Warning: gzread(): supplied resource is not a valid stream resource in %s on line %d +gzread(): supplied resource is not a valid stream resource ===DONE=== diff --git a/ext/zlib/tests/gzeof_variation1.phpt b/ext/zlib/tests/gzeof_variation1.phpt index 4a845917af..66d70ebd8b 100644 --- a/ext/zlib/tests/gzeof_variation1.phpt +++ b/ext/zlib/tests/gzeof_variation1.phpt @@ -18,14 +18,16 @@ var_dump(gzeof($h)); gzwrite( $h, $str, $length); var_dump(gzeof($h)); gzclose($h); -var_dump(gzeof($h)); +try { + var_dump(gzeof($h)); +} catch (TypeError $e) { + echo $e->getMessage(), "\n"; +} unlink($filename); ?> ===DONE=== ---EXPECTF-- +--EXPECT-- bool(false) bool(false) - -Warning: gzeof(): supplied resource is not a valid stream resource in %s on line %d -bool(false) +gzeof(): supplied resource is not a valid stream resource ===DONE=== diff --git a/scripts/dev/bless_tests.php b/scripts/dev/bless_tests.php index 19c24bf188..6885d1782c 100755 --- a/scripts/dev/bless_tests.php +++ b/scripts/dev/bless_tests.php @@ -53,6 +53,7 @@ function normalizeOutput(string $out): string { $out = preg_replace('/in \/.+:\d+$/m', 'in %s:%d', $out); $out = preg_replace('/^#(\d+) \/.+\(\d+\):/m', '#$1 %s(%d):', $out); $out = preg_replace('/Resource id #\d+/', 'Resource id #%d', $out); + $out = preg_replace('/resource\(\d+\) of type/', 'resource(%d) of type', $out); return $out; } |