diff --git a/ext/curl/sync-constants.php b/ext/curl/sync-constants.php
index 328c3dd108a65..22db954dd3dd3 100755
--- a/ext/curl/sync-constants.php
+++ b/ext/curl/sync-constants.php
@@ -208,7 +208,7 @@ function getCurlConstants() : array
$html = file_get_contents(CURL_DOC_FILE);
// Extract the constant list from the HTML file (located in the only
tag in the page)
- preg_match('~([^<]+)
~', $html, $matches);
+ preg_match('~
~s', $html, $matches);
$constantList = $matches[1];
/**
@@ -220,16 +220,16 @@ function getCurlConstants() : array
* 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';
+ $regexp = '@(?:)?(?[A-Za-z0-9_]+)(?:)? | (?:)?(?[\d\.]+)(?:)? | (?:)?(?[\d\.]+)?(?:)? | ()?(?[\d\.]+)?()? |
@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;
+ $name = $match['const'];
+ $introduced = $match['added'];
+ $deprecated = $match['deprecated'] ?? null;
+ $removed = $match['removed'] ?? null;
if (in_array($name, IGNORED_CURL_CONSTANTS, true) || !preg_match(CONSTANTS_REGEX_PATTERN, $name)) {
// not a wanted constant