Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ["8.1", "8.2", "8.3", "8.4"]
php-version: ["8.1", "8.2", "8.3", "8.4", "8.5"]
experimental: [false]
os: [ubuntu-latest]
coverage-extension: [pcov]
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ COMPOSER=$(PHP) -d "apc.enable_cli=0" $(shell which composer)
PHPDOC=$(shell which phpDocumentor)

# phpstan version
PHPSTANVER=2.1.32
PHPSTANVER=2.1.33

# --- MAKE TARGETS ---

Expand Down Expand Up @@ -126,7 +126,7 @@ x: buildall
# Full build and test sequence
.PHONY: buildall
buildall: deps
cd vendor/tecnickcom/tc-lib-pdf-font/ && make buildall
cd vendor/tecnickcom/tc-lib-pdf-font/ && make deps fonts
$(MAKE) codefix qa bz2 rpm deb

# Package the library in a compressed bz2 archive
Expand Down Expand Up @@ -223,7 +223,7 @@ endif
.PHONY: lint
lint:
./vendor/bin/phpcbf --config-set ignore_non_auto_fixable_on_exit 1
./vendor/bin/phpcs --ignore="\./vendor/" --standard=phpcs.xml src test
./vendor/bin/phpcs --standard=phpcs.xml
./vendor/bin/phpmd src text unusedcode,naming,design --exclude vendor
./vendor/bin/phpmd test text unusedcode,naming,design --exclude */vendor/*
php -r 'exit((int)version_compare(PHP_MAJOR_VERSION, "7", ">"));' || ./vendor/phpstan.phar analyse
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8.2.8
8.3.1
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,17 @@
"tecnickcom/tc-lib-pdf-page": "^4.3",
"tecnickcom/tc-lib-pdf-graph": "^2.4"
},
"config": {
"allow-plugins": {
"dealerdirect/phpcodesniffer-composer-installer": true
}
},
"require-dev": {
"pdepend/pdepend": "2.16.2",
"phpmd/phpmd": "2.15.0",
"phpunit/phpunit": "12.4.4 || 11.5.44 || 10.5.58",
"squizlabs/php_codesniffer": "4.0.1"
"squizlabs/php_codesniffer": "4.0.1",
"phpcompatibility/php-compatibility": "^10.0.0@dev"
},
"autoload": {
"psr-4": {
Expand Down
13 changes: 8 additions & 5 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
<?xml version="1.0"?>
<ruleset name="backward-compatibility">
<description>PSR-12 for PHP less than 7.1</description>
<rule ref="PSR12">
<exclude name="PSR12.Properties.ConstantVisibility"/>
</rule>
<ruleset name="PHP-compatibility">
<description>Test code for compatibility with supported PHP versions</description>
<rule ref="PHPCompatibility"/>
<config name="testVersion" value="8.1-8.5"/>
<file>src</file>
<file>test</file>
<exclude-pattern>./vendor/*</exclude-pattern>
<arg value="ps"/>
</ruleset>
2 changes: 1 addition & 1 deletion resources/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ Vcs-Git: https://github.com/~#VENDOR#~/~#PROJECT#~.git
Package: ~#PKGNAME#~
Provides: php-~#PROJECT#~
Architecture: all
Depends: php (>= 8.1.0), php-date, php-tecnickcom-tc-lib-barcode (<< 3.0.0), php-tecnickcom-tc-lib-barcode (>= 2.4.17), php-tecnickcom-tc-lib-color (<< 3.0.0), php-tecnickcom-tc-lib-color (>= 2.3.3), php-tecnickcom-tc-lib-pdf-image (<< 3.0.0), php-tecnickcom-tc-lib-pdf-image (>= 2.1.23), php-tecnickcom-tc-lib-pdf-font (<< 3.0.0), php-tecnickcom-tc-lib-pdf-font (>= 2.6.21), php-tecnickcom-tc-lib-file (<< 3.0.0), php-tecnickcom-tc-lib-file (>= 2.2.11), php-tecnickcom-tc-lib-pdf-encrypt (<< 3.0.0), php-tecnickcom-tc-lib-pdf-encrypt (>= 2.1.25), php-tecnickcom-tc-lib-unicode-data (<< 3.0.0), php-tecnickcom-tc-lib-unicode-data (>= 2.0.33), php-tecnickcom-tc-lib-unicode (<< 3.0.0), php-tecnickcom-tc-lib-unicode (>= 2.0.34), php-tecnickcom-tc-lib-pdf-page (<< 5.0.0), php-tecnickcom-tc-lib-pdf-page (>= 4.3.2), php-tecnickcom-tc-lib-pdf-graph (<< 3.0.0), php-tecnickcom-tc-lib-pdf-graph (>= 2.4.1), ${misc:Depends}
Depends: php (>= 8.1.0), php-date, php-tecnickcom-tc-lib-barcode (<< 3.0.0), php-tecnickcom-tc-lib-barcode (>= 2.4.18), php-tecnickcom-tc-lib-color (<< 3.0.0), php-tecnickcom-tc-lib-color (>= 2.3.2), php-tecnickcom-tc-lib-pdf-image (<< 3.0.0), php-tecnickcom-tc-lib-pdf-image (>= 2.1.24), php-tecnickcom-tc-lib-pdf-font (<< 3.0.0), php-tecnickcom-tc-lib-pdf-font (>= 2.6.22), php-tecnickcom-tc-lib-file (<< 3.0.0), php-tecnickcom-tc-lib-file (>= 2.2.12), php-tecnickcom-tc-lib-pdf-encrypt (<< 3.0.0), php-tecnickcom-tc-lib-pdf-encrypt (>= 2.1.26), php-tecnickcom-tc-lib-unicode-data (<< 3.0.0), php-tecnickcom-tc-lib-unicode-data (>= 2.0.34), php-tecnickcom-tc-lib-unicode (<< 3.0.0), php-tecnickcom-tc-lib-unicode (>= 2.0.35), php-tecnickcom-tc-lib-pdf-page (<< 5.0.0), php-tecnickcom-tc-lib-pdf-page (>= 4.3.3), php-tecnickcom-tc-lib-pdf-graph (<< 3.0.0), php-tecnickcom-tc-lib-pdf-graph (>= 2.4.2), ${misc:Depends}
Description: PHP Barcode library
This library includes PHP classes to generate PDF documents.
20 changes: 10 additions & 10 deletions resources/rpm/rpm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -20,25 +20,25 @@ Requires: php(language) >= 8.1.0
Requires: php-date
Requires: php-pcre
Requires: php-composer(%{c_vendor}/tc-lib-barcode) < 3.0.0
Requires: php-composer(%{c_vendor}/tc-lib-barcode) >= 2.4.17
Requires: php-composer(%{c_vendor}/tc-lib-barcode) >= 2.4.18
Requires: php-composer(%{c_vendor}/tc-lib-color) < 3.0.0
Requires: php-composer(%{c_vendor}/tc-lib-color) >= 2.3.3
Requires: php-composer(%{c_vendor}/tc-lib-color) >= 2.3.2
Requires: php-composer(%{c_vendor}/tc-lib-pdf-image) < 3.0.0
Requires: php-composer(%{c_vendor}/tc-lib-pdf-image) >= 2.1.23
Requires: php-composer(%{c_vendor}/tc-lib-pdf-image) >= 2.1.24
Requires: php-composer(%{c_vendor}/tc-lib-pdf-font) < 3.0.0
Requires: php-composer(%{c_vendor}/tc-lib-pdf-font) >= 2.6.21
Requires: php-composer(%{c_vendor}/tc-lib-pdf-font) >= 2.6.22
Requires: php-composer(%{c_vendor}/tc-lib-file) < 3.0.0
Requires: php-composer(%{c_vendor}/tc-lib-file) >= 2.2.11
Requires: php-composer(%{c_vendor}/tc-lib-file) >= 2.2.12
Requires: php-composer(%{c_vendor}/tc-lib-pdf-encrypt) < 3.0.0
Requires: php-composer(%{c_vendor}/tc-lib-pdf-encrypt) >= 2.1.25
Requires: php-composer(%{c_vendor}/tc-lib-pdf-encrypt) >= 2.1.26
Requires: php-composer(%{c_vendor}/tc-lib-unicode-data) < 3.0.0
Requires: php-composer(%{c_vendor}/tc-lib-unicode-data) >= 2.0.33
Requires: php-composer(%{c_vendor}/tc-lib-unicode-data) >= 2.0.34
Requires: php-composer(%{c_vendor}/tc-lib-unicode) < 3.0.0
Requires: php-composer(%{c_vendor}/tc-lib-unicode) >= 2.0.34
Requires: php-composer(%{c_vendor}/tc-lib-unicode) >= 2.0.35
Requires: php-composer(%{c_vendor}/tc-lib-pdf-page) < 5.0.0
Requires: php-composer(%{c_vendor}/tc-lib-pdf-page) >= 4.3.2
Requires: php-composer(%{c_vendor}/tc-lib-pdf-page) >= 4.3.3
Requires: php-composer(%{c_vendor}/tc-lib-pdf-graph) < 3.0.0
Requires: php-composer(%{c_vendor}/tc-lib-pdf-graph) >= 2.4.1
Requires: php-composer(%{c_vendor}/tc-lib-pdf-graph) >= 2.4.2

Provides: php-composer(%{c_vendor}/%{gh_project}) = %{version}
Provides: php-%{gh_project} = %{version}
Expand Down
2 changes: 1 addition & 1 deletion src/Base.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ abstract class Base
/**
* TCPDF version.
*/
protected string $version = '8.2.8';
protected string $version = '8.3.1';

/**
* Time is seconds since EPOCH when the document was created.
Expand Down
29 changes: 28 additions & 1 deletion src/HTML.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,34 @@
*/
abstract class HTML extends \Com\Tecnick\Pdf\JavaScript
{
//@TODO: add missing methods
//@TODO: to be completed

/**
* Valid bullet types for list-items
*
* @var array<string>
*/
protected const LIST_SYMBOL = [
'!',
'#',
'1',
'A',
'I',
'a',
'circle',
'decimal',
'decimal-leading-zero',
'disc',
'i',
'lower-alpha',
'lower-greek',
'lower-latin',
'lower-roman',
'square',
'upper-alpha',
'upper-latin',
'upper-roman',
];

/**
* Cleanup HTML code (requires HTML Tidy library).
Expand Down
14 changes: 7 additions & 7 deletions src/MetaInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ private function setNonEmptyFieldValue(string $field, string $value): static
private function setNonEmptyArrayFieldValue(string $field, string $key, string $value): static
{
if (
isset($this->$field)
&& \is_array($this->$field)
isset($this->{$field})
&& \is_array($this->{$field})
&& ($key !== '')
&& isset($this->$field[$key])
&& isset($this->{$field}[$key])
&& ($value !== '')
) {
$this->$field[$key] = $value;
$this->{$field}[$key] = $value;
}

return $this;
Expand Down Expand Up @@ -459,10 +459,10 @@ protected function getPageBoxName(string $name): string
if (isset($this->viewerpref[$name])) {
$val = $this->viewerpref[$name];
if (
isset($this->page->$box[$val]) // @phpstan-ignore offsetAccess.nonOffsetAccessible
&& \is_string($this->page->$box[$val])
isset($this->page->{$box}[$val]) // @phpstan-ignore offsetAccess.nonOffsetAccessible
&& \is_string($this->page->{$box}[$val])
) {
$box = $this->page->$box[$val];
$box = $this->page->{$box}[$val];
}
}

Expand Down
18 changes: 8 additions & 10 deletions src/SVG.php
Original file line number Diff line number Diff line change
Expand Up @@ -4014,8 +4014,6 @@ public function addSVG(

// creates a new XML parser to be used by the other XML functions
$parser = \xml_parser_create('UTF-8');
// the following function allows to use parser inside object
\xml_set_object($parser, $this);
// disable case-folding for this XML parser
\xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0);
// sets the element handler functions for the XML parser
Expand All @@ -4025,17 +4023,17 @@ public function addSVG(

// start parsing an XML document
if (!\xml_parse($parser, $data)) {
throw new PdfException(\sprintf(
'SVG Error: %s at line %d',
\xml_error_string(
\xml_get_error_code($parser)
throw new PdfException(
\sprintf(
'SVG Error: %s at line %d',
\xml_error_string(
\xml_get_error_code($parser)
),
\xml_get_current_line_number($parser),
),
\xml_get_current_line_number($parser),
),);
);
}

// free this XML parser
\xml_parser_free($parser);
// >= PHP 7.0.0 "explicitly unset the reference to parser to avoid memory leaks"
unset($parser);

Expand Down
20 changes: 13 additions & 7 deletions src/Text.php
Original file line number Diff line number Diff line change
Expand Up @@ -1109,12 +1109,16 @@ protected function getOutUTOLine(
*/
public function getLastBBox(): array
{
return $this->bbox[\array_key_last($this->bbox)] ?? [
'x' => 0.0,
'y' => 0.0,
'w' => 0.0,
'h' => 0.0,
];
$idx = \array_key_last($this->bbox);
if ($idx === null || empty($this->bbox[$idx])) {
return [
'x' => 0.0,
'y' => 0.0,
'w' => 0.0,
'h' => 0.0,
];
}
return $this->bbox[$idx];
}

/**
Expand Down Expand Up @@ -1451,7 +1455,9 @@ public function loadTexHyphenPatterns(string $file): array

$val = \str_replace("'", '\\\'', \trim($val));
$key = \preg_replace('/\d+/', '', $val);
$pattern[$key] = $val;
if ($key !== null) {
$pattern[$key] = $val;
}
}

return $pattern;
Expand Down
Loading