Skip to content

Commit 1e3f32d

Browse files
committed
Merge branch 'develop' into admin/scripts
2 parents 359907c + e784410 commit 1e3f32d

35 files changed

Lines changed: 125 additions & 86 deletions

File tree

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"php": ">=7.1",
99
"ext-curl": "*",
1010
"ext-intl": "*",
11+
"ext-json": "*",
1112
"kint-php/kint": "^2.1",
1213
"zendframework/zend-escaper": "^2.5"
1314
},

spark

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
* this class mainly acts as a passthru to the framework itself.
1313
*/
1414

15+
define('SPARKED', true);
16+
1517
/*
1618
*---------------------------------------------------------------
1719
* BOOTSTRAP THE APPLICATION

system/Autoloader/Autoloader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ protected function requireFile(string $file)
326326
{
327327
$file = $this->sanitizeFilename($file);
328328

329-
if (file_exists($file))
329+
if (is_file($file))
330330
{
331331
require_once $file;
332332

system/Autoloader/FileLocator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public function search(string $path, string $ext = 'php'): array
233233
{
234234
$folder = rtrim($folder, '/') . '/';
235235

236-
if (file_exists($folder . $path))
236+
if (is_file($folder . $path) === true)
237237
{
238238
$foundPaths[] = $folder . $path;
239239
}
@@ -369,7 +369,7 @@ protected function legacyLocate(string $file, string $folder = null): string
369369
*/
370370
protected function requireFile(string $path): bool
371371
{
372-
return file_exists($path);
372+
return is_file($path);
373373
}
374374

375375
//--------------------------------------------------------------------

system/Cache/Handlers/FileHandler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public function delete(string $key)
137137
{
138138
$key = $this->prefix . $key;
139139

140-
return file_exists($this->path . $key) ? unlink($this->path . $key) : false;
140+
return is_file($this->path . $key) ? unlink($this->path . $key) : false;
141141
}
142142

143143
//--------------------------------------------------------------------
@@ -246,7 +246,7 @@ public function getMetaData(string $key)
246246
{
247247
$key = $this->prefix . $key;
248248

249-
if (! file_exists($this->path . $key))
249+
if (! is_file($this->path . $key))
250250
{
251251
return false;
252252
}
@@ -473,7 +473,7 @@ protected function getDirFileInfo($source_dir, $top_level_only = true, $_recursi
473473
*/
474474
protected function getFileInfo(string $file, array $returned_values = ['name', 'server_path', 'size', 'date'])
475475
{
476-
if (! file_exists($file))
476+
if (! is_file($file))
477477
{
478478
return false;
479479
}

system/CodeIgniter.php

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,19 @@ protected function handleRequest(RouteCollectionInterface $routes = null, $cache
297297

298298
$uri = $this->request instanceof CLIRequest ? $this->request->getPath() : $this->request->uri->getPath();
299299

300-
$possibleRedirect = $filters->run($uri, 'before');
301-
if ($possibleRedirect instanceof RedirectResponse)
300+
// Never run filters when running through Spark cli
301+
if (! defined('SPARKED'))
302302
{
303-
return $possibleRedirect;
304-
}
305-
// If a Response instance is returned, the Response will be sent back to the client and script execution will stop
306-
if ($possibleRedirect instanceof ResponseInterface)
307-
{
308-
return $possibleRedirect->send();
303+
$possibleRedirect = $filters->run($uri, 'before');
304+
if ($possibleRedirect instanceof RedirectResponse)
305+
{
306+
return $possibleRedirect;
307+
}
308+
// If a Response instance is returned, the Response will be sent back to the client and script execution will stop
309+
if ($possibleRedirect instanceof ResponseInterface)
310+
{
311+
return $possibleRedirect->send();
312+
}
309313
}
310314

311315
$returned = $this->startController();
@@ -331,9 +335,17 @@ protected function handleRequest(RouteCollectionInterface $routes = null, $cache
331335
// so it can be used with the output.
332336
$this->gatherOutput($cacheConfig, $returned);
333337

334-
$filters->setResponse($this->response);
335-
// Run "after" filters
336-
$response = $filters->run($uri, 'after');
338+
// Never run filters when running through Spark cli
339+
if (! defined('SPARKED'))
340+
{
341+
$filters->setResponse($this->response);
342+
// Run "after" filters
343+
$response = $filters->run($uri, 'after');
344+
}
345+
else
346+
{
347+
$response = $this->response;
348+
}
337349

338350
if ($response instanceof Response)
339351
{
@@ -399,7 +411,7 @@ protected function detectEnvironment()
399411
*/
400412
protected function bootstrapEnvironment()
401413
{
402-
if (file_exists(APPPATH . 'Config/Boot/' . ENVIRONMENT . '.php'))
414+
if (is_file(APPPATH . 'Config/Boot/' . ENVIRONMENT . '.php'))
403415
{
404416
require_once APPPATH . 'Config/Boot/' . ENVIRONMENT . '.php';
405417
}

system/ComposerScripts.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ protected static function removeDir($dir)
142142
*/
143143
public static function moveEscaper()
144144
{
145-
if (class_exists('\\Zend\\Escaper\\Escaper') && file_exists(static::getClassFilePath('\\Zend\\Escaper\\Escaper')))
145+
if (class_exists('\\Zend\\Escaper\\Escaper') && is_file(static::getClassFilePath('\\Zend\\Escaper\\Escaper')))
146146
{
147147
$base = static::$basePath . 'ZendEscaper';
148148

@@ -181,7 +181,7 @@ public static function moveKint()
181181
{
182182
$filename = 'vendor/kint-php/kint/build/kint-aante-light.php';
183183

184-
if (file_exists($filename))
184+
if (is_file($filename))
185185
{
186186
$base = static::$basePath . 'Kint';
187187

system/Database/BaseBuilder.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,10 @@ public function __construct($tableName, ConnectionInterface &$db, array $options
233233
{
234234
foreach ($options as $key => $value)
235235
{
236-
$this->$key = $value;
236+
if (property_exists($this, $key))
237+
{
238+
$this->$key = $value;
239+
}
237240
}
238241
}
239242
}

system/Database/BaseConnection.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,10 @@ public function __construct(array $params)
338338
{
339339
foreach ($params as $key => $value)
340340
{
341-
$this->$key = $value;
341+
if (property_exists($this, $key))
342+
{
343+
$this->$key = $value;
344+
}
342345
}
343346
}
344347

@@ -382,7 +385,10 @@ public function initialize()
382385
// Replace the current settings with those of the failover
383386
foreach ($failover as $key => $val)
384387
{
385-
$this->$key = $val;
388+
if (property_exists($this, $key))
389+
{
390+
$this->$key = $val;
391+
}
386392
}
387393

388394
// Try to connect

system/Database/Forge.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -852,10 +852,10 @@ protected function _alterTable($alter_type, $table, $field)
852852
$sql .= ($alter_type === 'ADD') ? 'ADD ' : $alter_type . ' COLUMN ';
853853

854854
$sqls = [];
855-
for ($i = 0, $c = count($field); $i < $c; $i++)
855+
foreach ($field as $data)
856856
{
857857
$sqls[] = $sql
858-
. ($field[$i]['_literal'] !== false ? $field[$i]['_literal'] : $this->_processColumn($field[$i]));
858+
. ($data['_literal'] !== false ? $data['_literal'] : $this->_processColumn($data));
859859
}
860860

861861
return $sqls;

0 commit comments

Comments
 (0)