From 930cbdc68e5c490a32e308754e09524da0b71afc Mon Sep 17 00:00:00 2001 From: Kharhamel Date: Mon, 4 May 2020 17:00:05 +0200 Subject: [PATCH 1/2] updated the doc and regenerated --- composer.json | 1 + generated/Exceptions/RpminfoException.php | 11 ++++++++ generated/curl.php | 6 ++++- generated/functionsList.php | 2 ++ generated/mbstring.php | 31 +++++++++++++++++++++++ generated/pgsql.php | 8 +++--- generated/pspell.php | 2 +- generated/rpminfo.php | 21 +++++++++++++++ generated/strings.php | 4 +-- rector-migrate-0.7.yml | 2 ++ 10 files changed, 80 insertions(+), 8 deletions(-) create mode 100644 generated/Exceptions/RpminfoException.php create mode 100644 generated/rpminfo.php diff --git a/composer.json b/composer.json index e2b64fee..f97b764d 100644 --- a/composer.json +++ b/composer.json @@ -69,6 +69,7 @@ "generated/ps.php", "generated/pspell.php", "generated/readline.php", + "generated/rpminfo.php", "generated/rrd.php", "generated/sem.php", "generated/session.php", diff --git a/generated/Exceptions/RpminfoException.php b/generated/Exceptions/RpminfoException.php new file mode 100644 index 00000000..7596451d --- /dev/null +++ b/generated/Exceptions/RpminfoException.php @@ -0,0 +1,11 @@ + Date: Mon, 4 May 2020 17:02:55 +0200 Subject: [PATCH 2/2] added a regexp to catch imagecreatefromstring --- generated/functionsList.php | 1 + generated/image.php | 24 ++++++++++++++++++++++++ generator/src/DocPage.php | 5 +++++ rector-migrate-0.7.yml | 1 + 4 files changed, 31 insertions(+) diff --git a/generated/functionsList.php b/generated/functionsList.php index bf33914a..fd804f92 100644 --- a/generated/functionsList.php +++ b/generated/functionsList.php @@ -302,6 +302,7 @@ 'imagecreatefromgif', 'imagecreatefromjpeg', 'imagecreatefrompng', + 'imagecreatefromstring', 'imagecreatefromwbmp', 'imagecreatefromwebp', 'imagecreatefromxbm', diff --git a/generated/image.php b/generated/image.php index 8c790433..4b5d9f71 100644 --- a/generated/image.php +++ b/generated/image.php @@ -809,6 +809,30 @@ function imagecreatefrompng(string $filename) } +/** + * imagecreatefromstring returns an image identifier + * representing the image obtained from the given image. + * These types will be automatically detected if your build of PHP supports + * them: JPEG, PNG, GIF, BMP, WBMP, and GD2. + * + * @param string $image A string containing the image data. + * @return resource An image resource will be returned on success. FALSE is returned if + * the image type is unsupported, the data is not in a recognised format, + * or the image is corrupt and cannot be loaded. + * @throws ImageException + * + */ +function imagecreatefromstring(string $image) +{ + error_clear_last(); + $result = \imagecreatefromstring($image); + if ($result === false) { + throw ImageException::createFromPhpError(); + } + return $result; +} + + /** * imagecreatefromwbmp returns an image identifier * representing the image obtained from the given filename. diff --git a/generator/src/DocPage.php b/generator/src/DocPage.php index a96a460b..644f2684 100644 --- a/generator/src/DocPage.php +++ b/generator/src/DocPage.php @@ -110,6 +110,11 @@ public function detectFalsyFunction(): bool return true; } + //used to detect imagecreatefromstring + if (preg_match('/will be returned on success\. &false; is returned if/m', $file)) { + return true; + } + return false; } diff --git a/rector-migrate-0.7.yml b/rector-migrate-0.7.yml index de9117f1..230269e0 100644 --- a/rector-migrate-0.7.yml +++ b/rector-migrate-0.7.yml @@ -304,6 +304,7 @@ services: imagecreatefromgif: 'Safe\imagecreatefromgif' imagecreatefromjpeg: 'Safe\imagecreatefromjpeg' imagecreatefrompng: 'Safe\imagecreatefrompng' + imagecreatefromstring: 'Safe\imagecreatefromstring' imagecreatefromwbmp: 'Safe\imagecreatefromwbmp' imagecreatefromwebp: 'Safe\imagecreatefromwebp' imagecreatefromxbm: 'Safe\imagecreatefromxbm'