Skip to content

Commit

Permalink
Merge branch '3.4' into 4.3
Browse files Browse the repository at this point in the history
* 3.4:
  use utf8mb4_bin to align code with documentation
  [VarDumper] ignore failing __debugInfo()
  • Loading branch information
nicolas-grekas committed Dec 18, 2019
2 parents 2b0f9d6 + e85acdd commit 026d57e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Expand Up @@ -218,7 +218,7 @@ public function createTable()
// - trailing space removal
// - case-insensitivity
// - language processing like é == e
$sql = "CREATE TABLE $this->table ($this->idCol VARBINARY(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED NOT NULL, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8_bin, ENGINE = InnoDB";
$sql = "CREATE TABLE $this->table ($this->idCol VARBINARY(128) NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER UNSIGNED NOT NULL, $this->timeCol INTEGER UNSIGNED NOT NULL) COLLATE utf8mb4_bin, ENGINE = InnoDB";
break;
case 'sqlite':
$sql = "CREATE TABLE $this->table ($this->idCol TEXT NOT NULL PRIMARY KEY, $this->dataCol BLOB NOT NULL, $this->lifetimeCol INTEGER NOT NULL, $this->timeCol INTEGER NOT NULL)";
Expand Down
11 changes: 10 additions & 1 deletion src/Symfony/Component/VarDumper/Caster/Caster.php
Expand Up @@ -48,6 +48,15 @@ class Caster
*/
public static function castObject($obj, $class, $hasDebugInfo = false)
{
if ($hasDebugInfo) {
try {
$debugInfo = $obj->__debugInfo();
} catch (\Exception $e) {
// ignore failing __debugInfo()
$hasDebugInfo = false;
}
}

$a = $obj instanceof \Closure ? [] : (array) $obj;

if ($obj instanceof \__PHP_Incomplete_Class) {
Expand Down Expand Up @@ -83,7 +92,7 @@ public static function castObject($obj, $class, $hasDebugInfo = false)
}
}

if ($hasDebugInfo && \is_array($debugInfo = $obj->__debugInfo())) {
if ($hasDebugInfo && \is_array($debugInfo)) {
foreach ($debugInfo as $k => $v) {
if (!isset($k[0]) || "\0" !== $k[0]) {
$k = self::PREFIX_VIRTUAL.$k;
Expand Down

0 comments on commit 026d57e

Please sign in to comment.