Skip to content

Commit

Permalink
Release v4.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Sep 5, 2022
1 parent 26ebf14 commit 872c8fb
Show file tree
Hide file tree
Showing 38 changed files with 290 additions and 223 deletions.
1 change: 1 addition & 0 deletions app/Config/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ class App extends BaseConfig
* Defaults to `Lax` as recommended in this link:
*
* @see https://portswigger.net/web-security/csrf/samesite-cookies
*
* @deprecated `Config\Cookie` $samesite property is used.
*
* @var string
Expand Down
8 changes: 4 additions & 4 deletions app/Config/ContentSecurityPolicy.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
*/
class ContentSecurityPolicy extends BaseConfig
{
//-------------------------------------------------------------------------
// -------------------------------------------------------------------------
// Broadbrush CSP management
//-------------------------------------------------------------------------
// -------------------------------------------------------------------------

/**
* Default CSP report context
Expand All @@ -43,10 +43,10 @@ class ContentSecurityPolicy extends BaseConfig
*/
public $upgradeInsecureRequests = false;

//-------------------------------------------------------------------------
// -------------------------------------------------------------------------
// Sources allowed
// Note: once you set a policy to 'none', it cannot be further restricted
//-------------------------------------------------------------------------
// -------------------------------------------------------------------------

/**
* Will default to self if not overridden
Expand Down
2 changes: 1 addition & 1 deletion app/Config/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// where controller filters or CSRF protection are bypassed.
// If you don't want to define all routes, please use the Auto Routing (Improved).
// Set `$autoRoutesImproved` to true in `app/Config/Feature.php` and set the following to true.
//$routes->setAutoRoute(false);
// $routes->setAutoRoute(false);

/*
* --------------------------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions app/Config/Validation.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

class Validation extends BaseConfig
{
//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Setup
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Stores the classes that contain the
Expand All @@ -38,7 +38,7 @@ class Validation extends BaseConfig
'single' => 'CodeIgniter\Validation\Views\single',
];

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Rules
//--------------------------------------------------------------------
// --------------------------------------------------------------------
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"require-dev": {
"codeigniter/coding-standard": "^1.1",
"fakerphp/faker": "^1.9",
"friendsofphp/php-cs-fixer": "3.6.*",
"friendsofphp/php-cs-fixer": "~3.11.0",
"mikey179/vfsstream": "^1.6",
"nexusphp/cs-config": "^3.3",
"phpunit/phpunit": "^9.1",
Expand Down
8 changes: 4 additions & 4 deletions system/API/ResponseTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ protected function fail($messages, int $status = 400, ?string $code = null, stri
return $this->respond($response, $status, $customMessage);
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Response Helpers
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Used after successfully creating a new resource.
Expand Down Expand Up @@ -290,9 +290,9 @@ protected function failServerError(string $description = 'Internal Server Error'
return $this->fail($description, $this->codes['server_error'], $code, $message);
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Utility Methods
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Handles formatting a response. Currently makes some heavy assumptions
Expand Down
4 changes: 2 additions & 2 deletions system/CLI/CLI.php
Original file line number Diff line number Diff line change
Expand Up @@ -756,9 +756,9 @@ public static function wrap(?string $string = null, int $max = 0, int $padLeft =
return $lines;
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Command-Line 'URI' support
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Parses the command line it was called from and collects all
Expand Down
6 changes: 2 additions & 4 deletions system/Cache/Handlers/RedisHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,15 @@ public function increment(string $key, int $offset = 1)
{
$key = static::validateKey($key, $this->prefix);

return $this->redis->hIncrBy($key, 'data', $offset);
return $this->redis->hIncrBy($key, '__ci_value', $offset);
}

/**
* {@inheritDoc}
*/
public function decrement(string $key, int $offset = 1)
{
$key = static::validateKey($key, $this->prefix);

return $this->redis->hIncrBy($key, 'data', -$offset);
return $this->increment($key, -$offset);
}

/**
Expand Down
13 changes: 7 additions & 6 deletions system/CodeIgniter.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class CodeIgniter
/**
* The current version of CodeIgniter Framework
*/
public const CI_VERSION = '4.2.5';
public const CI_VERSION = '4.2.6';

/**
* App startup time.
Expand Down Expand Up @@ -730,9 +730,12 @@ protected function generateCacheName(Cache $config): string
}

$uri = $this->request->getUri();

if ($config->cacheQueryString) {
$name = URI::createURIString($uri->getScheme(), $uri->getAuthority(), $uri->getPath(), $uri->getQuery());
if (is_array($config->cacheQueryString)) {
$name = URI::createURIString($uri->getScheme(), $uri->getAuthority(), $uri->getPath(), $uri->getQuery(['only' => $config->cacheQueryString]));
} else {
$name = URI::createURIString($uri->getScheme(), $uri->getAuthority(), $uri->getPath(), $uri->getQuery());
}
} else {
$name = URI::createURIString($uri->getScheme(), $uri->getAuthority(), $uri->getPath());
}
Expand Down Expand Up @@ -945,11 +948,9 @@ protected function display404errors(PageNotFoundException $e)
$this->response->setStatusCode($e->getCode());

if (ENVIRONMENT !== 'testing') {
// @codeCoverageIgnoreStart
if (ob_get_level() > 0) {
ob_end_flush();
ob_end_flush(); // @codeCoverageIgnore
}
// @codeCoverageIgnoreEnd
}
// When testing, one is for phpunit, another is for test case.
elseif (ob_get_level() > 2) {
Expand Down
72 changes: 36 additions & 36 deletions system/Config/BaseService.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,43 +92,43 @@
* @see http://blog.ircmaxell.com/2015/11/simple-easy-risk-and-change.html
* @see http://www.infoq.com/presentations/Simple-Made-Easy
*
* @method static CacheInterface cache(Cache $config = null, $getShared = true)
* @method static CLIRequest clirequest(App $config = null, $getShared = true)
* @method static CodeIgniter codeigniter(App $config = null, $getShared = true)
* @method static Commands commands($getShared = true)
* @method static void createRequest(App $config, bool $isCli = false)
* @method static ContentSecurityPolicy csp(CSPConfig $config = null, $getShared = true)
* @method static CURLRequest curlrequest($options = [], ResponseInterface $response = null, App $config = null, $getShared = true)
* @method static Email email($config = null, $getShared = true)
* @method static EncrypterInterface encrypter(Encryption $config = null, $getShared = false)
* @method static Exceptions exceptions(ConfigExceptions $config = null, IncomingRequest $request = null, Response $response = null, $getShared = true)
* @method static Filters filters(ConfigFilters $config = null, $getShared = true)
* @method static Format format(ConfigFormat $config = null, $getShared = true)
* @method static Honeypot honeypot(ConfigHoneyPot $config = null, $getShared = true)
* @method static BaseHandler image($handler = null, Images $config = null, $getShared = true)
* @method static IncomingRequest incomingrequest(?App $config = null, bool $getShared = true)
* @method static Iterator iterator($getShared = true)
* @method static Language language($locale = null, $getShared = true)
* @method static Logger logger($getShared = true)
* @method static MigrationRunner migrations(Migrations $config = null, ConnectionInterface $db = null, $getShared = true)
* @method static Negotiate negotiator(RequestInterface $request = null, $getShared = true)
* @method static Pager pager(ConfigPager $config = null, RendererInterface $view = null, $getShared = true)
* @method static Parser parser($viewPath = null, ConfigView $config = null, $getShared = true)
* @method static RedirectResponse redirectresponse(App $config = null, $getShared = true)
* @method static View renderer($viewPath = null, ConfigView $config = null, $getShared = true)
* @method static CacheInterface cache(Cache $config = null, $getShared = true)
* @method static CLIRequest clirequest(App $config = null, $getShared = true)
* @method static CodeIgniter codeigniter(App $config = null, $getShared = true)
* @method static Commands commands($getShared = true)
* @method static void createRequest(App $config, bool $isCli = false)
* @method static ContentSecurityPolicy csp(CSPConfig $config = null, $getShared = true)
* @method static CURLRequest curlrequest($options = [], ResponseInterface $response = null, App $config = null, $getShared = true)
* @method static Email email($config = null, $getShared = true)
* @method static EncrypterInterface encrypter(Encryption $config = null, $getShared = false)
* @method static Exceptions exceptions(ConfigExceptions $config = null, IncomingRequest $request = null, Response $response = null, $getShared = true)
* @method static Filters filters(ConfigFilters $config = null, $getShared = true)
* @method static Format format(ConfigFormat $config = null, $getShared = true)
* @method static Honeypot honeypot(ConfigHoneyPot $config = null, $getShared = true)
* @method static BaseHandler image($handler = null, Images $config = null, $getShared = true)
* @method static IncomingRequest incomingrequest(?App $config = null, bool $getShared = true)
* @method static Iterator iterator($getShared = true)
* @method static Language language($locale = null, $getShared = true)
* @method static Logger logger($getShared = true)
* @method static MigrationRunner migrations(Migrations $config = null, ConnectionInterface $db = null, $getShared = true)
* @method static Negotiate negotiator(RequestInterface $request = null, $getShared = true)
* @method static Pager pager(ConfigPager $config = null, RendererInterface $view = null, $getShared = true)
* @method static Parser parser($viewPath = null, ConfigView $config = null, $getShared = true)
* @method static RedirectResponse redirectresponse(App $config = null, $getShared = true)
* @method static View renderer($viewPath = null, ConfigView $config = null, $getShared = true)
* @method static IncomingRequest|CLIRequest request(App $config = null, $getShared = true)
* @method static Response response(App $config = null, $getShared = true)
* @method static Router router(RouteCollectionInterface $routes = null, Request $request = null, $getShared = true)
* @method static RouteCollection routes($getShared = true)
* @method static Security security(App $config = null, $getShared = true)
* @method static Session session(App $config = null, $getShared = true)
* @method static Throttler throttler($getShared = true)
* @method static Timer timer($getShared = true)
* @method static Toolbar toolbar(ConfigToolbar $config = null, $getShared = true)
* @method static Typography typography($getShared = true)
* @method static URI uri($uri = null, $getShared = true)
* @method static Validation validation(ConfigValidation $config = null, $getShared = true)
* @method static Cell viewcell($getShared = true)
* @method static Response response(App $config = null, $getShared = true)
* @method static Router router(RouteCollectionInterface $routes = null, Request $request = null, $getShared = true)
* @method static RouteCollection routes($getShared = true)
* @method static Security security(App $config = null, $getShared = true)
* @method static Session session(App $config = null, $getShared = true)
* @method static Throttler throttler($getShared = true)
* @method static Timer timer($getShared = true)
* @method static Toolbar toolbar(ConfigToolbar $config = null, $getShared = true)
* @method static Typography typography($getShared = true)
* @method static URI uri($uri = null, $getShared = true)
* @method static Validation validation(ConfigValidation $config = null, $getShared = true)
* @method static Cell viewcell($getShared = true)
*/
class BaseService
{
Expand Down
2 changes: 2 additions & 0 deletions system/Cookie/CloneableCookieInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public function withExpired();
* Creates a new Cookie that will virtually never expire from the browser.
*
* @return static
*
* @deprecated See https://github.com/codeigniter4/CodeIgniter4/pull/6413
*/
public function withNeverExpiring();

Expand Down
26 changes: 13 additions & 13 deletions system/Cookie/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ public static function setDefaults($config = [])
return $oldDefaults;
}

//=========================================================================
// =========================================================================
// CONSTRUCTORS
//=========================================================================
// =========================================================================

/**
* Create a new Cookie instance from a `Set-Cookie` header.
Expand Down Expand Up @@ -238,9 +238,9 @@ final public function __construct(string $name, string $value = '', array $optio
$this->raw = $raw;
}

//=========================================================================
// =========================================================================
// GETTERS
//=========================================================================
// =========================================================================

/**
* {@inheritDoc}
Expand Down Expand Up @@ -391,9 +391,9 @@ public function getOptions(): array
];
}

//=========================================================================
// =========================================================================
// CLONING
//=========================================================================
// =========================================================================

/**
* {@inheritDoc}
Expand Down Expand Up @@ -460,7 +460,7 @@ public function withExpired()
}

/**
* {@inheritDoc}
* @deprecated See https://github.com/codeigniter4/CodeIgniter4/pull/6413
*/
public function withNeverExpiring()
{
Expand Down Expand Up @@ -556,9 +556,9 @@ public function withRaw(bool $raw = true)
return $cookie;
}

//=========================================================================
// =========================================================================
// ARRAY ACCESS FOR BC
//=========================================================================
// =========================================================================

/**
* Whether an offset exists.
Expand Down Expand Up @@ -614,9 +614,9 @@ public function offsetUnset($offset): void
throw new LogicException(sprintf('Cannot unset values of properties of %s as it is immutable.', static::class));
}

//=========================================================================
// =========================================================================
// CONVERTERS
//=========================================================================
// =========================================================================

/**
* {@inheritDoc}
Expand Down Expand Up @@ -716,9 +716,9 @@ protected static function convertExpiresTimestamp($expires = 0): int
return $expires > 0 ? (int) $expires : 0;
}

//=========================================================================
// =========================================================================
// VALIDATION
//=========================================================================
// =========================================================================

/**
* Validates the cookie name per RFC 2616.
Expand Down
1 change: 1 addition & 0 deletions system/Database/BaseBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1928,6 +1928,7 @@ public function insert($set = null, ?bool $escape = null)
* @internal This is a temporary solution.
*
* @see https://github.com/codeigniter4/CodeIgniter4/pull/5376
*
* @TODO Fix a root cause, and this method should be removed.
*/
protected function removeAlias(string $from): string
Expand Down
4 changes: 2 additions & 2 deletions system/Database/BaseConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -1352,9 +1352,9 @@ protected function getDriverFunctionPrefix(): string
return strtolower($this->DBDriver) . '_';
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// META Methods
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* Returns an array of table names
Expand Down
1 change: 0 additions & 1 deletion system/Database/SQLSRV/Forge.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ protected function _createTableAttributes(array $attributes): string
*/
protected function _alterTable(string $alterType, string $table, $field)
{

// Handle DROP here
if ($alterType === 'DROP') {
// check if fields are part of any indexes
Expand Down
6 changes: 3 additions & 3 deletions system/Debug/Exceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public function shutdownHandler()
['type' => $type, 'message' => $message, 'file' => $file, 'line' => $line] = $error;

if (in_array($type, [E_ERROR, E_CORE_ERROR, E_COMPILE_ERROR, E_PARSE], true)) {
$this->exceptionHandler(new ErrorException($message, $type, 0, $file, $line));
$this->exceptionHandler(new ErrorException($message, 0, $type, $file, $line));
}
}

Expand Down Expand Up @@ -329,9 +329,9 @@ protected function determineCodes(Throwable $exception): array
return [$statusCode, $exitStatus];
}

//--------------------------------------------------------------------
// --------------------------------------------------------------------
// Display Methods
//--------------------------------------------------------------------
// --------------------------------------------------------------------

/**
* This makes nicer looking paths for the error output.
Expand Down
Loading

0 comments on commit 872c8fb

Please sign in to comment.