Skip to content

Commit

Permalink
DDC-3120 - Using ReflectionClass#newInstanceWithoutConstructor() al…
Browse files Browse the repository at this point in the history
…so with PHP 5.6+
  • Loading branch information
Ocramius committed Oct 6, 2014
1 parent 8fc1c34 commit a69584a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@ public function __sleep()
public function newInstance()
{
if ($this->_prototype === null) {
if (PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513) {
if (PHP_VERSION_ID === 50429 || PHP_VERSION_ID === 50513 || PHP_VERSION_ID >= 50600) {
$this->_prototype = $this->reflClass->newInstanceWithoutConstructor();
} else {
$this->_prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
Expand Down

9 comments on commit a69584a

@loicfavory
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to add this change to the 2.3 branch ?

@Ocramius
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope: not a security fix

@loicfavory
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I understand.
So that's a problem for Symfony 2.3 that is a LTS version. It's no more working with PHP 5.6.

@stof
Copy link
Member

@stof stof commented on a69584a Dec 9, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@loicfavory This change is in Doctrine, not in Symfony. So the Symfony 2.3 LTS has nothing to do with it.
Doctrine 2.3 is not a LTS. It is not receiving bug fixes anymore, only security patches.

@loicfavory
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof Yes, I understand. But how can I update a Symfony 2.3 project on a server running PHP5.6 ? Can I set my project to use doctrine 2.4 in composer.json without risk ?

@Ocramius
Copy link
Member Author

@Ocramius Ocramius commented on a69584a Dec 9, 2014 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@loicfavory
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Ocramius Ok, thanks. I think my production servers will stay in PHP 5.4 until I upgrade Symfony to the next LTS in february.

@stof
Copy link
Member

@stof stof commented on a69584a Dec 9, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@loicfavory Symfony 2.3 can perfectly be used with Doctrine 2.4 though

@loicfavory
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stof thanks for your answer, I'll try it on a non critical project.

Please sign in to comment.