Skip to content

Commit

Permalink
Release
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Aug 25, 2023
1 parent 7c663e1 commit 10c23e9
Show file tree
Hide file tree
Showing 93 changed files with 767 additions and 110 deletions.
50 changes: 25 additions & 25 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"name": "codeigniter4/framework",
"type": "project",
"description": "The CodeIgniter framework v4",
"homepage": "https://codeigniter.com",
"license": "MIT",
"type": "project",
"homepage": "https://codeigniter.com",
"support": {
"forum": "https://forum.codeigniter.com/",
"source": "https://github.com/codeigniter4/CodeIgniter4",
"slack": "https://codeigniterchat.slack.com"
},
"require": {
"php": "^7.4 || ^8.0",
"ext-intl": "*",
Expand All @@ -13,39 +18,34 @@
"psr/log": "^1.1"
},
"require-dev": {
"kint-php/kint": "^5.0.4",
"codeigniter/coding-standard": "^1.5",
"fakerphp/faker": "^1.9",
"friendsofphp/php-cs-fixer": "3.13.0",
"kint-php/kint": "^5.0.4",
"mikey179/vfsstream": "^1.6",
"nexusphp/cs-config": "^3.6",
"phpunit/phpunit": "^9.1",
"predis/predis": "^1.1 || ^2.0"
},
"suggest": {
"ext-curl": "If you use CURLRequest class",
"ext-imagick": "If you use Image class ImageMagickHandler",
"ext-gd": "If you use Image class GDHandler",
"ext-dom": "If you use TestResponse",
"ext-exif": "If you run Image class tests",
"ext-simplexml": "If you format XML",
"ext-fileinfo": "Improves mime type detection for files",
"ext-gd": "If you use Image class GDHandler",
"ext-imagick": "If you use Image class ImageMagickHandler",
"ext-libxml": "If you use TestResponse",
"ext-memcache": "If you use Cache class MemcachedHandler with Memcache",
"ext-memcached": "If you use Cache class MemcachedHandler with Memcached",
"ext-mysqli": "If you use MySQL",
"ext-oci8": "If you use Oracle Database",
"ext-pgsql": "If you use PostgreSQL",
"ext-sqlsrv": "If you use SQL Server",
"ext-sqlite3": "If you use SQLite3",
"ext-memcache": "If you use Cache class MemcachedHandler with Memcache",
"ext-memcached": "If you use Cache class MemcachedHandler with Memcached",
"ext-readline": "Improves CLI::input() usability",
"ext-redis": "If you use Cache class RedisHandler",
"ext-dom": "If you use TestResponse",
"ext-libxml": "If you use TestResponse",
"ext-xdebug": "If you use CIUnitTestCase::assertHeaderEmitted()",
"ext-fileinfo": "Improves mime type detection for files",
"ext-readline": "Improves CLI::input() usability"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
"ext-simplexml": "If you format XML",
"ext-sqlite3": "If you use SQLite3",
"ext-sqlsrv": "If you use SQL Server",
"ext-xdebug": "If you use CIUnitTestCase::assertHeaderEmitted()"
},
"autoload": {
"psr-4": {
Expand All @@ -55,12 +55,12 @@
"**/Database/Migrations/**"
]
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"scripts": {
"test": "phpunit"
},
"support": {
"forum": "https://forum.codeigniter.com/",
"source": "https://github.com/codeigniter4/CodeIgniter4",
"slack": "https://codeigniterchat.slack.com"
}
}
43 changes: 37 additions & 6 deletions system/BaseModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ public function __construct(?ValidationInterface $validation = null)
/**
* Initializes the instance with any additional steps.
* Optionally implemented by child classes.
*
* @return void
*/
protected function initialize()
{
Expand Down Expand Up @@ -458,6 +460,8 @@ abstract protected function doPurgeDeleted();
* Works with the find* methods to return only the rows that
* have been deleted.
* This method works only with dbCalls.
*
* @return void
*/
abstract protected function doOnlyDeleted();

Expand Down Expand Up @@ -524,6 +528,8 @@ abstract public function countAllResults(bool $reset = true, bool $test = false)
* @param int $size Size
* @param Closure $userFunc Callback Function
*
* @return void
*
* @throws DataException
*/
abstract public function chunk(int $size, Closure $userFunc);
Expand Down Expand Up @@ -754,7 +760,7 @@ public function insert($data = null, bool $returnID = true)

// Must be called first, so we don't
// strip out created_at values.
$data = $this->doProtectFields($data);
$data = $this->doProtectFieldsForInsert($data);

// doProtectFields() can further remove elements from
// $data so we need to check for empty dataset again
Expand Down Expand Up @@ -847,7 +853,7 @@ public function insertBatch(?array $set = null, ?bool $escape = null, int $batch

// Must be called first so we don't
// strip out created_at values.
$row = $this->doProtectFields($row);
$row = $this->doProtectFieldsForInsert($row);

// Set created_at and updated_at with same time
$date = $this->setDate();
Expand Down Expand Up @@ -973,7 +979,9 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc
// properties representing the collection elements, we need to grab
// them as an array.
if (is_object($row) && ! $row instanceof stdClass) {
$row = $this->objectToArray($row, true, true);
// For updates the index field is needed even if it is not changed.
// So set $onlyChanged to false.
$row = $this->objectToArray($row, false, true);
}

// If it's still a stdClass, go ahead and convert to
Expand All @@ -991,6 +999,13 @@ public function updateBatch(?array $set = null, ?string $index = null, int $batc
// Save updateIndex for later
$updateIndex = $row[$index] ?? null;

if ($updateIndex === null) {
throw new InvalidArgumentException(
'The index ("' . $index . '") for updateBatch() is missing in the data: '
. json_encode($row)
);
}

// Must be called first so we don't
// strip out updated_at values.
$row = $this->doProtectFields($row);
Expand Down Expand Up @@ -1222,10 +1237,10 @@ public function protect(bool $protect = true)
}

/**
* Ensures that only the fields that are allowed to be updated
* are in the data array.
* Ensures that only the fields that are allowed to be updated are
* in the data array.
*
* Used by insert() and update() to protect against mass assignment
* Used by update() and updateBatch() to protect against mass assignment
* vulnerabilities.
*
* @param array $data Data
Expand All @@ -1251,6 +1266,22 @@ protected function doProtectFields(array $data): array
return $data;
}

/**
* Ensures that only the fields that are allowed to be inserted are in
* the data array.
*
* Used by insert() and insertBatch() to protect against mass assignment
* vulnerabilities.
*
* @param array $data Data
*
* @throws DataException
*/
protected function doProtectFieldsForInsert(array $data): array
{
return $this->doProtectFields($data);
}

/**
* Sets the date or current date if null value is passed.
*
Expand Down
4 changes: 4 additions & 0 deletions system/CLI/BaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ protected function call(string $command, array $params = [])

/**
* A simple method to display an error with line/file, in child commands.
*
* @return void
*/
protected function showError(Throwable $e)
{
Expand All @@ -129,6 +131,8 @@ protected function showError(Throwable $e)

/**
* Show Help includes (Usage, Arguments, Description, Options).
*
* @return void
*/
public function showHelp()
{
Expand Down
26 changes: 26 additions & 0 deletions system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,8 @@ class CLI

/**
* Static "constructor".
*
* @return void
*/
public static function init()
{
Expand Down Expand Up @@ -429,6 +431,8 @@ protected static function validate(string $field, string $value, $rules): bool
/**
* Outputs a string to the CLI without any surrounding newlines.
* Useful for showing repeating elements on a single line.
*
* @return void
*/
public static function print(string $text = '', ?string $foreground = null, ?string $background = null)
{
Expand All @@ -443,6 +447,8 @@ public static function print(string $text = '', ?string $foreground = null, ?str

/**
* Outputs a string to the cli on it's own line.
*
* @return void
*/
public static function write(string $text = '', ?string $foreground = null, ?string $background = null)
{
Expand All @@ -460,6 +466,8 @@ public static function write(string $text = '', ?string $foreground = null, ?str

/**
* Outputs an error to the CLI using STDERR instead of STDOUT
*
* @return void
*/
public static function error(string $text, string $foreground = 'light_red', ?string $background = null)
{
Expand All @@ -481,6 +489,8 @@ public static function error(string $text, string $foreground = 'light_red', ?st
* Beeps a certain number of times.
*
* @param int $num The number of times to beep
*
* @return void
*/
public static function beep(int $num = 1)
{
Expand All @@ -493,6 +503,8 @@ public static function beep(int $num = 1)
*
* @param int $seconds Number of seconds
* @param bool $countdown Show a countdown or not
*
* @return void
*/
public static function wait(int $seconds, bool $countdown = false)
{
Expand Down Expand Up @@ -529,6 +541,8 @@ public static function isWindows(): bool

/**
* Enter a number of empty lines
*
* @return void
*/
public static function newLine(int $num = 1)
{
Expand All @@ -542,6 +556,8 @@ public static function newLine(int $num = 1)
* Clears the screen of output
*
* @codeCoverageIgnore
*
* @return void
*/
public static function clearScreen()
{
Expand Down Expand Up @@ -735,6 +751,8 @@ public static function getHeight(int $default = 32): int
* Populates the CLI's dimensions.
*
* @codeCoverageIgnore
*
* @return void
*/
public static function generateDimensions()
{
Expand Down Expand Up @@ -778,6 +796,8 @@ public static function generateDimensions()
* to update it. Set $thisStep = false to erase the progress bar.
*
* @param bool|int $thisStep
*
* @return void
*/
public static function showProgress($thisStep = 1, int $totalSteps = 10)
{
Expand Down Expand Up @@ -859,6 +879,8 @@ public static function wrap(?string $string = null, int $max = 0, int $padLeft =
/**
* Parses the command line it was called from and collects all
* options and valid segments.
*
* @return void
*/
protected static function parseCommandLine()
{
Expand Down Expand Up @@ -998,6 +1020,8 @@ public static function getOptionString(bool $useLongOpts = false, bool $trim = f
*
* @param array $tbody List of rows
* @param array $thead List of columns
*
* @return void
*/
public static function table(array $tbody, array $thead = [])
{
Expand Down Expand Up @@ -1096,6 +1120,8 @@ public static function table(array $tbody, array $thead = [])
* solution down the road.
*
* @param resource $handle
*
* @return void
*/
protected static function fwrite($handle, string $string)
{
Expand Down
2 changes: 2 additions & 0 deletions system/CLI/Commands.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public function getCommands()
/**
* Discovers all commands in the framework and within user code,
* and collects instances of them to work with.
*
* @return void
*/
public function discoverCommands()
{
Expand Down
2 changes: 2 additions & 0 deletions system/CLI/Console.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public function run()

/**
* Displays basic information about the Console.
*
* @return void
*/
public function showHeader(bool $suppress = false)
{
Expand Down
2 changes: 2 additions & 0 deletions system/Cache/CacheInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ interface CacheInterface
{
/**
* Takes care of any handler-specific setup that must be done.
*
* @return void
*/
public function initialize();

Expand Down
2 changes: 1 addition & 1 deletion system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class CodeIgniter
/**
* The current version of CodeIgniter Framework
*/
public const CI_VERSION = '4.3.7';
public const CI_VERSION = '4.3.8';

/**
* App startup time.
Expand Down
6 changes: 2 additions & 4 deletions system/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -470,10 +470,8 @@ function esc($data, string $context = 'html', ?string $encoding = null)
*
* @see https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security
*
* @param int $duration How long should the SSL header be set for? (in seconds)
* Defaults to 1 year.
* @param RequestInterface $request
* @param ResponseInterface $response
* @param int $duration How long should the SSL header be set for? (in seconds)
* Defaults to 1 year.
*
* @throws HTTPException
*/
Expand Down
2 changes: 2 additions & 0 deletions system/Config/BaseConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ protected function getEnvValue(string $property, string $prefix, string $shortPr
* Provides external libraries a simple way to register one or more
* options into a config file.
*
* @return void
*
* @throws ReflectionException
*/
protected function registerProperties()
Expand Down
Loading

0 comments on commit 10c23e9

Please sign in to comment.