PMCORE-3835

This commit is contained in:
Mauricio Veliz
2022-05-13 17:09:51 -04:00
parent c07f468d20
commit 3c363b498d
11 changed files with 3086 additions and 2026 deletions

View File

@@ -6,19 +6,10 @@
* It also does some sanity checks.
*/
if (function_exists('spl_autoload_register') && function_exists('spl_autoload_unregister')) {
// We need unregister for our pre-registering functionality
HTMLPurifier_Bootstrap::registerAutoload();
if (function_exists('__autoload')) {
// Be polite and ensure that userland autoload gets retained
spl_autoload_register('__autoload');
}
} elseif (!function_exists('__autoload')) {
function __autoload($class)
{
return HTMLPurifier_Bootstrap::autoload($class);
}
}
spl_autoload_register(function($class)
{
return HTMLPurifier_Bootstrap::autoload($class);
});
if (ini_get('zend.ze1_compatibility_mode')) {
trigger_error("HTML Purifier is not compatible with zend.ze1_compatibility_mode; please turn it off", E_USER_ERROR);

View File

@@ -154,7 +154,7 @@ class HTMLPurifier_Encoder
$len = strlen($str);
for ($i = 0; $i < $len; $i++) {
$in = ord($str{$i});
$in = ord($str[$i]);
$char .= $str[$i]; // append byte to char
if (0 == $mState) {
// When mState is zero we expect either a US-ASCII character

View File

@@ -523,10 +523,10 @@ class pakeFinder
public static function isPathAbsolute($path)
{
if ($path{0} == '/' || $path{0} == '\\' ||
(strlen($path) > 3 && ctype_alpha($path{0}) &&
$path{1} == ':' &&
($path{2} == '\\' || $path{2} == '/')
if ($path[0] == '/' || $path[0] == '\\' ||
(strlen($path) > 3 && ctype_alpha($path[0]) &&
$path[1] == ':' &&
($path[2] == '\\' || $path[2] == '/')
)
)
{

View File

@@ -411,7 +411,6 @@ if (false !== strpos(PHP_SAPI, 'cgi'))
set_time_limit(0);
ini_set('track_errors', true);
ini_set('html_errors', false);
ini_set('magic_quotes_runtime', false);
// define stream constants
define('STDIN', fopen('php://stdin', 'r'));
@@ -425,5 +424,5 @@ if (false !== strpos(PHP_SAPI, 'cgi'))
}
// close the streams on script termination
register_shutdown_function(create_function('', 'fclose(STDIN); fclose(STDOUT); fclose(STDERR); return true;'));
register_shutdown_function(function(){fclose(STDIN); fclose(STDOUT); fclose(STDERR); return true;});
}

View File

@@ -50,14 +50,14 @@ class pakeGetopt
public function add_option($long_opt, $short_opt, $mode = self::NO_ARGUMENT, $comment = '')
{
if ($long_opt{0} == '-' && $long_opt{1} == '-')
if ($long_opt[0] == '-' && $long_opt[1] == '-')
{
$long_opt = substr($long_opt, 2);
}
if ($short_opt)
{
if ($short_opt{0} == '-')
if ($short_opt[0] == '-')
{
$short_opt = substr($short_opt, 1);
}
@@ -81,7 +81,7 @@ class pakeGetopt
$args = $this->read_php_argv();
// we strip command line program
if (isset($args[0]) && $args[0]{0} != '-')
if (isset($args[0]) && $args[0][0] != '-')
{
array_shift($args);
}
@@ -101,12 +101,12 @@ class pakeGetopt
break;
}
if ($arg{0} != '-' || (strlen($arg) > 1 && $arg{1} == '-' && !$this->long_options))
if ($arg[0] != '-' || (strlen($arg) > 1 && $arg[1] == '-' && !$this->long_options))
{
$this->arguments = array_merge($this->arguments, array($arg), $this->args);
break;
}
elseif (strlen($arg) > 1 && $arg{1} == '-')
elseif (strlen($arg) > 1 && $arg[1] == '-')
{
$this->parse_long_option(substr($arg, 2));
}
@@ -149,7 +149,7 @@ class pakeGetopt
{
for ($i = 0; $i < strlen($arg); $i++)
{
$opt = $arg{$i};
$opt = $arg[$i];
$opt_arg = true;
/* option exists? */
@@ -169,7 +169,7 @@ class pakeGetopt
else
{
// take next element as argument (if it doesn't start with a -)
if (count($this->args) && $this->args[0]{0} != '-')
if (count($this->args) && $this->args[0][0] != '-')
{
$this->options[$this->short_options[$opt]['name']] = array_shift($this->args);
break;
@@ -189,7 +189,7 @@ class pakeGetopt
else
{
// take next element as argument (if it doesn't start with a -)
if (count($this->args) && $this->args[0]{0} != '-')
if (count($this->args) && $this->args[0][0] != '-')
{
$this->options[$this->short_options[$opt]['name']] = array_shift($this->args);
}

View File

@@ -193,7 +193,7 @@
} elseif ($this->_inBlock == true && empty($ifchk)) {
$last =& $this->_allNodes[$this->_lastNode];
$last->data[key($last->data)] .= "\n";
} elseif ($ifchk{0} != '#' && substr($ifchk,0,3) != '---') {
} elseif ($ifchk[0] != '#' && substr($ifchk,0,3) != '---') {
// Create a new node and get its indent
$node = new pakeYAMLNode;
$node->indent = $this->_getIndent($line);