Skip to content

Commit 354433a

Browse files
committed
6.2.11 (2015-08-02)
- Bug #1070 "PNG regression in 6.2.9 (they appear as their alpha channel)" was fixed. - Bug #1069 "Encoded SRC URLs in <img> tags don't work anymore" was fixed.
1 parent 25394f7 commit 354433a

File tree

5 files changed

+84
-66
lines changed

5 files changed

+84
-66
lines changed

CHANGELOG.TXT

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
6.2.11 (2015-08-02)
2+
- Bug #1070 "PNG regression in 6.2.9 (they appear as their alpha channel)" was fixed.
3+
- Bug #1069 "Encoded SRC URLs in <img> tags don't work anymore" was fixed.
4+
15
6.2.10 (2015-07-28)
26
- Minor mod to PNG parsing.
37
- Make dependency on mcrypt optional.

README.TXT

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ TCPDF - README
44
I WISH TO IMPROVE AND EXPAND TCPDF BUT I NEED YOUR SUPPORT.
55
PLEASE MAKE A DONATION:
66
http://sourceforge.net/donate/index.php?group_id=128076
7+
or via PayPal at [email protected]
78

89
------------------------------------------------------------
910

1011
Name: TCPDF
11-
Version: 6.2.10
12-
Release date: 2015-07-28
12+
Version: 6.2.11
13+
Release date: 2015-08-02
1314
Author: Nicola Asuni
1415

1516
Copyright (c) 2002-2015:
@@ -20,6 +21,7 @@ Copyright (c) 2002-2015:
2021
URLs:
2122
http://www.tcpdf.org
2223
http://www.sourceforge.net/projects/tcpdf
24+
https://github.com/tecnickcom/TCPDF
2325

2426
Description:
2527
TCPDF is a PHP class for generating PDF files on-the-fly without requiring external extensions.

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tecnick.com/tcpdf",
3-
"version": "6.2.10",
3+
"version": "6.2.11",
44
"homepage": "http://www.tcpdf.org/",
55
"type": "library",
66
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",

include/tcpdf_static.php

+74-61
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class TCPDF_STATIC {
5555
* Current TCPDF version.
5656
* @private static
5757
*/
58-
private static $tcpdf_version = '6.2.10';
58+
private static $tcpdf_version = '6.2.11';
5959

6060
/**
6161
* String alias for total number of pages.
@@ -2476,77 +2476,90 @@ public static function fopenLocal($filename, $mode) {
24762476
* @public static
24772477
*/
24782478
public static function fileGetContents($file) {
2479-
//$file = html_entity_decode($file);
2480-
// array of possible alternative paths/URLs
24812479
$alt = array($file);
2482-
// replace URL relative path with full real server path
2480+
//
24832481
if ((strlen($file) > 1)
2484-
AND ($file[0] == '/')
2485-
AND ($file[1] != '/')
2486-
AND !empty($_SERVER['DOCUMENT_ROOT'])
2487-
AND ($_SERVER['DOCUMENT_ROOT'] != '/')) {
2488-
$findroot = strpos($file, $_SERVER['DOCUMENT_ROOT']);
2489-
if (($findroot === false) OR ($findroot > 1)) {
2490-
if (substr($_SERVER['DOCUMENT_ROOT'], -1) == '/') {
2491-
$tmp = substr($_SERVER['DOCUMENT_ROOT'], 0, -1).$file;
2492-
} else {
2493-
$tmp = $_SERVER['DOCUMENT_ROOT'].$file;
2494-
}
2495-
$alt[] = htmlspecialchars_decode(urldecode($tmp));
2496-
}
2497-
}
2498-
// URL mode
2482+
&& ($file[0] === '/')
2483+
&& ($file[1] !== '/')
2484+
&& !empty($_SERVER['DOCUMENT_ROOT'])
2485+
&& ($_SERVER['DOCUMENT_ROOT'] !== '/')
2486+
) {
2487+
$findroot = strpos($file, $_SERVER['DOCUMENT_ROOT']);
2488+
if (($findroot === false) || ($findroot > 1)) {
2489+
$alt[] = htmlspecialchars_decode(urldecode($_SERVER['DOCUMENT_ROOT'].$file));
2490+
}
2491+
}
2492+
//
2493+
$protocol = 'http';
2494+
if (!empty($_SERVER['HTTPS']) && (strtolower($_SERVER['HTTPS']) != 'off')) {
2495+
$protocol .= 's';
2496+
}
2497+
//
24992498
$url = $file;
2500-
// check for missing protocol
2501-
if (preg_match('%^/{2}%', $url)) {
2502-
if (preg_match('%^([^:]+:)//%i', K_PATH_URL, $match)) {
2503-
$url = $match[1].str_replace(' ', '%20', $url);
2504-
$alt[] = $url;
2499+
if (preg_match('%^//%', $url) && !empty($_SERVER['HTTP_HOST'])) {
2500+
$url = $protocol.':'.str_replace(' ', '%20', $url);
2501+
}
2502+
$url = htmlspecialchars_decode($url);
2503+
$alt[] = $url;
2504+
//
2505+
if (preg_match('%^(https?)://%', $url)
2506+
&& empty($_SERVER['HTTP_HOST'])
2507+
&& empty($_SERVER['DOCUMENT_ROOT'])
2508+
) {
2509+
$urldata = parse_url($url);
2510+
if (empty($urldata['query'])) {
2511+
$host = $protocol.'://'.$_SERVER['HTTP_HOST'];
2512+
if (strpos($url, $host) === 0) {
2513+
// convert URL to full server path
2514+
$tmp = str_replace($host, $_SERVER['DOCUMENT_ROOT'], $url);
2515+
$alt[] = htmlspecialchars_decode(urldecode($tmp));
2516+
}
25052517
}
25062518
}
2507-
$urldata = @parse_url($url);
2508-
if (!isset($urldata['query']) OR (strlen($urldata['query']) <= 0)) {
2509-
if (K_PATH_URL AND (strpos($url, K_PATH_URL) === 0)) {
2510-
// convert URL to full server path
2511-
$tmp = str_replace(K_PATH_URL, K_PATH_MAIN, $url);
2512-
$tmp = htmlspecialchars_decode(urldecode($tmp));
2513-
$alt[] = $tmp;
2519+
//
2520+
if (isset($_SERVER['SCRIPT_URI'])
2521+
&& !preg_match('%^(https?|ftp)://%', $file)
2522+
&& !preg_match('%^//%', $file)
2523+
) {
2524+
$urldata = @parse_url($_SERVER['SCRIPT_URI']);
2525+
return $urldata['scheme'].'://'.$urldata['host'].(($file[0] == '/') ? '' : '/').$file;
2526+
}
2527+
//
2528+
$alt = array_unique($alt);
2529+
//var_dump($alt);exit;//DEBUG
2530+
foreach ($alt as $path) {
2531+
$ret = @file_get_contents($path);
2532+
if ($ret !== false) {
2533+
return $ret;
25142534
}
2515-
}
2516-
if (isset($_SERVER['SCRIPT_URI'])) {
2517-
$urldata = @parse_url($_SERVER['SCRIPT_URI']);
2518-
$alt[] = $urldata['scheme'].'://'.$urldata['host'].(($file[0] == '/') ? '' : '/').$file;
2519-
}
2520-
foreach ($alt as $f) {
2521-
$ret = @file_get_contents($f);
2522-
if (($ret === FALSE)
2523-
AND !ini_get('allow_url_fopen')
2524-
AND function_exists('curl_init')
2525-
AND preg_match('%^(https?|ftp)://%', $f)) {
2535+
// try to use CURL for URLs
2536+
if (!ini_get('allow_url_fopen')
2537+
&& function_exists('curl_init')
2538+
&& preg_match('%^(https?|ftp)://%', $path)
2539+
) {
25262540
// try to get remote file data using cURL
2527-
$cs = curl_init(); // curl session
2528-
curl_setopt($cs, CURLOPT_URL, $f);
2529-
curl_setopt($cs, CURLOPT_BINARYTRANSFER, true);
2530-
curl_setopt($cs, CURLOPT_FAILONERROR, true);
2531-
curl_setopt($cs, CURLOPT_RETURNTRANSFER, true);
2532-
if ((ini_get('open_basedir') == '') AND (!ini_get('safe_mode'))) {
2533-
curl_setopt($cs, CURLOPT_FOLLOWLOCATION, true);
2541+
$crs = curl_init();
2542+
curl_setopt($crs, CURLOPT_URL, $path);
2543+
curl_setopt($crs, CURLOPT_BINARYTRANSFER, true);
2544+
curl_setopt($crs, CURLOPT_FAILONERROR, true);
2545+
curl_setopt($crs, CURLOPT_RETURNTRANSFER, true);
2546+
if ((ini_get('open_basedir') == '') && (!ini_get('safe_mode'))) {
2547+
curl_setopt($crs, CURLOPT_FOLLOWLOCATION, true);
2548+
}
2549+
curl_setopt($crs, CURLOPT_CONNECTTIMEOUT, 5);
2550+
curl_setopt($crs, CURLOPT_TIMEOUT, 30);
2551+
curl_setopt($crs, CURLOPT_SSL_VERIFYPEER, false);
2552+
curl_setopt($crs, CURLOPT_SSL_VERIFYHOST, false);
2553+
curl_setopt($crs, CURLOPT_USERAGENT, 'tc-lib-file');
2554+
$ret = curl_exec($crs);
2555+
curl_close($crs);
2556+
if ($ret !== false) {
2557+
return $ret;
25342558
}
2535-
curl_setopt($cs, CURLOPT_CONNECTTIMEOUT, 5);
2536-
curl_setopt($cs, CURLOPT_TIMEOUT, 30);
2537-
curl_setopt($cs, CURLOPT_SSL_VERIFYPEER, false);
2538-
curl_setopt($cs, CURLOPT_SSL_VERIFYHOST, false);
2539-
curl_setopt($cs, CURLOPT_USERAGENT, 'TCPDF');
2540-
$ret = curl_exec($cs);
2541-
curl_close($cs);
2542-
}
2543-
if ($ret !== FALSE) {
2544-
break;
25452559
}
25462560
}
2547-
return $ret;
2561+
return false;
25482562
}
2549-
25502563
} // END OF TCPDF_STATIC CLASS
25512564

25522565
//============================================================+

tcpdf.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
//============================================================+
33
// File name : tcpdf.php
4-
// Version : 6.2.9
4+
// Version : 6.2.11
55
// Begin : 2002-08-03
66
// Last Update : 2015-06-18
77
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected]
@@ -7026,7 +7026,6 @@ public function Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $alig
70267026
AND (($info === 'pngalpha') OR (isset($info['trns']) AND !empty($info['trns'])))) {
70277027
return $this->ImagePngAlpha($file, $x, $y, $pixw, $pixh, $w, $h, 'PNG', $link, $align, $resize, $dpi, $palign, $filehash);
70287028
}
7029-
$info = false;
70307029
}
70317030
if (($info === false) AND function_exists($gdfunction)) {
70327031
try {

0 commit comments

Comments
 (0)