11const CURL_DOC_FILE =
'https://curl.se/libcurl/c/symbols-in-versions.html';
18 'CURLOPT_PROGRESSDATA',
19 'CURLOPT_XFERINFODATA',
25 'CURLOPT_BINARYTRANSFER',
26 'CURLOPT_RETURNTRANSFER',
27 'CURLOPT_SAFE_UPLOAD',
58 public function add(
string ...$values) :
void
60 $this->values[] = $values;
62 foreach ($values as $key => $value) {
65 if (isset($this->length[$key])) {
66 $this->length[$key] =
max($this->length[$key], $length);
68 $this->length[$key] = $length;
80 foreach ($this->values as $values) {
81 foreach ($values as $key => $value) {
106 if ($removed !==
null) {
126 if ($removed ===
null) {
144 $table->add(
'Constant',
'Introduced',
'',
'Removed',
'');
147 if ($removed ===
null) {
157 echo
"Constants missing from the PHP source:\n\n";
170 echo
"Constants defined in the PHP source, but absent from the cURL documentation:\n\n";
182 $table->add(
'Constant',
'Removed');
185 $table->add(
$name, $version);
188 echo
"Constants defined in the PHP source, but removed before the minimum supported cURL version:\n\n";
195 echo
"All good! Source code and cURL documentation are in sync.\n";
213 preg_match(
'~<table>(.*?)</table>~s', $html, $matches);
214 $constantList = $matches[1];
225 $regexp =
'@<tr><td>(?:<a href=".*?">)?(?<const>[A-Za-z0-9_]+)(?:</a>)?</td><td>(?:<a href=".*?">)?(?<added>[\d\.]+)(?:</a>)?</td><td>(?:<a href=".*?">)?(?<deprecated>[\d\.]+)?(?:</a>)?</td><td>(<a href=".*?">)?(?<removed>[\d\.]+)?(</a>)?</td></tr>@m';
230 foreach ($matches as $match) {
231 $name = $match[
'const'];
232 $introduced = $match[
'added'];
233 $deprecated = $match[
'deprecated'] ??
null;
234 $removed = $match[
'removed'] ??
null;
241 if ($deprecated ===
'-') {
245 $constants[
$name] = [$introduced, $deprecated, $removed];
266 foreach ($matches[1] as
$name) {
267 if (
$name ===
'__c') {
276 $constants[] =
$name;
295 $parts =
explode(
'.', $version);
297 if (
count($parts) === 2) {
301 if (
count($parts) !== 3) {
302 throw new \RuntimeException(
'Invalid version number: ' . $version);
307 foreach ($parts as $value) {
309 throw new \RuntimeException(
'Invalid version number: ' . $version);
312 $value = (int) $value;
315 throw new \RuntimeException(
'Invalid version number: ' . $version);
320 if (
strlen($value) === 1) {
321 $value =
'0' . $value;
str_repeat(string $string, int $times)
in_array(mixed $needle, array $haystack, bool $strict=false)
file_get_contents(string $filename, bool $use_include_path=false, $context=null, int $offset=0, ?int $length=null)
explode(string $separator, string $string, int $limit=PHP_INT_MAX)
version_compare(string $version1, string $version2, ?string $operator=null)
str_pad(string $string, int $length, string $pad_string=" ", int $pad_type=STR_PAD_RIGHT)
count(Countable|array $value, int $mode=COUNT_NORMAL)
uasort(array &$array, callable $callback)
foreach(explode("\n", $input) as $line) $result
preg_match_all(string $pattern, string $subject, &$matches=null, int $flags=0, int $offset=0)
preg_match(string $pattern, string $subject, &$matches=null, int $flags=0, int $offset=0)
const IGNORED_CURL_CONSTANTS
getHexVersion(string $version)
foreach( $curlConstants as $name=>[ $introduced, $deprecated, $removed]) foreach($sourceConstants as $name) $allGood
const IGNORED_PHP_CONSTANTS
const MIN_SUPPORTED_CURL_VERSION
if($notInPHP) if( $notInCurl) if($outdated) if( $allGood) getCurlConstants()
const CONSTANTS_REGEX_PATTERN
ZEND_API void(ZEND_FASTCALL *zend_touch_vm_stack_data)(void *vm_stack_data)