Skip to content

Commit

Permalink
bump supported phpversion from **5.6 -> 8.2** to **7.2 -> 8.4**
Browse files Browse the repository at this point in the history
improve some bad codes
  • Loading branch information
spipu committed Jan 8, 2025
1 parent 3c19d12 commit f69a848
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 28 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@ jobs:
strategy:
matrix:
php-version:
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/)
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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, ...

Expand All @@ -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:

Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions examples/res/about.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
<li>&lt;s&gt; : Texte <s>barré</s></li>
<li>&lt;small&gt; : Ecrire plus <small>petit</small>.</li>
<li>&lt;style&gt;</li>
<li>&lt;strike&gt; : Exemple <strike>texte barré</strike>.</li>
<li>&lt;sup&gt; : Exemple<sup>haut</sup>.</li>
<li>&lt;sub&gt; : Exemple<sub>bas</sub>.</li>
<li>&lt;u&gt; : Texte <u>souligné</u></li>
Expand Down
3 changes: 2 additions & 1 deletion src/Extension/Core/HtmlExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -52,7 +53,7 @@ protected function initTags()
new Html\Sub(),
new Html\Sup(),
new Html\U(),
new Html\StrikeTag(),
new Html\Strike(),
);
}
}
6 changes: 3 additions & 3 deletions src/Html2Pdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ public function getVersionAsArray()
{
return array(
'major' => 5,
'minor' => 2,
'revision' => 8
'minor' => 3,
'revision' => 0
);
}

Expand Down Expand Up @@ -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();
Expand Down
7 changes: 1 addition & 6 deletions src/Locale.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
23 changes: 13 additions & 10 deletions src/Tag/Html/StrikeTag.php → src/Tag/Html/Strike.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,30 @@
* @author Laurent MINGUET <[email protected]>
* @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;
}
}
}

0 comments on commit f69a848

Please sign in to comment.