diff options
author | Anatol Belski <ab@php.net> | 2018-09-12 16:22:22 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2018-09-12 16:22:22 +0200 |
commit | 19ab91781ed48db3f3bf171f0687f7b4b2a037e1 (patch) | |
tree | e2df28308a63d58854e1201994dc24b2267fcda3 | |
parent | 49511a5132110ad64f22d0f6c2a6f7df0b25fb13 (diff) | |
download | php-git-19ab91781ed48db3f3bf171f0687f7b4b2a037e1.tar.gz |
Improve error code matching
-rw-r--r-- | ext/openssl/tests/openssl_error_string_basic.phpt | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/openssl/tests/openssl_error_string_basic.phpt b/ext/openssl/tests/openssl_error_string_basic.phpt index 0f1acd7dc5..af8f81f842 100644 --- a/ext/openssl/tests/openssl_error_string_basic.phpt +++ b/ext/openssl/tests/openssl_error_string_basic.phpt @@ -8,8 +8,8 @@ openssl_error_string() tests function expect_openssl_errors($name, $expected_error_codes) { $expected_errors = array_fill_keys($expected_error_codes, false); while (($error_string = openssl_error_string()) !== false) { - if (strlen($error_string) > 14) { - $error_code = substr($error_string, 6, 8); + if (preg_match(",.+:([0-9A-F]+):.+,", $error_string, $m) > 0) { + $error_code = $m[1]; if (isset($expected_errors[$error_code])) { $expected_errors[$error_code] = true; } |