Linux vps-61133.fhnet.fr 4.9.0-19-amd64 #1 SMP Debian 4.9.320-2 (2022-06-30) x86_64
Apache/2.4.25 (Debian)
Server IP : 93.113.207.21 & Your IP : 216.73.216.41
Domains :
Cant Read [ /etc/named.conf ]
User : www-data
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
usr /
src /
php-7.4.33 /
ext /
curl /
Delete
Unzip
Name
Size
Permission
Date
Action
.libs
[ DIR ]
drwxr-xr-x
2024-03-12 14:24
tests
[ DIR ]
drwxrwxr-x
2022-10-31 11:36
CREDITS
21
B
-rw-rw-r--
2022-10-31 11:36
config.m4
2.09
KB
-rw-rw-r--
2022-10-31 11:36
config.w32
1.33
KB
-rw-rw-r--
2022-10-31 11:36
curl_file.c
5.44
KB
-rw-rw-r--
2022-10-31 11:36
curl_file.lo
327
B
-rw-r--r--
2024-03-12 14:24
curl_file.o
91.63
KB
-rw-r--r--
2024-03-12 14:24
interface.c
117.31
KB
-rw-rw-r--
2022-10-31 11:36
interface.lo
327
B
-rw-r--r--
2024-03-12 14:24
interface.o
624.16
KB
-rw-r--r--
2024-03-12 14:24
multi.c
16.48
KB
-rw-rw-r--
2022-10-31 11:36
multi.lo
315
B
-rw-r--r--
2024-03-12 14:24
multi.o
152.1
KB
-rw-r--r--
2024-03-12 14:24
php_curl.h
6.03
KB
-rw-rw-r--
2022-10-31 11:36
share.c
4.22
KB
-rw-rw-r--
2022-10-31 11:36
share.lo
315
B
-rw-r--r--
2024-03-12 14:24
share.o
92.88
KB
-rw-r--r--
2024-03-12 14:24
sync-constants.php
7.64
KB
-rwxrwxr-x
2022-10-31 11:36
Save
Rename
#!/usr/bin/env php <?php /** * This script checks the constants defined in the curl PHP extension, against those documented on the cURL website: * https://curl.haxx.se/libcurl/c/symbols-in-versions.html * * See the discussion at: https://github.com/php/php-src/pull/2961 */ const CURL_DOC_FILE = 'https://curl.haxx.se/libcurl/c/symbols-in-versions.html'; const SOURCE_FILE = __DIR__ . '/interface.c'; const MIN_SUPPORTED_CURL_VERSION = '7.15.5'; const IGNORED_CONSTANTS = [ 'CURLOPT_PROGRESSDATA' ]; const CONSTANTS_REGEX_PATTERN = '~^CURL(?:OPT|_VERSION)_[A-Z0-9_]+$~'; $curlConstants = getCurlConstants(); $sourceConstants = getSourceConstants(); $notInPHP = []; // In cURL doc, but missing from PHP $notInCurl = []; // In the PHP source, but not in the cURL doc $outdated = []; // In the PHP source, but removed before the minimum supported cURL version foreach ($curlConstants as $name => [$introduced, $deprecated, $removed]) { $inPHP = in_array($name, $sourceConstants); if ($removed !== null) { if (version_compare($removed, MIN_SUPPORTED_CURL_VERSION) <= 0) { // constant removed before the minimum supported version continue; } } if (! $inPHP) { $notInPHP[$name] = [$introduced, $removed]; } } foreach ($sourceConstants as $name) { if (! isset($curlConstants[$name])) { $notInCurl[] = $name; continue; } $removed = $curlConstants[$name][2]; if ($removed === null) { continue; } if (version_compare($removed, MIN_SUPPORTED_CURL_VERSION) <= 0) { // constant removed before the minimum supported version $outdated[$name] = $removed; } } $allGood = true; if ($notInPHP) { uasort($notInPHP, function($a, $b) { return version_compare($a[0], $b[0]); }); $table = new AsciiTable(); $table->add('Constant', 'Introduced', '', 'Removed', ''); foreach ($notInPHP as $name => [$introduced, $removed]) { if ($removed === null) { $removed = ''; $removedHex = ''; } else { $removedHex = getHexVersion($removed); } $table->add($name, $introduced, getHexVersion($introduced), $removed, $removedHex); } echo "Constants missing from the PHP source:\n\n"; echo $table, "\n"; $allGood = false; } if ($notInCurl) { $table = new AsciiTable(); foreach ($notInCurl as $name) { $table->add($name); } echo "Constants defined in the PHP source, but absent from the cURL documentation:\n\n"; echo $table, "\n"; $allGood = false; } if ($outdated) { uasort($outdated, function($a, $b) { return version_compare($a, $b); }); $table = new AsciiTable(); $table->add('Constant', 'Removed'); foreach ($outdated as $name => $version) { $table->add($name, $version); } echo "Constants defined in the PHP source, but removed before the minimum supported cURL version:\n\n"; echo $table, "\n"; $allGood = false; } if ($allGood) { echo "All good! Source code and cURL documentation are in sync.\n"; } /** * Loads and parses the cURL constants from the online documentation. * * The result is an associative array where the key is the constant name, and the value is a numeric array with: * - the introduced version * - the deprecated version (nullable) * - the removed version (nullable) * * @return array */ function getCurlConstants() : array { $html = file_get_contents(CURL_DOC_FILE); // Extract the constant list from the HTML file (located in the only <pre> tag in the page) preg_match('~<pre>([^<]+)</pre>~', $html, $matches); $constantList = $matches[1]; /** * Parse the cURL constant lines. Possible formats: * * Name Introduced Deprecated Removed * CURLOPT_CRLFILE 7.19.0 * CURLOPT_DNS_USE_GLOBAL_CACHE 7.9.3 7.11.1 * CURLOPT_FTPASCII 7.1 7.11.1 7.15.5 * CURLOPT_HTTPREQUEST 7.1 - 7.15.5 */ $regexp = '/^([A-Za-z0-9_]+) +([0-9\.]+)(?: +([0-9\.\-]+))?(?: +([0-9\.]+))?/m'; preg_match_all($regexp, $constantList, $matches, PREG_SET_ORDER); $constants = []; foreach ($matches as $match) { $name = $match[1]; $introduced = $match[2]; $deprecated = $match[3] ?? null; $removed = $match[4] ?? null; if (in_array($name, IGNORED_CONSTANTS, true) || !preg_match(CONSTANTS_REGEX_PATTERN, $name)) { // not a wanted constant continue; } if ($deprecated === '-') { // deprecated version can be a hyphen $deprecated = null; } $constants[$name] = [$introduced, $deprecated, $removed]; } return $constants; } /** * Parses the defined cURL constants from the PHP extension source code. * * The result is a numeric array whose values are the constant names. * * @return array */ function getSourceConstants() : array { $source = file_get_contents(SOURCE_FILE); preg_match_all('/REGISTER_CURL_CONSTANT\(([A-Za-z0-9_]+)\)/', $source, $matches); $constants = []; foreach ($matches[1] as $name) { if ($name === '__c') { // macro continue; } if (!preg_match(CONSTANTS_REGEX_PATTERN, $name)) { // not a wanted constant continue; } $constants[] = $name; } return $constants; } /** * Converts a version number to its hex representation as used in the extension source code. * * Example: 7.25.1 => 0x071901 * * @param string $version * * @return string * * @throws \RuntimeException */ function getHexVersion(string $version) : string { $parts = explode('.', $version); if (count($parts) === 2) { $parts[] = '0'; } if (count($parts) !== 3) { throw new \RuntimeException('Invalid version number: ' . $version); } $hex = '0x'; foreach ($parts as $value) { if (! ctype_digit($value) || strlen($value) > 3) { throw new \RuntimeException('Invalid version number: ' . $version); } $value = (int) $value; if ($value > 255) { throw new \RuntimeException('Invalid version number: ' . $version); } $value = dechex($value); if (strlen($value) === 1) { $value = '0' . $value; } $hex .= $value; } return $hex; } /** * A simple helper to create ASCII tables. * It assumes that the same number of columns is always given to add(). */ class AsciiTable { /** * @var array */ private $values = []; /** * @var array */ private $length = []; /** * @var int */ private $padding = 4; /** * @param string[] $values * * @return void */ public function add(string ...$values) : void { $this->values[] = $values; foreach ($values as $key => $value) { $length = strlen($value); if (isset($this->length[$key])) { $this->length[$key] = max($this->length[$key], $length); } else { $this->length[$key] = $length; } } } /** * @return string */ public function __toString() : string { $result = ''; foreach ($this->values as $values) { foreach ($values as $key => $value) { if ($key !== 0) { $result .= str_repeat(' ', $this->padding); } $result .= str_pad($value, $this->length[$key]); } $result .= "\n"; } return $result; } }