Skip to content

Commit bc3f312

Browse files
committed
Release v4.2.12
1 parent 543dd5e commit bc3f312

File tree

18 files changed

+97
-62
lines changed

18 files changed

+97
-62
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
The MIT License (MIT)
22

33
Copyright (c) 2014-2019 British Columbia Institute of Technology
4-
Copyright (c) 2019-2022 CodeIgniter Foundation
4+
Copyright (c) 2019-2023 CodeIgniter Foundation
55

66
Permission is hereby granted, free of charge, to any person obtaining a copy
77
of this software and associated documentation files (the "Software"), to deal

app/Config/Cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class Cache extends BaseConfig
134134
*
135135
* @see https://codeigniter.com/user_guide/libraries/caching.html#memcached
136136
*
137-
* @var array<string, boolean|int|string>
137+
* @var array<string, bool|int|string>
138138
*/
139139
public $memcached = [
140140
'host' => '127.0.0.1',

app/Config/Migrations.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,12 @@ class Migrations extends BaseConfig
4242
*
4343
* This is the format that will be used when creating new migrations
4444
* using the CLI command:
45-
* > php spark migrate:create
45+
* > php spark make:migration
4646
*
47-
* Typical formats:
47+
* Note: if you set an unsupported format, migration runner will not find
48+
* your migration files.
49+
*
50+
* Supported formats:
4851
* - YmdHis_
4952
* - Y-m-d-His_
5053
* - Y_m_d_His_

app/Controllers/BaseController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ abstract class BaseController extends Controller
3737
*/
3838
protected $helpers = [];
3939

40+
/**
41+
* Be sure to declare properties for any property fetch you initialized.
42+
* The creation of dynamic property is deprecated in PHP 8.2.
43+
*/
44+
// protected $session;
45+
4046
/**
4147
* Constructor.
4248
*/

system/CLI/CLI.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,10 @@ public static function init()
161161
static::parseCommandLine();
162162

163163
static::$initialized = true;
164-
} else {
164+
} elseif (! defined('STDOUT')) {
165165
// If the command is being called from a controller
166166
// we need to define STDOUT ourselves
167+
// For "! defined('STDOUT')" see: https://github.com/codeigniter4/CodeIgniter4/issues/7047
167168
define('STDOUT', 'php://output'); // @codeCoverageIgnore
168169
}
169170
}

system/Cache/CacheInterface.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ public function initialize();
2626
*
2727
* @param string $key Cache item name
2828
*
29-
* @return mixed
29+
* @return array|bool|float|int|object|string|null
3030
*/
3131
public function get(string $key);
3232

3333
/**
3434
* Saves an item to the cache store.
3535
*
36-
* @param string $key Cache item name
37-
* @param mixed $value The data to save
38-
* @param int $ttl Time To Live, in seconds (default 60)
36+
* @param string $key Cache item name
37+
* @param array|bool|float|int|object|string|null $value The data to save
38+
* @param int $ttl Time To Live, in seconds (default 60)
3939
*
4040
* @return bool Success or failure
4141
*/
@@ -56,7 +56,7 @@ public function delete(string $key);
5656
* @param string $key Cache ID
5757
* @param int $offset Step/value to increase by
5858
*
59-
* @return mixed
59+
* @return bool|int
6060
*/
6161
public function increment(string $key, int $offset = 1);
6262

@@ -66,7 +66,7 @@ public function increment(string $key, int $offset = 1);
6666
* @param string $key Cache ID
6767
* @param int $offset Step/value to increase by
6868
*
69-
* @return mixed
69+
* @return bool|int
7070
*/
7171
public function decrement(string $key, int $offset = 1);
7272

@@ -83,7 +83,7 @@ public function clean();
8383
* The information returned and the structure of the data
8484
* varies depending on the handler.
8585
*
86-
* @return mixed
86+
* @return array|false|object|null
8787
*/
8888
public function getCacheInfo();
8989

system/Cache/Handlers/BaseHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static function validateKey($key, $prefix = ''): string
7777
* @param int $ttl Time to live
7878
* @param Closure $callback Callback return value
7979
*
80-
* @return mixed
80+
* @return array|bool|float|int|object|string|null
8181
*/
8282
public function remember(string $key, int $ttl, Closure $callback)
8383
{

system/CodeIgniter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class CodeIgniter
4747
/**
4848
* The current version of CodeIgniter Framework
4949
*/
50-
public const CI_VERSION = '4.2.11';
50+
public const CI_VERSION = '4.2.12';
5151

5252
/**
5353
* App startup time.

system/Database/MigrationRunner.php

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ class MigrationRunner
6767
*
6868
* @var string
6969
*/
70-
protected $regex = '/^\d{4}[_-]?\d{2}[_-]?\d{2}[_-]?\d{6}_(\w+)$/';
70+
protected $regex = '/\A(\d{4}[_-]?\d{2}[_-]?\d{2}[_-]?\d{6})_(\w+)\z/';
7171

7272
/**
7373
* The main database connection. Used to store
@@ -448,6 +448,8 @@ public function findNamespaceMigrations(string $namespace): array
448448
/**
449449
* Create a migration object from a file path.
450450
*
451+
* @param string $path Full path to a valid migration file.
452+
*
451453
* @return false|object Returns the migration object, or false on failure
452454
*/
453455
protected function migrationFromFile(string $path, string $namespace)
@@ -456,18 +458,18 @@ protected function migrationFromFile(string $path, string $namespace)
456458
return false;
457459
}
458460

459-
$name = basename($path, '.php');
461+
$filename = basename($path, '.php');
460462

461-
if (! preg_match($this->regex, $name)) {
463+
if (! preg_match($this->regex, $filename)) {
462464
return false;
463465
}
464466

465467
$locator = Services::locator(true);
466468

467469
$migration = new stdClass();
468470

469-
$migration->version = $this->getMigrationNumber($name);
470-
$migration->name = $this->getMigrationName($name);
471+
$migration->version = $this->getMigrationNumber($filename);
472+
$migration->name = $this->getMigrationName($filename);
471473
$migration->path = $path;
472474
$migration->class = $locator->getClassname($path);
473475
$migration->namespace = $namespace;
@@ -525,23 +527,29 @@ public function setSilent(bool $silent)
525527

526528
/**
527529
* Extracts the migration number from a filename
530+
*
531+
* @param string $migration A migration filename w/o path.
528532
*/
529533
protected function getMigrationNumber(string $migration): string
530534
{
531-
preg_match('/^\d{4}[_-]?\d{2}[_-]?\d{2}[_-]?\d{6}/', $migration, $matches);
535+
preg_match($this->regex, $migration, $matches);
532536

533-
return count($matches) ? $matches[0] : '0';
537+
return count($matches) ? $matches[1] : '0';
534538
}
535539

536540
/**
537-
* Extracts the migration class name from a filename
541+
* Extracts the migration name from a filename
542+
*
543+
* Note: The migration name should be the classname, but maybe they are
544+
* different.
545+
*
546+
* @param string $migration A migration filename w/o path.
538547
*/
539548
protected function getMigrationName(string $migration): string
540549
{
541-
$parts = explode('_', $migration);
542-
array_shift($parts);
550+
preg_match($this->regex, $migration, $matches);
543551

544-
return implode('_', $parts);
552+
return count($matches) ? $matches[2] : '';
545553
}
546554

547555
/**

system/Debug/Toolbar/Views/toolbar.css

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -427,26 +427,26 @@
427427
-webkit-box-shadow: 0 0 4px #DFDFDF;
428428
}
429429
#debug-icon a:active,
430-
#debug-icon a:link,
431-
#debug-icon a:visited {
430+
#debug-icon a:link,
431+
#debug-icon a:visited {
432432
color: #DD8615;
433433
}
434434
#debug-bar {
435435
background-color: #252525;
436436
color: #DFDFDF;
437437
}
438438
#debug-bar h1,
439-
#debug-bar h2,
440-
#debug-bar h3,
441-
#debug-bar p,
442-
#debug-bar a,
443-
#debug-bar button,
444-
#debug-bar table,
445-
#debug-bar thead,
446-
#debug-bar tr,
447-
#debug-bar td,
448-
#debug-bar button,
449-
#debug-bar .toolbar {
439+
#debug-bar h2,
440+
#debug-bar h3,
441+
#debug-bar p,
442+
#debug-bar a,
443+
#debug-bar button,
444+
#debug-bar table,
445+
#debug-bar thead,
446+
#debug-bar tr,
447+
#debug-bar td,
448+
#debug-bar button,
449+
#debug-bar .toolbar {
450450
background-color: transparent;
451451
color: #DFDFDF;
452452
}
@@ -498,7 +498,7 @@
498498
color: #DFDFDF;
499499
}
500500
#debug-bar #toolbar-position,
501-
#debug-bar #toolbar-theme {
501+
#debug-bar #toolbar-theme {
502502
filter: brightness(0) invert(0.6);
503503
}
504504
#debug-bar .ci-label.active {
@@ -518,7 +518,7 @@
518518
-webkit-box-shadow: 0 -1px 4px #434343;
519519
}
520520
#debug-bar .timeline th,
521-
#debug-bar .timeline td {
521+
#debug-bar .timeline td {
522522
border-color: #434343;
523523
}
524524
#debug-bar .timeline .timer {

0 commit comments

Comments
 (0)