From f69a8486d535571d67ed204b1242431b02c2cb25 Mon Sep 17 00:00:00 2001 From: spipu Date: Wed, 8 Jan 2025 09:54:21 +0100 Subject: [PATCH] bump supported phpversion from **5.6 -> 8.2** to **7.2 -> 8.4** improve some bad codes --- .github/workflows/ci.yaml | 3 --- CHANGELOG.md | 11 +++++++++++ README.md | 6 +++--- composer.json | 4 ++-- examples/res/about.php | 1 + src/Extension/Core/HtmlExtension.php | 3 ++- src/Html2Pdf.php | 6 +++--- src/Locale.php | 7 +------ src/Tag/Html/{StrikeTag.php => Strike.php} | 23 ++++++++++++---------- 9 files changed, 36 insertions(+), 28 deletions(-) rename src/Tag/Html/{StrikeTag.php => Strike.php} (75%) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 936069be..1b65600a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -16,9 +16,6 @@ jobs: strategy: matrix: php-version: - - 5.6 - - 7.0 - - 7.1 - 7.2 - 7.3 - 7.4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c812145..d9896538 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to this project will be documented in this file. +## [5.3.0](https://github.com/spipu/html2pdf/compare/v5.2.8...v5.3.0) - 2025-01-08 + + * bump supported phpversion from **5.6 -> 8.2** to **7.2 -> 8.4** + * add html tag "strike" - thanks to @milan-ghevariya + * add html tag "figure" - thanks to @fredmatrack + * replace Travis with Github actions for CI - thanks to @W0rma + * fix casing of parameter type - thanks to @W0rma + * fix bad type hint on setModeDebug function - thanks to @W0rma + * fix fgetcsv usage for php 8.4 compatibility - thanks to @W0rma + * fix TCPDF::$pdfa argument type as per upstream - thanks to @jankal + ## [5.2.8](https://github.com/spipu/html2pdf/compare/v5.2.7...v5.2.8) - 2023-07-18 * fix XSS vulnerabilities in examples `example9.php` and `forms.php` - thanks to Michał Majchrowicz, Livio Victoriano and Zbigniew Piotrak from [AFINE Team](https://www.afine.pl/) diff --git a/README.md b/README.md index 8ae953e7..b8ff380e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Html2Pdf -Html2Pdf is a HTML to PDF converter written in PHP, and compatible with PHP **5.6** to **8.2**. +Html2Pdf is a HTML to PDF converter written in PHP, and compatible with PHP **7.2** to **8.4**. It allows the conversion of valid HTML in PDF format, to generate documents like invoices, documentation, ... @@ -14,7 +14,7 @@ It uses TCPDF for the PDF part. ## Requirements -Html2Pdf works with PHP >5.6 and Composer. +Html2Pdf works with PHP >7.2 and Composer. You will also need at least the following php extensions: @@ -27,7 +27,7 @@ You will find the install documentation [here](./doc/install.md). You will find all the documentation [here](./doc/README.md). -You will find lots of examples [here](./examples/). +You will find lots of examples [here](./examples). ## Donate diff --git a/composer.json b/composer.json index c0522717..399dd15d 100644 --- a/composer.json +++ b/composer.json @@ -13,10 +13,10 @@ } ], "require": { - "php": "^5.6 || ^7.0 || ^8.0", + "php": "^7.2 || ^8.0", "ext-mbstring": "*", "ext-gd": "*", - "tecnickcom/tcpdf": "^6.3" + "tecnickcom/tcpdf": "^6.8" }, "require-dev": { "phpunit/phpunit": "^5.0 || ^9.0" diff --git a/examples/res/about.php b/examples/res/about.php index fbf3f062..9997cb8c 100644 --- a/examples/res/about.php +++ b/examples/res/about.php @@ -87,6 +87,7 @@
  • <s> : Texte barré
  • <small> : Ecrire plus petit.
  • <style>
  • +
  • <strike> : Exemple texte barré.
  • <sup> : Exemplehaut.
  • <sub> : Exemplebas.
  • <u> : Texte souligné
  • diff --git a/src/Extension/Core/HtmlExtension.php b/src/Extension/Core/HtmlExtension.php index c47b7a96..72ab8501 100644 --- a/src/Extension/Core/HtmlExtension.php +++ b/src/Extension/Core/HtmlExtension.php @@ -40,6 +40,7 @@ protected function initTags() new Html\Cite(), new Html\Del(), new Html\Em(), + new Html\Figure(), new Html\Font(), new Html\I(), new Html\Ins(), @@ -52,7 +53,7 @@ protected function initTags() new Html\Sub(), new Html\Sup(), new Html\U(), - new Html\StrikeTag(), + new Html\Strike(), ); } } diff --git a/src/Html2Pdf.php b/src/Html2Pdf.php index 00c740cf..b6d0f95c 100755 --- a/src/Html2Pdf.php +++ b/src/Html2Pdf.php @@ -246,8 +246,8 @@ public function getVersionAsArray() { return array( 'major' => 5, - 'minor' => 2, - 'revision' => 8 + 'minor' => 3, + 'revision' => 0 ); } @@ -385,7 +385,7 @@ protected function getTagObject($tagName) * * @return Html2Pdf $this */ - public function setModeDebug($debugObject = null) + public function setModeDebug(?DebugInterface $debugObject = null) { if (is_null($debugObject)) { $this->debug = new Debug(); diff --git a/src/Locale.php b/src/Locale.php index 8e8a04d0..9dbd1839 100644 --- a/src/Locale.php +++ b/src/Locale.php @@ -81,12 +81,7 @@ public static function load($code) self::$list = array(); $handle = fopen($file, 'r'); while (!feof($handle)) { - if (PHP_VERSION_ID >= 80400) { - // As of PHP 8.4.0, depending on the default value of escape is deprecated. - $line = fgetcsv($handle, null, ',', '"', '\\'); - } else { - $line = fgetcsv($handle); - } + $line = fgetcsv($handle, null, ',', '"', '\\'); if (!is_array($line) || count($line) !=2) { continue; } diff --git a/src/Tag/Html/StrikeTag.php b/src/Tag/Html/Strike.php similarity index 75% rename from src/Tag/Html/StrikeTag.php rename to src/Tag/Html/Strike.php index 838d4a6b..417f7860 100644 --- a/src/Tag/Html/StrikeTag.php +++ b/src/Tag/Html/Strike.php @@ -9,27 +9,30 @@ * @author Laurent MINGUET * @copyright 2017 Laurent MINGUET */ - namespace Spipu\Html2Pdf\Tag\Html; + use Spipu\Html2Pdf\Tag\AbstractHtmlTag; + /** - * Tag StrikeTag + * Tag Strike */ -class StrikeTag extends AbstractHtmlTag +class Strike extends AbstractHtmlTag { - public function __construct() - { - parent::__construct('strike'); - } - + /** + * @inheritdoc + */ public function getName() { return 'strike'; } + /** + * @inheritdoc + */ protected function overrideStyles() { $this->parsingCss->value['font-linethrough'] = true; - return true; + + return $this; } -} \ No newline at end of file +}