com php-src: Fix 29nb_async_connect.phpt: ext/pgs ql/tests/29nb_async_connect.phpt
| From: | Nikita Popov | Date: | Wed, 10 Apr 2019 11:06:02 +0000 |
| Subject: | com php-src: Fix 29nb_async_connect.phpt: ext/pgs ql/tests/29nb_async_connect.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105618@lists.php.net to get a copy of this message | ||
Commit: 8f13599a645a97df940640e9c70f164a92e8743c
Author: Nikita Popov <nikita.ppv@gmail.com> Wed, 10 Apr 2019 13:06:02 +0200
Parents: c7a86a38a3f657ab81163ac794450fc7ada2ba3c
Branches: PHP-7.2 PHP-7.3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8f13599a645a97df940640e9c70f164a92e8743c
Log:
Fix 29nb_async_connect.phpt
Intermediate states are unreliable across versions (I think), make
sure we go through the whole connect procedure.
Changed paths:
M ext/pgsql/tests/29nb_async_connect.phpt
Diff:
diff --git a/ext/pgsql/tests/29nb_async_connect.phpt b/ext/pgsql/tests/29nb_async_connect.phpt
index fc3868a..a9b17eb 100755
--- a/ext/pgsql/tests/29nb_async_connect.phpt
+++ b/ext/pgsql/tests/29nb_async_connect.phpt
@@ -23,18 +23,20 @@ if (!$db = pg_connect($conn_str, PGSQL_CONNECT_ASYNC)) {
while (TRUE) {
switch ($status = pg_connect_poll($db)) {
case PGSQL_POLLING_READING:
- if (nb_is_readable($db_socket)) { break 2; }
+ nb_is_readable($db_socket);
break;
case PGSQL_POLLING_WRITING:
- if (nb_is_writable($db_socket)) { break 2; }
+ nb_is_writable($db_socket);
break;
case PGSQL_POLLING_FAILED:
die("async connection failed");
case PGSQL_POLLING_OK:
break 2;
+ default:
+ die("unknown poll status");
}
}
-assert(pg_connection_status($db) === PGSQL_CONNECTION_MADE);
+assert(pg_connection_status($db) === PGSQL_CONNECTION_OK);
echo "OK";
pg_close($db);