[php-src] master: ext/curl: Test exception types in tests added in #22745

NickSdot via GitHub <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: NickSdot (NickSdot)
Committer: GitHub (web-flow)
Pusher: LamentXU123
Date: 2026-08-14T01:11:36+08:00

Commit: https://github.com/php/php-src/commit/337af2feab9417559da860aabc0f65ca94278c2b
Raw diff: https://github.com/php/php-src/commit/337af2feab9417559da860aabc0f65ca94278c2b.diff

ext/curl: Test exception types in tests added in #22745

Follow up to #22745.

Changed paths:
  M  ext/curl/tests/curl_headerfunction_throws_abort.phpt
  M  ext/curl/tests/curl_prereqfunction_throws_abort.phpt
  M  ext/curl/tests/curl_progressfunction_throws_abort.phpt
  M  ext/curl/tests/curl_readfunction_throws_abort.phpt
  M  ext/curl/tests/curl_writefunction_throws_abort.phpt
  M  ext/curl/tests/curl_xferinfofunction_throws_abort.phpt


Diff:

diff --git a/ext/curl/tests/curl_headerfunction_throws_abort.phpt b/ext/curl/tests/curl_headerfunction_throws_abort.phpt
index 9a69c966f144..23fe1652c636 100644
--- a/ext/curl/tests/curl_headerfunction_throws_abort.phpt
+++ b/ext/curl/tests/curl_headerfunction_throws_abort.phpt
@@ -25,7 +25,7 @@ curl_setopt($ch, CURLOPT_HEADERFUNCTION,
 try {
     curl_exec($ch);
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 var_dump(curl_errno($ch) === CURLE_WRITE_ERROR);
@@ -39,7 +39,7 @@ var_dump(curl_errno($ch) === CURLE_OK);
 ?>
 --EXPECTF--
 Test: header function throws exception
-header exception
+Exception: header exception
 bool(true)
 Test: header function is null
 bool(true)
diff --git a/ext/curl/tests/curl_prereqfunction_throws_abort.phpt b/ext/curl/tests/curl_prereqfunction_throws_abort.phpt
index 7e8ccbf94f53..9ba19c650c99 100644
--- a/ext/curl/tests/curl_prereqfunction_throws_abort.phpt
+++ b/ext/curl/tests/curl_prereqfunction_throws_abort.phpt
@@ -24,12 +24,12 @@ curl_setopt($ch, CURLOPT_PREREQFUNCTION,
 try {
     curl_exec($ch);
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 var_dump(curl_errno($ch) === CURLE_ABORTED_BY_CALLBACK);
 
 ?>
 --EXPECTF--
-prereq exception
+Exception: prereq exception
 bool(true)
diff --git a/ext/curl/tests/curl_progressfunction_throws_abort.phpt b/ext/curl/tests/curl_progressfunction_throws_abort.phpt
index 55e0f76cb61f..5d3599679834 100644
--- a/ext/curl/tests/curl_progressfunction_throws_abort.phpt
+++ b/ext/curl/tests/curl_progressfunction_throws_abort.phpt
@@ -26,7 +26,7 @@ curl_setopt($ch, CURLOPT_PROGRESSFUNCTION,
 try {
     curl_exec($ch);
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 var_dump(curl_errno($ch) === CURLE_ABORTED_BY_CALLBACK);
@@ -40,7 +40,7 @@ var_dump(curl_errno($ch) === CURLE_OK);
 ?>
 --EXPECTF--
 Test: progress function throws exception
-info exception
+Exception: info exception
 bool(true)
 Test: progress function is null
 bool(true)
diff --git a/ext/curl/tests/curl_readfunction_throws_abort.phpt b/ext/curl/tests/curl_readfunction_throws_abort.phpt
index a030f8c4f41e..a18977d3ce45 100644
--- a/ext/curl/tests/curl_readfunction_throws_abort.phpt
+++ b/ext/curl/tests/curl_readfunction_throws_abort.phpt
@@ -28,7 +28,7 @@ curl_setopt($ch, CURLOPT_READFUNCTION,
 try {
     curl_exec($ch);
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 var_dump(curl_errno($ch) === CURLE_ABORTED_BY_CALLBACK);
@@ -42,7 +42,7 @@ var_dump(curl_errno($ch) === CURLE_OK);
 ?>
 --EXPECTF--
 Test: read function throws exception
-read exception
+Exception: read exception
 bool(true)
 Test: read function is null
 bool(true)
diff --git a/ext/curl/tests/curl_writefunction_throws_abort.phpt b/ext/curl/tests/curl_writefunction_throws_abort.phpt
index 3da2fe8107b4..125961c6c666 100644
--- a/ext/curl/tests/curl_writefunction_throws_abort.phpt
+++ b/ext/curl/tests/curl_writefunction_throws_abort.phpt
@@ -25,7 +25,7 @@ curl_setopt($ch, CURLOPT_WRITEFUNCTION,
 try {
     curl_exec($ch);
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 var_dump(curl_errno($ch) === CURLE_WRITE_ERROR);
@@ -38,7 +38,7 @@ var_dump(curl_errno($ch) === CURLE_OK);
 ?>
 --EXPECTF--
 Test: write function throws exception
-write exception
+Exception: write exception
 bool(true)
 Test: write function is null
 Hello World!
diff --git a/ext/curl/tests/curl_xferinfofunction_throws_abort.phpt b/ext/curl/tests/curl_xferinfofunction_throws_abort.phpt
index fbc28f07ee96..28cab577db57 100644
--- a/ext/curl/tests/curl_xferinfofunction_throws_abort.phpt
+++ b/ext/curl/tests/curl_xferinfofunction_throws_abort.phpt
@@ -26,7 +26,7 @@ curl_setopt($ch, CURLOPT_XFERINFOFUNCTION,
 try {
     curl_exec($ch);
 } catch (Exception $e) {
-    echo $e->getMessage(), "\n";
+    echo $e::class, ': ', $e->getMessage(), "\n";
 }
 
 var_dump(curl_errno($ch) === CURLE_ABORTED_BY_CALLBACK);
@@ -40,7 +40,7 @@ var_dump(curl_errno($ch) === CURLE_OK);
 ?>
 --EXPECTF--
 Test: xfer info function throws exception
-info exception
+Exception: info exception
 bool(true)
 Test: xfer info function is null
 bool(true)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.