Version 4.1.19

This commit is contained in:
Neo committed 2025-12-19 05:38:56 -08:00
1 parent 28bd025b35
commit 2bd5025018
2674 files changed
+233518 -77766

No files matched your search

+44 -3
View File
@@ -2,9 +2,9 @@
/**
* @brief Session Handler
* @author <a href='http://www.invisionpower.com'>Invision Power Services, Inc.</a>
* @copyright (c) 2001 - SVN_YYYY Invision Power Services, Inc.
* @copyright (c) 2001 - 2016 Invision Power Services, Inc.
* @license http://www.invisionpower.com/legal/standards/
* @package IPS Social Suite
* @package IPS Community Suite
* @since 6th Sept 2013
* @version SVN_VERSION_NUMBER
*/
@@ -372,6 +372,17 @@ class Session
{
continue;
}
/* Skip if it's an _old or _utftemp table */
if( mb_substr( $tableName, -4 ) == '_old' )
{
continue;
}
if( mb_substr( $tableName, -8 ) == '_utftemp' )
{
continue;
}
if ( mb_substr( $tableName, 0, mb_strlen( \IPSUtf8\Db::i()->prefix ) ) === \IPSUtf8\Db::i()->prefix )
{
@@ -396,7 +407,7 @@ class Session
$data['tableCount']++;
$row = \IPSUtf8\Db::i()->query( "SHOW CREATE TABLE `" . \IPSUtf8\Db::i()->prefix . "{$table}`" )->fetch_assoc();
if ( preg_match( '#\scharset=([a-z0-9]+?)(\s|$)#i', $row['Create Table'], $matches ) )
{
$tblCharset = $matches[1];
@@ -425,10 +436,40 @@ class Session
try
{
$test = @json_encode( $definition );
if ( json_last_error() != JSON_ERROR_NONE )
{
throw new \ErrorException;
}
}
catch( \ErrorException $e )
{
$definition = static::arrayWalkRecursive( $definition, function( $value ) { return utf8_encode( $value ); } );
/* Try it again - if it fails this time, remove the column comments as that is likely causing the issue if they have non-latin characters */
$test = @json_encode( $definition );
if ( json_last_error() != JSON_ERROR_NONE )
{
foreach( $definition['columns'] AS $column => $data )
{
if ( isset( $data['comment'] ) )
{
unset( $definition['columns'][ $column ]['comment'] );
}
}
}
}
/* If the collation is missing, let's do a table status check and see if we can figure it out */
if ( empty( $definition['collation'] ) )
{
$status = \IPSUtf8\Db::i()->query( "SHOW TABLE STATUS WHERE Name='" . \IPSUtf8\Db::i()->prefix . "{$table}'" )->fetch_assoc();
if( isset( $status['Collation'] ) )
{
$definition['collation'] = $status['Collation'];
}
}
/* Get other data */