Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: symfony/var-dumper
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.3.0
Choose a base ref
...
head repository: symfony/var-dumper
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.3.1
Choose a head ref
  • 5 commits
  • 6 files changed
  • 4 contributors

Commits on May 31, 2023

  1. [VarDumper] Use documentElement instead of body for JS flag

    Using `document.documentElement` allows to use the dumper
    outside of a `<html><body>...</body></html>` scenario.
    
    Fixes: #50487
    ohader committed May 31, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    ssbarnea Sorin Sbarnea
    Copy the full SHA
    36579a1 View commit details

Commits on Jun 1, 2023

  1. Verified

    This commit was signed with the committer’s verified signature.
    ssbarnea Sorin Sbarnea
    Copy the full SHA
    90caf9f View commit details

Commits on Jun 20, 2023

  1. Copy the full SHA
    82269f7 View commit details
  2. Merge branch '5.4' into 6.2

    * 5.4:
      [VarDumper] Dumping DateTime throws error if getTimezone is false
      Only update autoload_runtime.php when it changed
      [Intl] Update the ICU data to 73.2
      [HttpClient] Force int conversion for floated multiplier for GenericRetryStrategy
      [Validator][Translator] Fix xlf files for en & fr translations. Bug introduced by #50590
      Add missing EN and FR translations for newest constraints
    nicolas-grekas committed Jun 20, 2023
    Copy the full SHA
    facbf30 View commit details

Commits on Jun 21, 2023

  1. Merge branch '6.2' into 6.3

    * 6.2:
      [Validator] Add missing validator translations in Polish language
      [HttpClient] Fix encoding some characters in query strings
      [SecurityBundle] Remove last usages of tag `security.remember_me_aware`
      [VarDumper] Dumping DateTime throws error if getTimezone is false
      Only update autoload_runtime.php when it changed
      [Intl] Update the ICU data to 73.2
      [HttpClient] Force int conversion for floated multiplier for GenericRetryStrategy
      [FrameworkBundle] Ignore missing directories in about command
      Revert "[Messenger] Respect `isRetryable` decision of the retry strategy when deciding if failed message should be re-delivered"
      [Validator][Translator] Fix xlf files for en & fr translations. Bug introduced by #50590
      Add missing EN and FR translations for newest constraints
    nicolas-grekas committed Jun 21, 2023
    Copy the full SHA
    c81268d View commit details
2 changes: 1 addition & 1 deletion Caster/DateCaster.php
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@ class DateCaster
public static function castDateTime(\DateTimeInterface $d, array $a, Stub $stub, bool $isNested, int $filter)
{
$prefix = Caster::PREFIX_VIRTUAL;
$location = $d->getTimezone()->getLocation();
$location = $d->getTimezone() ? $d->getTimezone()->getLocation() : null;
$fromNow = (new \DateTimeImmutable())->diff($d);

$title = $d->format('l, F j, Y')
4 changes: 1 addition & 3 deletions Dumper/HtmlDumper.php
Original file line number Diff line number Diff line change
@@ -163,9 +163,7 @@ protected function getDumpHeader()
<script>
Sfdump = window.Sfdump || (function (doc) {
if (doc.body instanceof HTMLElement) {
doc.body.classList.add('sf-js-enabled');
}
doc.documentElement.classList.add('sf-js-enabled');
var rxEsc = /([.*+?^${}()|\[\]\/\\])/g,
idRx = /\bsf-dump-\d+-ref[012]\w+\b/,
54 changes: 54 additions & 0 deletions Tests/Caster/DateCasterTest.php
Original file line number Diff line number Diff line change
@@ -106,6 +106,52 @@ public static function provideDateTimes()
];
}

/**
* @dataProvider provideNoTimezoneDateTimes
*/
public function testCastDateTimeNoTimezone($time, $xDate, $xInfos)
{
$stub = new Stub();
$date = new NoTimezoneDate($time);
$cast = DateCaster::castDateTime($date, Caster::castObject($date, \DateTime::class), $stub, false, 0);

$xDump = <<<EODUMP
array:1 [
"\\x00~\\x00date" => $xDate
]
EODUMP;

$this->assertDumpEquals($xDump, $cast);

$xDump = <<<EODUMP
Symfony\Component\VarDumper\Caster\ConstStub {
+type: 1
+class: "$xDate"
+value: "%A$xInfos%A"
+cut: 0
+handle: 0
+refCount: 0
+position: 0
+attr: []
}
EODUMP;

$this->assertDumpMatchesFormat($xDump, $cast["\0~\0date"]);
}

public static function provideNoTimezoneDateTimes()
{
return [
['2017-04-30 00:00:00.000000', '2017-04-30 00:00:00.0 +00:00', 'Sunday, April 30, 2017'],
['2017-04-30 00:00:00.100000', '2017-04-30 00:00:00.100 +00:00', 'Sunday, April 30, 2017'],
['2017-04-30 00:00:00.120000', '2017-04-30 00:00:00.120 +00:00', 'Sunday, April 30, 2017'],
['2017-04-30 00:00:00.123000', '2017-04-30 00:00:00.123 +00:00', 'Sunday, April 30, 2017'],
['2017-04-30 00:00:00.123400', '2017-04-30 00:00:00.123400 +00:00', 'Sunday, April 30, 2017'],
['2017-04-30 00:00:00.123450', '2017-04-30 00:00:00.123450 +00:00', 'Sunday, April 30, 2017'],
['2017-04-30 00:00:00.123456', '2017-04-30 00:00:00.123456 +00:00', 'Sunday, April 30, 2017'],
];
}

public function testCastDateTimeWithAdditionalChildProperty()
{
$stub = new Stub();
@@ -423,3 +469,11 @@ private function createInterval($intervalSpec, $ms, $invert)
return $interval;
}
}

class NoTimezoneDate extends \DateTime
{
public function getTimezone(): \DateTimeZone|false
{
return false;
}
}
16 changes: 16 additions & 0 deletions Tests/Dumper/functions/dd_with_named_args.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
Test dd() with named args show label
--FILE--
<?php
putenv('NO_COLOR=1');

$vendor = __DIR__;
while (!file_exists($vendor.'/vendor')) {
$vendor = \dirname($vendor);
}
require $vendor.'/vendor/autoload.php';

dd(label2: "dd() with label");

--EXPECT--
label2 "dd() with label"
17 changes: 17 additions & 0 deletions Tests/Dumper/functions/dump_with_named_args.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--TEST--
Test dd() with named args show label
--FILE--
<?php
putenv('NO_COLOR=1');

$vendor = __DIR__;
while (!file_exists($vendor.'/vendor')) {
$vendor = \dirname($vendor);
}
require $vendor.'/vendor/autoload.php';

dump("first dump", label1: "dump() with label");

--EXPECT--
1 "first dump"
label1 "dump() with label"
16 changes: 16 additions & 0 deletions Tests/Dumper/functions/dump_without_args.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--TEST--
Test dd() without args displays debug hint
--FILE--
<?php
putenv('NO_COLOR=1');

$vendor = __DIR__;
while (!file_exists($vendor.'/vendor')) {
$vendor = \dirname($vendor);
}
require $vendor.'/vendor/autoload.php';

dump();

--EXPECT--
🐛