mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-11-24 03:52:12 +00:00
Fix curl error messages missing error code constant
Fix PHPStan static analysis errors (#929) left two placeholder property declarations behind, which shadow __get() so the lazy getters never ran. Since 11.0.5, curl error messages have lacked their (CURLE_...) suffix.
This commit is contained in:
+4
-3
@@ -4,6 +4,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace Curl;
|
||||
|
||||
/**
|
||||
* @property-read string $curlErrorCodeConstant
|
||||
* @property-read array<int, string> $curlErrorCodeConstants
|
||||
*/
|
||||
class Curl extends BaseCurl
|
||||
{
|
||||
public const VERSION = '13.0.2';
|
||||
@@ -92,9 +96,6 @@ class Curl extends BaseCurl
|
||||
's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '{', '|', '}', '~',
|
||||
];
|
||||
|
||||
public $curlErrorCodeConstant;
|
||||
public $curlErrorCodeConstants;
|
||||
|
||||
private static $deferredProperties = [
|
||||
'curlErrorCodeConstant',
|
||||
'curlErrorCodeConstants',
|
||||
|
||||
@@ -1403,6 +1403,15 @@ class PHPCurlClassTest extends \PHPUnit\Framework\TestCase
|
||||
$this->assertEquals('HTTP/1.1 401 Unauthorized', $test->curl->errorMessage);
|
||||
}
|
||||
|
||||
public function testCurlErrorMessageIncludesErrorCodeConstant()
|
||||
{
|
||||
$curl = new Curl();
|
||||
$curl->get('unsupported://127.0.0.1/');
|
||||
$this->assertEquals(CURLE_UNSUPPORTED_PROTOCOL, $curl->curlErrorCode);
|
||||
$this->assertEquals('CURLE_UNSUPPORTED_PROTOCOL', $curl->curlErrorCodeConstant);
|
||||
$this->assertStringContainsString('(CURLE_UNSUPPORTED_PROTOCOL)', $curl->curlErrorMessage);
|
||||
}
|
||||
|
||||
public function testRequestHeaderCaseSensitivity()
|
||||
{
|
||||
$content_type = 'application/json';
|
||||
|
||||
Reference in New Issue
Block a user