Becareful when using this function to check errors, as it seems to read from a buffer of errors, which could include errors from another script or process that was using openssl functions. (I was surprised to find it returing error messages before I had called any openssl_* functions)
To clear the errors, you can do:
while ($err = openssl_error_string());
before using openssl functions. I'm not totally sure of the effect this will have on other threads though, maybe someone can clairify.
openssl_error_string
(PHP 4 >= 4.0.6, PHP 5)
openssl_error_string — OpenSSL hata iletisini döndürür
Açıklama
string openssl_error_string
( void
)
OpenSSL kütüphanesinde son oluşan hatanın iletisini döndürür. Hata iletileri bir yığıta kaydedilir, dolayısıyla tüm hata iletilerini toplamak için bu işlevin defalarca çağrılması gerekir.
Dönen Değerler
Döndürülecek hata iletisi kalmamışsa FALSE, varsa bir hata dizgesi
döndürür.
Örnekler
Örnek 1 - openssl_error_string() örneği
<?php
// Bazı openssl işlevlerinin başarısız olduğunu varsayalım
while ($msg = openssl_error_string())
echo $msg . "<br />\n";
?>
greg at gregmaclellan dot com ¶
8 years ago
