mirror of
https://github.com/tecnickcom/TCPDF.git
synced 2025-04-14 02:51:56 +02:00
PHP error fixes and final phpdoc fixes (#348)
* Fix a PHP array offset error * Fix PHP 8.1 type error with TCPDF_STATIC::pregSplit on preg_split * More phpdoc blocks fixes * Add CHANGELOG entries * Update file descriptions for barcode examples Co-authored-by: Nicola Asuni <nicolaasuni@users.noreply.github.com>
This commit is contained in:
parent
989a00f330
commit
c979d00f60
@ -1,3 +1,10 @@
|
||||
|
||||
6.4.2 (2021-04-02)
|
||||
- Fix PHP 8.1 type error with TCPDF_STATIC::pregSplit on preg_split
|
||||
- Fix a PHP array offset error
|
||||
- Fixed phpdoc blocks
|
||||
- Drop a PHP 4 polyfill and add a .gitattributes file
|
||||
|
||||
6.4.1 (2021-03-27)
|
||||
- Update tcpdf version (no code changes)
|
||||
|
||||
|
@ -27,13 +27,13 @@
|
||||
// See LICENSE.TXT file for more information.
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// Description : Example for tcpdf_barcodes_2d.php class
|
||||
// Description : Example for tcpdf_barcodes_1d.php class
|
||||
//
|
||||
//============================================================+
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Example for tcpdf_barcodes_2d.php class
|
||||
* Example for tcpdf_barcodes_1d.php class
|
||||
* @package com.tecnick.tcpdf
|
||||
* @author Nicola Asuni
|
||||
* @version 1.0.000
|
||||
|
@ -27,13 +27,13 @@
|
||||
// See LICENSE.TXT file for more information.
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// Description : Example for tcpdf_barcodes_2d.php class
|
||||
// Description : Example for tcpdf_barcodes_1d.php class
|
||||
//
|
||||
//============================================================+
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Example for tcpdf_barcodes_2d.php class
|
||||
* Example for tcpdf_barcodes_1d.php class
|
||||
* @package com.tecnick.tcpdf
|
||||
* @author Nicola Asuni
|
||||
* @version 1.0.000
|
||||
|
@ -27,13 +27,13 @@
|
||||
// See LICENSE.TXT file for more information.
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// Description : Example for tcpdf_barcodes_2d.php class
|
||||
// Description : Example for tcpdf_barcodes_1d.php class
|
||||
//
|
||||
//============================================================+
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Example for tcpdf_barcodes_2d.php class
|
||||
* Example for tcpdf_barcodes_1d.php class
|
||||
* @package com.tecnick.tcpdf
|
||||
* @author Nicola Asuni
|
||||
* @version 1.0.000
|
||||
|
@ -27,13 +27,13 @@
|
||||
// See LICENSE.TXT file for more information.
|
||||
// -------------------------------------------------------------------
|
||||
//
|
||||
// Description : Example for tcpdf_barcodes_2d.php class
|
||||
// Description : Example for tcpdf_barcodes_1d.php class
|
||||
//
|
||||
//============================================================+
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Example for tcpdf_barcodes_2d.php class
|
||||
* Example for tcpdf_barcodes_1d.php class
|
||||
* @package com.tecnick.tcpdf
|
||||
* @author Nicola Asuni
|
||||
* @version 1.0.000
|
||||
|
@ -2449,7 +2449,7 @@ class QRcode {
|
||||
/**
|
||||
* Return BCH encoded version information pattern that is used for the symbol of version 7 or greater. Use lower 18 bits.
|
||||
* @param int $version version
|
||||
* @return BCH encoded version information pattern
|
||||
* @return string BCH encoded version information pattern
|
||||
*/
|
||||
protected function getVersionPattern($version) {
|
||||
if (($version < 7) OR ($version > QRSPEC_VERSION_MAX)) {
|
||||
@ -2462,7 +2462,7 @@ class QRcode {
|
||||
* Return BCH encoded format information pattern.
|
||||
* @param array $mask
|
||||
* @param int $level error correction level
|
||||
* @return BCH encoded format information pattern
|
||||
* @return string BCH encoded format information pattern
|
||||
*/
|
||||
protected function getFormatInfo($mask, $level) {
|
||||
if (($mask < 0) OR ($mask > 7)) {
|
||||
@ -2500,7 +2500,7 @@ class QRcode {
|
||||
/**
|
||||
* Return a copy of initialized frame.
|
||||
* @param int $version version
|
||||
* @return Array of unsigned char.
|
||||
* @return array array of unsigned char.
|
||||
*/
|
||||
protected function createFrame($version) {
|
||||
$width = $this->capacity[$version][QRCAP_WIDTH];
|
||||
@ -2565,7 +2565,7 @@ class QRcode {
|
||||
/**
|
||||
* Set new frame for the specified version.
|
||||
* @param int $version version
|
||||
* @return Array of unsigned char.
|
||||
* @return array array of unsigned char.
|
||||
*/
|
||||
protected function newFrame($version) {
|
||||
if (($version < 1) OR ($version > QRSPEC_VERSION_MAX)) {
|
||||
|
@ -72,7 +72,7 @@ class TCPDF_FILTERS {
|
||||
* Decode data using the specified filter type.
|
||||
* @param string $filter Filter name.
|
||||
* @param string $data Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@ -131,7 +131,7 @@ class TCPDF_FILTERS {
|
||||
* Standard
|
||||
* Default decoding filter (leaves data unchanged).
|
||||
* @param string $data Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@ -143,7 +143,7 @@ class TCPDF_FILTERS {
|
||||
* ASCIIHexDecode
|
||||
* Decodes data encoded in an ASCII hexadecimal representation, reproducing the original binary data.
|
||||
* @param string $data Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@ -183,7 +183,7 @@ class TCPDF_FILTERS {
|
||||
* ASCII85Decode
|
||||
* Decodes data encoded in an ASCII base-85 representation, reproducing the original binary data.
|
||||
* @param string $data Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@ -267,7 +267,7 @@ class TCPDF_FILTERS {
|
||||
* LZWDecode
|
||||
* Decompresses data encoded using the LZW (Lempel-Ziv-Welch) adaptive compression method, reproducing the original text or binary data.
|
||||
* @param string $data Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@ -348,7 +348,7 @@ class TCPDF_FILTERS {
|
||||
* FlateDecode
|
||||
* Decompresses data encoded using the zlib/deflate compression method, reproducing the original text or binary data.
|
||||
* @param string $data Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@ -401,7 +401,7 @@ class TCPDF_FILTERS {
|
||||
* CCITTFaxDecode (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decompresses data encoded using the CCITT facsimile standard, reproducing the original data (typically monochrome image data at 1 bit per pixel).
|
||||
* @param string $data Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@ -414,7 +414,7 @@ class TCPDF_FILTERS {
|
||||
* JBIG2Decode (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decompresses data encoded using the JBIG2 standard, reproducing the original monochrome (1 bit per pixel) image data (or an approximation of that data).
|
||||
* @param string $data Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@ -427,7 +427,7 @@ class TCPDF_FILTERS {
|
||||
* DCTDecode (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decompresses data encoded using a DCT (discrete cosine transform) technique based on the JPEG standard, reproducing image sample data that approximates the original data.
|
||||
* @param string $data Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@ -440,7 +440,7 @@ class TCPDF_FILTERS {
|
||||
* JPXDecode (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decompresses data encoded using the wavelet-based JPEG2000 standard, reproducing the original image data.
|
||||
* @param string $data Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@ -453,7 +453,7 @@ class TCPDF_FILTERS {
|
||||
* Crypt (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decrypts data encrypted by a security handler, reproducing the data as it was before encryption.
|
||||
* @param string $data Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
|
@ -164,12 +164,15 @@ class TCPDF_STATIC {
|
||||
/**
|
||||
* Check if the URL exist.
|
||||
* @param string $url URL to check.
|
||||
* @return Boolean true if the URl exist, false otherwise.
|
||||
* @return boolean true if the URl exist, false otherwise.
|
||||
* @since 5.9.204 (2013-01-28)
|
||||
* @public static
|
||||
*/
|
||||
public static function isValidURL($url) {
|
||||
$headers = @get_headers($url);
|
||||
if ($headers === false) {
|
||||
return false;
|
||||
}
|
||||
return (strpos($headers[0], '200') !== false);
|
||||
}
|
||||
|
||||
@ -1795,6 +1798,9 @@ class TCPDF_STATIC {
|
||||
* @public static
|
||||
*/
|
||||
public static function pregSplit($pattern, $modifiers, $subject, $limit=NULL, $flags=NULL) {
|
||||
// PHP 8.1 deprecates nulls for $limit and $flags
|
||||
$limit = $limit === null ? -1 : $limit;
|
||||
$flags = $flags === null ? 0 : $flags;
|
||||
// the bug only happens on PHP 5.2 when using the u modifier
|
||||
if ((strpos($modifiers, 'u') === FALSE) OR (count(preg_split('//u', "\n\t", -1, PREG_SPLIT_NO_EMPTY)) == 2)) {
|
||||
return preg_split($pattern.$modifiers, $subject, $limit, $flags);
|
||||
|
@ -2366,8 +2366,8 @@ class TCPDF {
|
||||
|
||||
/**
|
||||
* Enable or disable Right-To-Left language mode
|
||||
* @param Boolean $enable if true enable Right-To-Left language mode.
|
||||
* @param Boolean $resetx if true reset the X position on direction change.
|
||||
* @param boolean $enable if true enable Right-To-Left language mode.
|
||||
* @param boolean $resetx if true reset the X position on direction change.
|
||||
* @public
|
||||
* @since 2.0.000 (2008-01-03)
|
||||
*/
|
||||
@ -22086,7 +22086,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
|
||||
|
||||
/**
|
||||
* Return the text shadow parameters array.
|
||||
* @return Array of parameters.
|
||||
* @return array array of parameters.
|
||||
* @since 5.9.174 (2012-07-25)
|
||||
* @public
|
||||
*/
|
||||
|
@ -162,7 +162,7 @@ class TCPDF_PARSER {
|
||||
* Get Cross-Reference (xref) table and trailer data from PDF document data.
|
||||
* @param int $offset xref offset (if know).
|
||||
* @param array $xref previous xref array (if any).
|
||||
* @return Array containing xref and trailer data.
|
||||
* @return array containing xref and trailer data.
|
||||
* @protected
|
||||
* @since 1.0.000 (2011-05-24)
|
||||
*/
|
||||
@ -204,7 +204,7 @@ class TCPDF_PARSER {
|
||||
* Decode the Cross-Reference section
|
||||
* @param int $startxref Offset at which the xref section starts (position of the 'xref' keyword).
|
||||
* @param array $xref Previous xref array (if any).
|
||||
* @return Array containing xref and trailer data.
|
||||
* @return array containing xref and trailer data.
|
||||
* @protected
|
||||
* @since 1.0.000 (2011-06-20)
|
||||
*/
|
||||
@ -276,7 +276,7 @@ class TCPDF_PARSER {
|
||||
* Decode the Cross-Reference Stream section
|
||||
* @param int $startxref Offset at which the xref section starts.
|
||||
* @param array $xref Previous xref array (if any).
|
||||
* @return Array containing xref and trailer data.
|
||||
* @return array containing xref and trailer data.
|
||||
* @protected
|
||||
* @since 1.0.003 (2013-03-16)
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user