Skip to content

Few minor bug fixes - #1

Merged
Spuds merged 5 commits into
SimpleMachines:masterfrom
emanuele45:master
Jan 29, 2012
Merged

Few minor bug fixes#1
Spuds merged 5 commits into
SimpleMachines:masterfrom
emanuele45:master

Conversation

@emanuele45

Copy link
Copy Markdown
Contributor
  • 4929
  • 4742
  • 4818
    and another couple

Spuds added a commit that referenced this pull request Jan 29, 2012
! $board not reassigned in MEssageIndex.php [Bug 4929]
! Fatal error accessing stat page if stats are disabled [Bug 4742] + typo in Profile-Actions.php
! No more errors when pruning attachments without notice [Bug 4818]
! When pacakges are uninstalled, the time_removed field is updated only for the uninstalled package [topic 453027]
@Spuds
Spuds merged commit a480c2d into SimpleMachines:master Jan 29, 2012
emanuele45 pushed a commit that referenced this pull request Jul 2, 2012
emanuele45 pushed a commit that referenced this pull request Jul 29, 2012
emanuele45 pushed a commit that referenced this pull request Aug 22, 2012
emanuele45 added a commit that referenced this pull request Sep 9, 2012
Update Themes/default/scripts/jquery.sceditor.bbcode.js
Spuds added a commit that referenced this pull request Oct 11, 2012
emanuele45 pushed a commit that referenced this pull request Jan 8, 2013
Moved a bit of things around in Avatar.php and index.php
emanuele45 pushed a commit that referenced this pull request Mar 4, 2013
Arantor added a commit that referenced this pull request Oct 4, 2013
MissAllSunday added a commit that referenced this pull request Mar 5, 2014
Oldiesmann pushed a commit that referenced this pull request May 8, 2014
Dragooon pushed a commit that referenced this pull request Jun 23, 2014
Oldiesmann pushed a commit that referenced this pull request Nov 22, 2014
live627 pushed a commit that referenced this pull request Mar 14, 2015
MissAllSunday pushed a commit that referenced this pull request Jul 3, 2016
@frandominguezl frandominguezl mentioned this pull request Dec 28, 2016
Sesquipedalian pushed a commit that referenced this pull request Aug 18, 2023
PHP 8.1+ will generate the following error upon a failed database connection:
```
PHP Fatal error:  Uncaught TypeError: mysqli_error(): Argument #1 ($mysql) must be of type mysqli, null given in /Sources/Errors.php:464
```

To fix this, I built a wrapper to check to ensure that the we don't have a null argument going into the related function.  Instead if its null and the primary connection is null, it returns a empty string, which is what the code seems to expect.
live627 pushed a commit that referenced this pull request Feb 1, 2024
@sbulen sbulen mentioned this pull request Feb 3, 2025
jdarwood007 added a commit that referenced this pull request Sep 12, 2025
I was receiving the following error:
```
( ! ) Fatal error: Uncaught TypeError: mb_str_split(): Argument #1 ($string) must be of type string, int given in /Sources/Utils.php on line 1076
```
Sesquipedalian pushed a commit that referenced this pull request Jul 29, 2026
The members table lost its time_offset column in 3.0, in the
DropTimeOffset migration, and User::$time_offset became a virtual
property derived from the member's time zone. User::setProperties() even
lists time_offset among the "obsolete data" it ignores.

CreatePost_Notify still asked the database for it:

    mem.smiley_set, mem.time_format, mem.time_offset, mem.timezone,

so the query fails outright with "column mem.time_offset does not
exist", and the task dies on the fetch_assoc() of a false result. The
task is never marked done, so it is retried on later page loads and
takes down whichever request happens to run it:

    SMF\Db\APIs\PostgreSQL::fetch_assoc(): Argument #1 ($result) must be
    of type object, false given

Nobody watching a board or topic receives their notification either.

Derives the offset from mem.timezone, which the query already selects,
the same way User::$time_offset does. Also keys the parsed-message cache
by time zone rather than by offset, and drops an (int) cast that
truncated the offsets of half-hour and quarter-hour time zones.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sesquipedalian pushed a commit that referenced this pull request Aug 14, 2026
ErrorHandlerService::log() json encodes the backtrace before storing it.
The backtraces it collects itself pass DEBUG_BACKTRACE_IGNORE_ARGS, but
that only applies when no backtrace was supplied:

    $backtrace = $backtrace ?? debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);

catch() supplies one, from Throwable::getTrace(), and that keeps both the
call arguments and the bound objects. Two consequences:

Anything a member submitted can end up in the error log, including the
password posted to the login form, since it is simply an argument a few
frames down.

Encoding an object reads its properties, which can throw. When it does,
the new error arrives while the first one is still being logged, and an
error that would only have been logged becomes an uncaught fatal that
hides the original. That is what turned a background task failure into a
white page for logged in members:

  Uncaught Error: Cannot access uninitialized non-nullable property
  SMF\User::$username by reference
    #1 Sources/Utils.php(1539): json_encode(Array, 0, 512)
    #2 ErrorHandlerService.php(286): SMF\Utils::jsonEncode(Array)
    #3 ErrorHandlerService.php(185): ...->log('Cannot access u...')

Drops both keys from every frame before encoding. File, line, function
and class are kept, which is what the log is for.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Sesquipedalian pushed a commit that referenced this pull request Sep 5, 2026
Two faults in the same block of User::loadUserData(), one hiding the other.

The branch for the current user reads

  if (($data = CacheApi::get('user_settings-' . $id, 60) == null))

which closes the assignment around the comparison, so $data is handed a bool
rather than the cached profile and the is_array() guard below throws it away.
The user_settings cache has therefore never been read since this was rewritten
as a class; 2.1 has the parentheses in the right place. Nothing looked wrong,
because a cache that is never read is only a cache that never helps.

With that corrected, the line below it starts fatalling for everyone rather
than only for other members at cache level 3:

  SMF\UserDataset::tryFrom(): Argument #1 ($value) must be of type string,
  SMF\UserDataset given

What goes into the cache is self::$profiles[$id], whose dataset entry is the
enum itself, so tryFrom() is being handed back exactly what was stored. At
level 3 this took out the board index, any board and any topic on the second
request, the first having populated the cache the second one read.

An entry that has no dataset at all still needs the fallback, so the
conversion stays for that case and is skipped when there is already an enum.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Sesquipedalian pushed a commit that referenced this pull request Sep 6, 2026
The file cache writes its entries as JSON, and json_encode() returns false for
anything it cannot represent, a string that is not valid UTF-8 above all. That
false went straight on to the writer, which fatalled the request:

  TypeError: str_split(): Argument #1 ($string) must be of type string, false
  given

Caching is documented as something that may miss and must not be depended on,
so a value the store cannot hold is a value that does not get cached. It is
not a reason to take the page down with it.

The reachable case is a forum whose text is not clean UTF-8, which an upgrade
from an older charset can easily leave behind.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 5 milestone Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants