PMCORE-3844

This commit is contained in:
Julio Cesar Laura Avendaño
2022-05-26 14:56:23 +00:00
committed by Mauricio Veliz
parent 7bb67a97bd
commit 9f1b738093
82 changed files with 300 additions and 552 deletions

View File

@@ -178,4 +178,6 @@ thirdparty/pear/package-PEAR.xml
thirdparty/pear/README
thirdparty/pear/template.spec
thirdparty/pear/UDDI.php
thirdparty/propel-generator/classes/propel/engine/builder/sql/sqlite/SqliteDataSQLBuilder.php
thirdparty/propel-generator/classes/propel/engine/platform/SqlitePlatform.php
thirdparty/tcpdf

View File

@@ -45,7 +45,7 @@ class HTMLPurifier_ChildDef_Custom extends HTMLPurifier_ChildDef
protected function _compileRegex()
{
$raw = str_replace(' ', '', $this->dtd_regex);
if ($raw{0} != '(') {
if ($raw[0] != '(') {
$raw = "($raw)";
}
$el = '[#a-zA-Z0-9_.-]+';

View File

@@ -784,17 +784,17 @@ class HTMLPurifier_Config
* @param array $array $_GET or $_POST array to import
* @param string|bool $index Index/name that the config variables are in
* @param array|bool $allowed List of allowed namespaces/directives
* @param bool $mq_fix Boolean whether or not to enable magic quotes fix
* @param bool $mq_fix Boolean whether or not to enable magic quotes fix (DEPRECATED, now is always in false)
* @param HTMLPurifier_ConfigSchema $schema Schema to use, if not global copy
*
* @return array
*/
public static function prepareArrayFromForm($array, $index = false, $allowed = true, $mq_fix = true, $schema = null)
public static function prepareArrayFromForm($array, $index = false, $allowed = true, $mq_fix = false, $schema = null)
{
if ($index !== false) {
$array = (isset($array[$index]) && is_array($array[$index])) ? $array[$index] : array();
}
$mq = $mq_fix && function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc();
$mq = $mq_fix;
$allowed = HTMLPurifier_Config::getAllowedDirectivesForForm($allowed, $schema);
$ret = array();

View File

@@ -43,8 +43,8 @@ class HTMLPurifier_Printer_HTMLDefinition extends HTMLPurifier_Printer
$ret .= $this->element('caption', 'Doctype');
$ret .= $this->row('Name', $doctype->name);
$ret .= $this->row('XML', $doctype->xml ? 'Yes' : 'No');
$ret .= $this->row('Default Modules', implode($doctype->modules, ', '));
$ret .= $this->row('Default Tidy Modules', implode($doctype->tidyModules, ', '));
$ret .= $this->row('Default Modules', implode(', ', $doctype->modules));
$ret .= $this->row('Default Tidy Modules', implode(', ', $doctype->tidyModules));
$ret .= $this->end('table');
return $ret;
}

View File

@@ -75,7 +75,7 @@ class HTMLPurifier_TagTransform_Font extends HTMLPurifier_TagTransform
if (isset($attr['size'])) {
// normalize large numbers
if ($attr['size'] !== '') {
if ($attr['size']{0} == '+' || $attr['size']{0} == '-') {
if ($attr['size'][0] == '+' || $attr['size'][0] == '-') {
$size = (int)$attr['size'];
if ($size < -2) {
$attr['size'] = '-2';

View File

@@ -22,13 +22,7 @@
include_once 'creole/SQLException.php';
include_once 'creole/Connection.php';
// static:
// track errors is used by drivers to get better error messages
// make sure it's set.
@ini_set('track_errors', true);
use ProcessMaker\Core\System;
use ProcessMaker\Core\System;
/**
* This is the class that manages the database drivers.

View File

@@ -76,8 +76,6 @@ class OCI8Connection extends ConnectionCommon implements Connection
? 'oci_pconnect'
: 'oci_connect';
$encoding = !empty($dsninfo['encoding']) ? $dsninfo['encoding'] : null;
@ini_set( 'track_errors', true );
if ( $hostspec && $port )
{

View File

@@ -53,9 +53,7 @@ class PgSQLConnection extends ConnectionCommon implements Connection {
* @return void
*/
function connect($dsninfo, $flags = 0)
{
global $php_errormsg;
{
if (!extension_loaded('pgsql')) {
throw new SQLException('pgsql extension not loaded');
}
@@ -100,9 +98,13 @@ class PgSQLConnection extends ConnectionCommon implements Connection {
}
if (!$conn) {
// Set message error
$lastError = error_get_last();
$errorMessage = $lastError['message'] ?? 'Connection error.';
// hide the password from connstr
$cleanconnstr = preg_replace('/password=\'.*?\'($|\s)/', 'password=\'*********\'', $connstr);
throw new SQLException('Could not connect', $php_errormsg, $cleanconnstr);
throw new SQLException('Could not connect', $errorMessage, $cleanconnstr);
}
$this->dblink = $conn;

View File

@@ -137,7 +137,7 @@ class PgSQLResultSet extends ResultSetCommon implements ResultSet {
$res[] = $this->strToArray(implode(',', $subarr[$in_subarr]));
$in_subarr--;
}
} elseif ($tok{0} === '{') { // we're inside a new sub-array
} elseif ($tok[0] === '{') { // we're inside a new sub-array
if ('}' !== substr($tok, -1, 1)) {
$in_subarr++;
// if sub-array has more than one element

View File

@@ -143,7 +143,7 @@ class SQLStatementExtractor {
trigger_error("substring(), Endindex out of bounds must be $startpos<n<".($len-1), E_USER_ERROR);
}
if ($startpos === $endpos) {
return (string) $string{$startpos};
return (string) $string[$startpos];
} else {
$len = $endpos-$startpos;
}

View File

@@ -386,7 +386,7 @@ class pakeApp
$files = preg_replace('/^'.preg_quote(realpath($target_dir), '/').'/', '', $files);
// remove leading /
$files = array_map(create_function('$f', 'return 0 === strpos($f, DIRECTORY_SEPARATOR) ? substr($f, 1) : $f;'), $files);
$files = array_map(function($f){return 0 === strpos($f, DIRECTORY_SEPARATOR) ? substr($f, 1) : $f;}, $files);
}
return $files;

View File

@@ -409,7 +409,6 @@ if (false !== strpos(PHP_SAPI, 'cgi'))
// PHP ini settings
set_time_limit(0);
ini_set('track_errors', true);
ini_set('html_errors', false);
// define stream constants

View File

@@ -72,7 +72,7 @@ class pakeGetopt
if (is_string($args))
{
// hack to split arguments with spaces : --test="with some spaces"
$args = preg_replace('/(\'|")(.+?)\\1/e', "str_replace(' ', '=PLACEHOLDER=', '\\2')", $args);
$args = preg_replace_callback('/(\'|")(.+?)\\1/', function($matches){return str_replace(' ', '=PLACEHOLDER=', $matches['2']);}, $args);
$args = preg_split('/\s+/', $args);
$args = str_replace('=PLACEHOLDER=', ' ', $args);
}

View File

@@ -874,7 +874,7 @@
$ret = array();
foreach($keys as $key) {
list($unused,$val) = each($vals);
list($unused,$val) = self::each($vals);
// This is the good part! If a key already exists, but it's part of a
// sequence (an int), just keep addin numbers until we find a fresh one.
if (isset($ret[$key]) and is_int($key)) {
@@ -887,4 +887,23 @@
return $ret;
}
/**
* Legacy "each" function, because was removed in PHP v8.x
*
* @param $array
* @return array|bool
*/
private static function each($array) {
$key = key($array);
$value = current($array);
$each = is_null($key) ? false : [
1 => $value,
'value' => $value,
0 => $key,
'key' => $key,
];
next($array);
return $each;
}
}

View File

@@ -742,7 +742,7 @@ class DB_Error extends PEAR_Error
*
* @see PEAR_Error
*/
function DB_Error($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
function __construct($code = DB_ERROR, $mode = PEAR_ERROR_RETURN,
$level = E_USER_NOTICE, $debuginfo = null)
{
if (is_int($code)) {
@@ -794,7 +794,7 @@ class DB_result
* @param resource $result result resource id
* @param array $options assoc array with optional result options
*/
function DB_result(&$dbh, $result, $options = array())
function __construct(&$dbh, $result, $options = array())
{
$this->dbh = &$dbh;
$this->result = $result;
@@ -1093,7 +1093,7 @@ class DB_row
*
* @param resource row data as array
*/
function DB_row(&$arr)
function __construct(&$arr)
{
foreach ($arr as $key => $value) {
$this->$key = &$arr[$key];

View File

@@ -146,7 +146,7 @@ class DB_common extends PEAR
/**
* Constructor
*/
function DB_common()
function __construct()
{
$this->PEAR('DB_Error');
}
@@ -167,7 +167,7 @@ class DB_common extends PEAR
function quoteString($string)
{
$string = $this->quote($string);
if ($string{0} == "'") {
if ($string[0] == "'") {
return substr($string, 1, -1);
}
return $string;

View File

@@ -115,7 +115,7 @@ class DB_mysqli extends DB_common
*
* @access public
*/
function DB_mysqli()
function __construct()
{
$this->DB_common();
$this->phptype = 'mysqli';
@@ -168,7 +168,6 @@ class DB_mysqli extends DB_common
$this->dsn = $dsninfo;
$conn = false;
@ini_set('track_errors', true);
if ($this->getOption('ssl') === true) {
$init = mysqli_init();
@@ -201,17 +200,16 @@ class DB_mysqli extends DB_common
);
}
@ini_restore('track_errors');
if (!$conn) {
$lastError = error_get_last();
if (($err = @mysqli_connect_error()) != '') {
return $this->raiseError(DB_ERROR_CONNECT_FAILED, null, null,
null, $err);
} elseif (empty($php_errormsg)) {
} elseif (empty($lastError['message'])) {
return $this->raiseError(DB_ERROR_CONNECT_FAILED);
} else {
return $this->raiseError(DB_ERROR_CONNECT_FAILED, null, null,
null, $php_errormsg);
null, $lastError['message']);
}
}

View File

@@ -65,7 +65,7 @@ class DB_oci8 extends DB_common
// }}}
// {{{ constructor
function DB_oci8()
function __construct()
{
$this->DB_common();
$this->phptype = 'oci8';
@@ -501,7 +501,7 @@ class DB_oci8 extends DB_common
if ($this->manip_query[(int)$stmt]) {
$tmp = DB_OK;
} else {
$tmp =& new DB_result($this, $stmt);
$tmp = new DB_result($this, $stmt);
}
return $tmp;
}

View File

@@ -50,7 +50,7 @@ class DB_odbc extends DB_common
// }}}
// {{{ constructor
function DB_odbc()
function __construct()
{
$this->DB_common();
$this->phptype = 'odbc';

View File

@@ -51,7 +51,7 @@ class DB_pgsql extends DB_common
// }}}
// {{{ constructor
function DB_pgsql()
function __construct()
{
$this->DB_common();
$this->phptype = 'pgsql';
@@ -127,13 +127,13 @@ class DB_pgsql extends DB_common
if ($ini) {
$conn = @$connect_function($connstr);
} else {
ini_set('track_errors', 1);
$conn = @$connect_function($connstr);
ini_set('track_errors', $ini);
}
if ($conn == false) {
$lastError = error_get_last();
$errorMessage = $lastError['message'] ?? 'Connection error.';
return $this->raiseError(DB_ERROR_CONNECT_FAILED, null,
null, null, strip_tags($php_errormsg));
null, null, strip_tags($errorMessage));
}
$this->connection = $conn;
return DB_OK;

View File

@@ -42,7 +42,7 @@ class Log_composite extends Log
*
* @access public
*/
function Log_composite($name, $ident = '', $conf = array(),
function __construct($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
$this->_ident = $ident;

View File

@@ -64,7 +64,7 @@ class Log_console extends Log
* @param int $level Log messages up to and including this level.
* @access public
*/
function Log_console($name, $ident = '', $conf = array(),
function __construct($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
if(!class_exists('G')){

View File

@@ -66,7 +66,7 @@ class Log_daemon extends Log
* @param int $maxLevel Maximum level at which to log.
* @access public
*/
function Log_daemon($name, $ident = '', $conf = array(),
function __construct($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
/* Ensure we have a valid integer value for $name. */

View File

@@ -51,7 +51,7 @@ class Log_display extends Log
* @param int $level Log messages up to and including this level.
* @access public
*/
function Log_display($name = '', $ident = '', $conf = array(),
function __construct($name = '', $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
if(!class_exists('G')){

View File

@@ -49,7 +49,7 @@ class Log_error_log extends Log
* @param int $level Log messages up to and including this level.
* @access public
*/
function Log_error_log($name, $ident = '', $conf = array(),
function __construct($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
if(!class_exists('G')){

View File

@@ -95,7 +95,7 @@ class Log_file extends Log
* @param int $level Log messages up to and including this level.
* @access public
*/
function Log_file($name, $ident = '', $conf = array(),
function __construct($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
if(!class_exists('G')){

View File

@@ -78,7 +78,7 @@ class Log_firebug extends Log
* @param int $level Log messages up to and including this level.
* @access public
*/
function Log_firebug($name = '', $ident = 'PHP', $conf = array(),
function __construct($name = '', $ident = 'PHP', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
if(!class_exists('G')){

View File

@@ -100,7 +100,7 @@ class Log_mail extends Log
* @param int $level Log messages up to and including this level.
* @access public
*/
function Log_mail($name, $ident = '', $conf = array(),
function __construct($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
if(!class_exists('G')){

View File

@@ -71,7 +71,7 @@ class Log_mcal extends Log
* @param int $level Log messages up to and including this level.
* @access public
*/
function Log_mcal($name, $ident = '', $conf = array(),
function __construct($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
if(!class_exists('G')){

View File

@@ -112,7 +112,7 @@ class Log_mdb2 extends Log
* @param int $level Log messages up to and including this level.
* @access public
*/
function Log_mdb2($name, $ident = '', $conf = array(),
function __construct($name, $ident = '', $conf = array(),
$level = PEAR_LOG_DEBUG)
{
if(!class_exists('G')){

Some files were not shown because too many files have changed in this diff Show More