Skip to content

Commit 45c1015

Browse files
committed
Merge branch 'master' into 3.next
2 parents c969cc4 + 8cb84e7 commit 45c1015

File tree

13 files changed

+153
-57
lines changed

13 files changed

+153
-57
lines changed

.mailmap

+2
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,5 @@ antograssiot <[email protected]>
111111
112112
Patrick Conroy <[email protected]>
113113
114+
115+

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"php": ">=5.6.0",
3232
"ext-intl": "*",
3333
"ext-mbstring": "*",
34-
"cakephp/chronos": "^1.0.0",
34+
"cakephp/chronos": "^1.0.1",
3535
"aura/intl": "^3.0.0",
3636
"psr/log": "^1.0.0",
3737
"zendframework/zend-diactoros": "^1.4.0"

src/Cache/Engine/MemcachedEngine.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ public function groups()
500500
}
501501
}
502502

503-
$groups = $this->_Memcached->getMulti($this->_compiledGroupNames);
503+
$groups = $this->_Memcached->getMulti($this->_compiledGroupNames) ?: [];
504504
if (count($groups) !== count($this->_config['groups'])) {
505505
foreach ($this->_compiledGroupNames as $group) {
506506
if (!isset($groups[$group])) {

src/Controller/Component/RequestHandlerComponent.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,13 @@ public function startup(Event $event)
233233
public function convertXml($xml)
234234
{
235235
try {
236-
$xml = Xml::build($xml, ['readFile' => false]);
237-
if (isset($xml->data)) {
238-
return Xml::toArray($xml->data);
236+
$xml = Xml::build($xml, ['return' => 'domdocument', 'readFile' => false]);
237+
// We might not get child nodes if there are nested inline entities.
238+
if ($xml->childNodes->length > 0) {
239+
return Xml::toArray($xml);
239240
}
240241

241-
return Xml::toArray($xml);
242+
return [];
242243
} catch (XmlException $e) {
243244
return [];
244245
}

src/Database/Schema/MysqlSchema.php

+21-21
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ protected function _convertColumn($column)
130130
}
131131
if (strpos($col, 'text') !== false) {
132132
$lengthName = substr($col, 0, -4);
133-
$length = isset(Table::$columnLengths[$lengthName]) ? Table::$columnLengths[$lengthName] : null;
133+
$length = isset(TableSchema::$columnLengths[$lengthName]) ? TableSchema::$columnLengths[$lengthName] : null;
134134

135135
return ['type' => TableSchema::TYPE_TEXT, 'length' => $length];
136136
}
@@ -139,7 +139,7 @@ protected function _convertColumn($column)
139139
}
140140
if (strpos($col, 'blob') !== false || $col === 'binary') {
141141
$lengthName = substr($col, 0, -4);
142-
$length = isset(Table::$columnLengths[$lengthName]) ? Table::$columnLengths[$lengthName] : null;
142+
$length = isset(TableSchema::$columnLengths[$lengthName]) ? TableSchema::$columnLengths[$lengthName] : null;
143143

144144
return ['type' => TableSchema::TYPE_BINARY, 'length' => $length];
145145
}
@@ -195,25 +195,25 @@ public function convertIndexDescription(TableSchema $schema, $row)
195195

196196
$name = $row['Key_name'];
197197
if ($name === 'PRIMARY') {
198-
$name = $type = Table::CONSTRAINT_PRIMARY;
198+
$name = $type = TableSchema::CONSTRAINT_PRIMARY;
199199
}
200200

201201
$columns[] = $row['Column_name'];
202202

203203
if ($row['Index_type'] === 'FULLTEXT') {
204-
$type = Table::INDEX_FULLTEXT;
204+
$type = TableSchema::INDEX_FULLTEXT;
205205
} elseif ($row['Non_unique'] == 0 && $type !== 'primary') {
206-
$type = Table::CONSTRAINT_UNIQUE;
206+
$type = TableSchema::CONSTRAINT_UNIQUE;
207207
} elseif ($type !== 'primary') {
208-
$type = Table::INDEX_INDEX;
208+
$type = TableSchema::INDEX_INDEX;
209209
}
210210

211211
if (!empty($row['Sub_part'])) {
212212
$length[$row['Column_name']] = $row['Sub_part'];
213213
}
214214
$isIndex = (
215-
$type === Table::INDEX_INDEX ||
216-
$type === Table::INDEX_FULLTEXT
215+
$type === TableSchema::INDEX_INDEX ||
216+
$type === TableSchema::INDEX_FULLTEXT
217217
);
218218
if ($isIndex) {
219219
$existing = $schema->getIndex($name);
@@ -263,7 +263,7 @@ public function describeForeignKeySql($tableName, $config)
263263
public function convertForeignKeyDescription(TableSchema $schema, $row)
264264
{
265265
$data = [
266-
'type' => Table::CONSTRAINT_FOREIGN,
266+
'type' => TableSchema::CONSTRAINT_FOREIGN,
267267
'columns' => [$row['COLUMN_NAME']],
268268
'references' => [$row['REFERENCED_TABLE_NAME'], $row['REFERENCED_COLUMN_NAME']],
269269
'update' => $this->_convertOnClause($row['UPDATE_RULE']),
@@ -345,27 +345,27 @@ public function columnSql(TableSchema $schema, $name)
345345
}
346346
break;
347347
case TableSchema::TYPE_TEXT:
348-
$isKnownLength = in_array($data['length'], Table::$columnLengths);
348+
$isKnownLength = in_array($data['length'], TableSchema::$columnLengths);
349349
if (empty($data['length']) || !$isKnownLength) {
350350
$out .= ' TEXT';
351351
break;
352352
}
353353

354354
if ($isKnownLength) {
355-
$length = array_search($data['length'], Table::$columnLengths);
355+
$length = array_search($data['length'], TableSchema::$columnLengths);
356356
$out .= ' ' . strtoupper($length) . 'TEXT';
357357
}
358358

359359
break;
360360
case TableSchema::TYPE_BINARY:
361-
$isKnownLength = in_array($data['length'], Table::$columnLengths);
361+
$isKnownLength = in_array($data['length'], TableSchema::$columnLengths);
362362
if (empty($data['length']) || !$isKnownLength) {
363363
$out .= ' BLOB';
364364
break;
365365
}
366366

367367
if ($isKnownLength) {
368-
$length = array_search($data['length'], Table::$columnLengths);
368+
$length = array_search($data['length'], TableSchema::$columnLengths);
369369
$out .= ' ' . strtoupper($length) . 'BLOB';
370370
}
371371

@@ -452,7 +452,7 @@ public function columnSql(TableSchema $schema, $name)
452452
public function constraintSql(TableSchema $schema, $name)
453453
{
454454
$data = $schema->getConstraint($name);
455-
if ($data['type'] === Table::CONSTRAINT_PRIMARY) {
455+
if ($data['type'] === TableSchema::CONSTRAINT_PRIMARY) {
456456
$columns = array_map(
457457
[$this->_driver, 'quoteIdentifier'],
458458
$data['columns']
@@ -462,10 +462,10 @@ public function constraintSql(TableSchema $schema, $name)
462462
}
463463

464464
$out = '';
465-
if ($data['type'] === Table::CONSTRAINT_UNIQUE) {
465+
if ($data['type'] === TableSchema::CONSTRAINT_UNIQUE) {
466466
$out = 'UNIQUE KEY ';
467467
}
468-
if ($data['type'] === Table::CONSTRAINT_FOREIGN) {
468+
if ($data['type'] === TableSchema::CONSTRAINT_FOREIGN) {
469469
$out = 'CONSTRAINT ';
470470
}
471471
$out .= $this->_driver->quoteIdentifier($name);
@@ -483,7 +483,7 @@ public function addConstraintSql(TableSchema $schema)
483483

484484
foreach ($schema->constraints() as $name) {
485485
$constraint = $schema->getConstraint($name);
486-
if ($constraint['type'] === Table::CONSTRAINT_FOREIGN) {
486+
if ($constraint['type'] === TableSchema::CONSTRAINT_FOREIGN) {
487487
$tableName = $this->_driver->quoteIdentifier($schema->name());
488488
$sql[] = sprintf($sqlPattern, $tableName, $this->constraintSql($schema, $name));
489489
}
@@ -502,7 +502,7 @@ public function dropConstraintSql(TableSchema $schema)
502502

503503
foreach ($schema->constraints() as $name) {
504504
$constraint = $schema->getConstraint($name);
505-
if ($constraint['type'] === Table::CONSTRAINT_FOREIGN) {
505+
if ($constraint['type'] === TableSchema::CONSTRAINT_FOREIGN) {
506506
$tableName = $this->_driver->quoteIdentifier($schema->name());
507507
$constraintName = $this->_driver->quoteIdentifier($name);
508508
$sql[] = sprintf($sqlPattern, $tableName, $constraintName);
@@ -519,10 +519,10 @@ public function indexSql(TableSchema $schema, $name)
519519
{
520520
$data = $schema->getIndex($name);
521521
$out = '';
522-
if ($data['type'] === Table::INDEX_INDEX) {
522+
if ($data['type'] === TableSchema::INDEX_INDEX) {
523523
$out = 'KEY ';
524524
}
525-
if ($data['type'] === Table::INDEX_FULLTEXT) {
525+
if ($data['type'] === TableSchema::INDEX_FULLTEXT) {
526526
$out = 'FULLTEXT KEY ';
527527
}
528528
$out .= $this->_driver->quoteIdentifier($name);
@@ -548,7 +548,7 @@ protected function _keySql($prefix, $data)
548548
$columns[$i] .= sprintf('(%d)', $data['length'][$column]);
549549
}
550550
}
551-
if ($data['type'] === Table::CONSTRAINT_FOREIGN) {
551+
if ($data['type'] === TableSchema::CONSTRAINT_FOREIGN) {
552552
return $prefix . sprintf(
553553
' FOREIGN KEY (%s) REFERENCES %s (%s) ON UPDATE %s ON DELETE %s',
554554
implode(', ', $columns),

src/Database/Schema/SqlserverSchema.php

+22-22
Original file line numberDiff line numberDiff line change
@@ -230,16 +230,16 @@ public function describeIndexSql($tableName, $config)
230230
*/
231231
public function convertIndexDescription(TableSchema $schema, $row)
232232
{
233-
$type = Table::INDEX_INDEX;
233+
$type = TableSchema::INDEX_INDEX;
234234
$name = $row['index_name'];
235235
if ($row['is_primary_key']) {
236-
$name = $type = Table::CONSTRAINT_PRIMARY;
236+
$name = $type = TableSchema::CONSTRAINT_PRIMARY;
237237
}
238-
if ($row['is_unique_constraint'] && $type === Table::INDEX_INDEX) {
239-
$type = Table::CONSTRAINT_UNIQUE;
238+
if ($row['is_unique_constraint'] && $type === TableSchema::INDEX_INDEX) {
239+
$type = TableSchema::CONSTRAINT_UNIQUE;
240240
}
241241

242-
if ($type === Table::INDEX_INDEX) {
242+
if ($type === TableSchema::INDEX_INDEX) {
243243
$existing = $schema->getIndex($name);
244244
} else {
245245
$existing = $schema->getConstraint($name);
@@ -250,7 +250,7 @@ public function convertIndexDescription(TableSchema $schema, $row)
250250
$columns = array_merge($existing['columns'], $columns);
251251
}
252252

253-
if ($type === Table::CONSTRAINT_PRIMARY || $type === Table::CONSTRAINT_UNIQUE) {
253+
if ($type === TableSchema::CONSTRAINT_PRIMARY || $type === TableSchema::CONSTRAINT_UNIQUE) {
254254
$schema->addConstraint($name, [
255255
'type' => $type,
256256
'columns' => $columns
@@ -292,7 +292,7 @@ public function describeForeignKeySql($tableName, $config)
292292
public function convertForeignKeyDescription(TableSchema $schema, $row)
293293
{
294294
$data = [
295-
'type' => Table::CONSTRAINT_FOREIGN,
295+
'type' => TableSchema::CONSTRAINT_FOREIGN,
296296
'columns' => [$row['column']],
297297
'references' => [$row['reference_table'], $row['reference_column']],
298298
'update' => $this->_convertOnClause($row['update_type']),
@@ -309,7 +309,7 @@ protected function _foreignOnClause($on)
309309
{
310310
$parent = parent::_foreignOnClause($on);
311311

312-
return $parent === 'RESTRICT' ? parent::_foreignOnClause(Table::ACTION_SET_NULL) : $parent;
312+
return $parent === 'RESTRICT' ? parent::_foreignOnClause(TableSchema::ACTION_SET_NULL) : $parent;
313313
}
314314

315315
/**
@@ -319,16 +319,16 @@ protected function _convertOnClause($clause)
319319
{
320320
switch ($clause) {
321321
case 'NO_ACTION':
322-
return Table::ACTION_NO_ACTION;
322+
return TableSchema::ACTION_NO_ACTION;
323323
case 'CASCADE':
324-
return Table::ACTION_CASCADE;
324+
return TableSchema::ACTION_CASCADE;
325325
case 'SET_NULL':
326-
return Table::ACTION_SET_NULL;
326+
return TableSchema::ACTION_SET_NULL;
327327
case 'SET_DEFAULT':
328-
return Table::ACTION_SET_DEFAULT;
328+
return TableSchema::ACTION_SET_DEFAULT;
329329
}
330330

331-
return Table::ACTION_SET_NULL;
331+
return TableSchema::ACTION_SET_NULL;
332332
}
333333

334334
/**
@@ -366,22 +366,22 @@ public function columnSql(TableSchema $schema, $name)
366366
}
367367
}
368368

369-
if ($data['type'] === TableSchema::TYPE_TEXT && $data['length'] !== Table::LENGTH_TINY) {
369+
if ($data['type'] === TableSchema::TYPE_TEXT && $data['length'] !== TableSchema::LENGTH_TINY) {
370370
$out .= ' NVARCHAR(MAX)';
371371
}
372372

373373
if ($data['type'] === TableSchema::TYPE_BINARY) {
374374
$out .= ' VARBINARY';
375375

376-
if ($data['length'] !== Table::LENGTH_TINY) {
376+
if ($data['length'] !== TableSchema::LENGTH_TINY) {
377377
$out .= '(MAX)';
378378
} else {
379-
$out .= sprintf('(%s)', Table::LENGTH_TINY);
379+
$out .= sprintf('(%s)', TableSchema::LENGTH_TINY);
380380
}
381381
}
382382

383383
if ($data['type'] === TableSchema::TYPE_STRING ||
384-
($data['type'] === TableSchema::TYPE_TEXT && $data['length'] === Table::LENGTH_TINY)
384+
($data['type'] === TableSchema::TYPE_TEXT && $data['length'] === TableSchema::LENGTH_TINY)
385385
) {
386386
$type = ' NVARCHAR';
387387

@@ -440,7 +440,7 @@ public function addConstraintSql(TableSchema $schema)
440440

441441
foreach ($schema->constraints() as $name) {
442442
$constraint = $schema->getConstraint($name);
443-
if ($constraint['type'] === Table::CONSTRAINT_FOREIGN) {
443+
if ($constraint['type'] === TableSchema::CONSTRAINT_FOREIGN) {
444444
$tableName = $this->_driver->quoteIdentifier($schema->name());
445445
$sql[] = sprintf($sqlPattern, $tableName, $this->constraintSql($schema, $name));
446446
}
@@ -459,7 +459,7 @@ public function dropConstraintSql(TableSchema $schema)
459459

460460
foreach ($schema->constraints() as $name) {
461461
$constraint = $schema->getConstraint($name);
462-
if ($constraint['type'] === Table::CONSTRAINT_FOREIGN) {
462+
if ($constraint['type'] === TableSchema::CONSTRAINT_FOREIGN) {
463463
$tableName = $this->_driver->quoteIdentifier($schema->name());
464464
$constraintName = $this->_driver->quoteIdentifier($name);
465465
$sql[] = sprintf($sqlPattern, $tableName, $constraintName);
@@ -495,10 +495,10 @@ public function constraintSql(TableSchema $schema, $name)
495495
{
496496
$data = $schema->getConstraint($name);
497497
$out = 'CONSTRAINT ' . $this->_driver->quoteIdentifier($name);
498-
if ($data['type'] === Table::CONSTRAINT_PRIMARY) {
498+
if ($data['type'] === TableSchema::CONSTRAINT_PRIMARY) {
499499
$out = 'PRIMARY KEY';
500500
}
501-
if ($data['type'] === Table::CONSTRAINT_UNIQUE) {
501+
if ($data['type'] === TableSchema::CONSTRAINT_UNIQUE) {
502502
$out .= ' UNIQUE';
503503
}
504504

@@ -518,7 +518,7 @@ protected function _keySql($prefix, $data)
518518
[$this->_driver, 'quoteIdentifier'],
519519
$data['columns']
520520
);
521-
if ($data['type'] === Table::CONSTRAINT_FOREIGN) {
521+
if ($data['type'] === TableSchema::CONSTRAINT_FOREIGN) {
522522
return $prefix . sprintf(
523523
' FOREIGN KEY (%s) REFERENCES %s (%s) ON UPDATE %s ON DELETE %s',
524524
implode(', ', $columns),

src/Datasource/EntityTrait.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ public function setDirty($property, $isDirty)
825825
/**
826826
* Checks if the entity is dirty or if a single property of it is dirty.
827827
*
828-
* @param string $property the field to check the status for
828+
* @param string|null $property The field to check the status for. Null for the whole entity.
829829
* @return bool Whether the property was changed or not
830830
*/
831831
public function isDirty($property = null)

src/I18n/Parser/PoFileParser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function parse($resource)
9898
} elseif (substr($line, 0, 9) === 'msgctxt "') {
9999
$item['context'] = substr($line, 9, -1);
100100
} elseif ($line[0] === '"') {
101-
$continues = isset($item['translated']) ? 'translated' : 'ids';
101+
$continues = isset($item['context']) ? 'context' : (isset($item['translated']) ? 'translated' : 'ids');
102102

103103
if (is_array($item[$continues])) {
104104
end($item[$continues]);

src/ORM/Table.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -2189,9 +2189,9 @@ protected function _update($entity, $data)
21892189
* any one of the records fails to save due to failed validation or database
21902190
* error.
21912191
*
2192-
* @param array|\Cake\ORM\ResultSet $entities Entities to save.
2192+
* @param \Cake\Datasource\EntityInterface[]|\Cake\ORM\ResultSet $entities Entities to save.
21932193
* @param array|\ArrayAccess $options Options used when calling Table::save() for each entity.
2194-
* @return bool|array|\Cake\ORM\ResultSet False on failure, entities list on success.
2194+
* @return bool|\Cake\Datasource\EntityInterface[]|\Cake\ORM\ResultSet False on failure, entities list on success.
21952195
*/
21962196
public function saveMany($entities, $options = [])
21972197
{

src/Utility/Xml.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -145,16 +145,17 @@ protected static function _loadXml($input, $options)
145145
if ($hasDisable && !$options['loadEntities']) {
146146
libxml_disable_entity_loader(true);
147147
}
148-
$flags = LIBXML_NOCDATA;
148+
$flags = 0;
149149
if (!empty($options['parseHuge'])) {
150150
$flags |= LIBXML_PARSEHUGE;
151151
}
152152
try {
153153
if ($options['return'] === 'simplexml' || $options['return'] === 'simplexmlelement') {
154+
$flags |= LIBXML_NOCDATA;
154155
$xml = new SimpleXMLElement($input, $flags);
155156
} else {
156157
$xml = new DOMDocument();
157-
$xml->loadXML($input);
158+
$xml->loadXML($input, $flags);
158159
}
159160
} catch (Exception $e) {
160161
$xml = null;

tests/TestCase/Cache/Engine/RedisEngineTest.php

-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public function setUp()
3333
{
3434
parent::setUp();
3535
$this->skipIf(!class_exists('Redis'), 'Redis extension is not installed or configured properly.');
36-
$this->skipIf(version_compare(PHP_VERSION, '7.2.0dev', '>='), 'Redis is misbehaving in PHP7.2');
3736

3837
// @codingStandardsIgnoreStart
3938
$socket = @fsockopen('127.0.0.1', 6379, $errno, $errstr, 1);

0 commit comments

Comments
 (0)