mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-10-06 20:09:01 +00:00
43b3151526
Tcpdf is an optional package, but we do make a number of tests of it in our unit test suite. We will continue to support it for now. We are considering dropping support for it at the next PhpSpreadsheet major release. As an early assessment, there is much too much work involved supporting `tc-lib-pdf` directly; we are not likely ever to move in that direction. Tcpdf V7 is a bridge version. It is not deprecated (yet), and does not require much in the way of coding changes, but it requires users to supply their own font files; this is relatively easily done in Unix, but it is much harder in Windows. In addition, our test suite can't test satisfactorily with both V6 and V7. We may at some point consider supporting V7, but it is likely that the Windows difficulties will have to be dealt with before we can do so. This PR includes some very minor coding changes which will not harm V6 and will help in migrating to V7 if we choose that route.
53 lines
1.2 KiB
PHP
53 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
setlocale(LC_ALL, 'en_US.utf8');
|
|
ini_set('error_reporting', (string) E_ALL);
|
|
|
|
if (!defined('K_PATH_FONTS')) {
|
|
$path1 = __DIR__ . '/..'
|
|
. '/vendor/tecnickcom/tc-lib-pdf-font';
|
|
$realpath1 = realpath($path1);
|
|
if ($realpath1 !== false) {
|
|
$path = __DIR__ . '/..'
|
|
. '/tclibpdffonts/fonts/';
|
|
$path = realpath($path);
|
|
if ($path !== false) {
|
|
define(
|
|
'K_PATH_FONTS',
|
|
$path
|
|
);
|
|
}
|
|
}
|
|
}
|
|
|
|
function phpunit10ErrorHandler(int $errno, string $errstr, string $filename, int $lineno): bool
|
|
{
|
|
$x = error_reporting() & $errno;
|
|
if (
|
|
in_array(
|
|
$errno,
|
|
[
|
|
E_DEPRECATED,
|
|
E_WARNING,
|
|
E_NOTICE,
|
|
E_USER_DEPRECATED,
|
|
E_USER_NOTICE,
|
|
E_USER_WARNING,
|
|
],
|
|
true
|
|
)
|
|
) {
|
|
if (0 === $x) {
|
|
return true; // message suppressed - stop error handling
|
|
}
|
|
|
|
throw new Exception("$errstr $filename $lineno");
|
|
}
|
|
|
|
return false; // continue error handling
|
|
}
|
|
|
|
set_error_handler('phpunit10ErrorHandler');
|