Skip to content

Commit 18887b2

Browse files
fix: unify casing in BaseService::injectMock (#10316)
1 parent 1bcfb27 commit 18887b2

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

system/Config/BaseService.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,9 @@ public static function resetSingle(string $name)
445445
*/
446446
public static function injectMock(string $name, $mock)
447447
{
448-
static::$instances[$name] = $mock;
449-
static::$mocks[strtolower($name)] = $mock;
448+
$name = strtolower($name);
449+
static::$instances[$name] = $mock;
450+
static::$mocks[$name] = $mock;
450451
}
451452

452453
/**

user_guide_src/source/changelogs/v4.7.4.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Bugs Fixed
3535
- **Common:** Fixed a bug in ``env()`` where a ``TypeError`` could be thrown when non-string values were passed.
3636
- **Common:** Fixed ``esc()`` to propagate encoding correctly and prevent reference leaks.
3737
- **Commands:** Fixed a bug where ``spark lang:find`` treated translation keys already provided by the framework or another namespace (such as ``Errors.*`` in ``system/Language``) as new, listing them under ``--show-new`` and writing untranslated placeholders into ``app/Language`` that overrode the existing translations.
38+
- **Config:** Fixed a bug where ``BaseService::injectMock`` did not apply ``strtolower`` consistently, causing inconsistent Service and Mock registration and resolution.
3839
- **Database:** Fixed a bug where ``updateBatch()`` could be called after Query Builder ``where()`` conditions, even though it's not supported. In this situation, now the ``DatabaseException`` is thrown.
3940
- **Filters:** Fixed a bug in ``InvalidChars`` filter where invalid UTF-8 or control characters in array keys were not checked.
4041
- **HTTP:** Fixed a bug where the User Agent library reported Safari's WebKit version instead of the browser version from the ``Version`` token.

0 commit comments

Comments
 (0)