Skip to content

Commit

Permalink
Merge pull request #310 from RyujiAMANO/fix/php8-problem
Browse files Browse the repository at this point in the history
Fix/php8 problem
  • Loading branch information
gigamaster authored Nov 24, 2024
2 parents 1ee8a43 + a8f0a3c commit caf1916
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
42 changes: 19 additions & 23 deletions html/class/Archive_Zip.php
Original file line number Diff line number Diff line change
Expand Up @@ -686,31 +686,27 @@ public function errorCode()
* @param bool $p_with_code If true, gives the name and the int value.
* @return string The error name.
*/
public function errorName($p_with_code=false)
public function errorName($p_with_code = false)
{
$v_const_list = get_defined_constants();

// ----- Extract error constants from all const.
for (reset($v_const_list);
list($v_key, $v_value) = each($v_const_list);) {
if ('ARCHIVE_ZIP_ERR_'
== substr($v_key, 0, strlen('ARCHIVE_ZIP_ERR_'))) {

// ----- Extract error constants from all const.
$v_error_list = [];
foreach ($v_const_list as $v_key => $v_value) {
if (substr($v_key, 0, strlen('ARCHIVE_ZIP_ERR_')) === 'ARCHIVE_ZIP_ERR_') {
$v_error_list[$v_key] = $v_value;
}
}

// ----- Search the name form the code value
$v_key=array_search($this->_error_code, $v_error_list, true);
if (false != $v_key) {
$v_value = $v_key;
} else {
$v_value = 'NoName';
}


// ----- Search the name from the code value
$v_key = array_search($this->_error_code, $v_error_list, true);
$v_value = $v_key !== false ? $v_key : 'NoName';

// ----- Return the error name with or without the error code
if ($p_with_code) {
return($v_value.' ('.$this->_error_code.')');
return $v_value . ' (' . $this->_error_code . ')';
} else {
return($v_value);
return $v_value;
}
}
// }}}
Expand Down Expand Up @@ -914,7 +910,7 @@ public function _add($p_list, &$p_result_list, &$p_params)
}

// ----- Swap the file descriptor
// Here is a trick : I swap the temporary fd with the zip fd, in order to
// Here is a trick : I swap the temporary fd with the zip fd, in order to
// use the following methods on the temporary fil and not the real archive
$v_swap = $this->_zip_fd;
$this->_zip_fd = $v_zip_temp_fd;
Expand Down Expand Up @@ -1419,7 +1415,7 @@ public function _addFile($p_filename, &$p_header, $p_add_dir, $p_remove_dir, $p_
$this->_errorLog(ARCHIVE_ZIP_ERR_READ_OPEN_FAIL, "Unable to open file '$p_filename' in binary read mode");
return Archive_Zip::errorCode();
}

if ($p_params['no_compression']) {
// ----- Read the file content
$v_content_compressed = @fread($v_file, $p_header['size']);
Expand Down Expand Up @@ -3224,14 +3220,14 @@ public function _duplicate($p_archive_filename)
*/
public function _check_parameters(&$p_params, $p_default)
{

// ----- Check that param is an array
if (!is_array($p_params)) {
$this->_errorLog(ARCHIVE_ZIP_ERR_INVALID_PARAMETER,
'Unsupported parameter, waiting for an array');
return Archive_Zip::errorCode();
}

// ----- Check that all the params are valid
for (reset($p_params); list($v_key, $v_value) = each($p_params);) {
if (!isset($p_default[$v_key])) {
Expand All @@ -3248,7 +3244,7 @@ public function _check_parameters(&$p_params, $p_default)
$p_params[$v_key] = $p_default[$v_key];
}
}

// ----- Check specific parameters
$v_callback_list = [
'callback_pre_add', 'callback_post_add',
Expand Down
4 changes: 3 additions & 1 deletion html/modules/legacy/kernel/Legacy_Controller.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1248,7 +1248,7 @@ public function executeRedirect($url, $time = 1, $message = null, $addRedirect =
}
}
}

/* XCL 2.3.x
* @gigamaster added theme_set, theme_url and theme_css (custom templates from theme)
* also Render configs for X2 and D3 compatibility, refer to /class/template.php
Expand Down Expand Up @@ -1463,6 +1463,8 @@ class Legacy_AbstractControllerStrategy

public $mStatusFlag;

public array $_mLoadedFilterNames = [];

public function __construct(&$controller)
{
$this->mController =& $controller;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
class Legacy_PublicControllerStrategy extends Legacy_AbstractControllerStrategy
{
public $mStatusFlag = LEGACY_CONTROLLER_STATE_PUBLIC;
public $_mLoadedFilterNames = [];

public function __construct(&$controller)
{
Expand Down

0 comments on commit caf1916

Please sign in to comment.