Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a303fba

Browse filesBrowse files
nicolas-grekasfabpot
authored andcommitted
bug #60094 [DoctrineBridge] Fix support for entities that leverage native lazy objects (nicolas-grekas)
This PR was merged into the 6.4 branch. Discussion ---------- [DoctrineBridge] Fix support for entities that leverage native lazy objects | Q | A | ------------- | --- | Branch? | 6.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT Commits ------- 382b3dd [DoctrineBridge] Fix support for entities that leverage native lazy objects
2 parents 9645b9e + 382b3dd commit a303fba
Copy full SHA for a303fba

File tree

Expand file treeCollapse file tree

4 files changed

+15
-3
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+15
-3
lines changed

‎src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ public function refreshUser(UserInterface $user): UserInterface
100100

101101
if ($refreshedUser instanceof Proxy && !$refreshedUser->__isInitialized()) {
102102
$refreshedUser->__load();
103+
} elseif (\PHP_VERSION_ID >= 80400 && ($r = new \ReflectionClass($refreshedUser))->isUninitializedLazyObject($refreshedUser)) {
104+
$r->initializeLazyObject($refreshedUser);
103105
}
104106

105107
return $refreshedUser;

‎src/Symfony/Bridge/Doctrine/Tests/DoctrineTestHelper.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/DoctrineTestHelper.php
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ public static function createTestEntityManager(?Configuration $config = null): E
4747
$config ??= self::createTestConfiguration();
4848
$eventManager = new EventManager();
4949

50+
if (\PHP_VERSION_ID >= 80400 && method_exists($config, 'enableNativeLazyObjects')) {
51+
$config->enableNativeLazyObjects(true);
52+
}
53+
5054
return new EntityManager(DriverManager::getConnection($params, $config, $eventManager), $config, $eventManager);
5155
}
5256

‎src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
+8-2Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Doctrine\Tests\Security\User;
1313

14+
use Doctrine\ORM\Configuration;
1415
use Doctrine\ORM\EntityManager;
1516
use Doctrine\ORM\EntityRepository;
1617
use Doctrine\ORM\Tools\SchemaTool;
@@ -219,8 +220,13 @@ public function testRefreshedUserProxyIsLoaded()
219220
$provider = new EntityUserProvider($this->getManager($em), User::class);
220221
$refreshedUser = $provider->refreshUser($user);
221222

222-
$this->assertInstanceOf(Proxy::class, $refreshedUser);
223-
$this->assertTrue($refreshedUser->__isInitialized());
223+
if (\PHP_VERSION_ID >= 80400 && method_exists(Configuration::class, 'enableNativeLazyObjects')) {
224+
$this->assertFalse((new \ReflectionClass(User::class))->isUninitializedLazyObject($refreshedUser));
225+
$this->assertSame('user1', $refreshedUser->name);
226+
} else {
227+
$this->assertInstanceOf(Proxy::class, $refreshedUser);
228+
$this->assertTrue($refreshedUser->__isInitialized());
229+
}
224230
}
225231

226232
private function getManager($em, $name = null)

‎src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mailer/Transport/Smtp/Stream/AbstractStream.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public function readLine(): string
8787
throw new TransportException(sprintf('Connection to "%s" has been closed unexpectedly.', $this->getReadConnectionDescription()));
8888
}
8989
if (false === $line) {
90-
throw new TransportException(sprintf('Unable to read from connection to "%s": ', $this->getReadConnectionDescription()).error_get_last()['message']);
90+
throw new TransportException(sprintf('Unable to read from connection to "%s": ', $this->getReadConnectionDescription().error_get_last()['message'] ?? ''));
9191
}
9292
}
9393

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.