Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-3115

UnitOfWok can't access proxies protected property

    Details

    • Type: Bug Bug
    • Status: Reopened
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: Git Master
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
    • Environment:
      php5.5.11-1~dotdeb.1
      debian 7.5 64bit
      apache2
      doctrine-orm-module 0.8.0

      Description

      Running the code on different environments for a while now, I have never had any problems. Recently I installed the code onto a different server and I've been experiencing the following issue:

      > Fatal error: Cannot access protected property DoctrineORMModule\Proxy_CG_\Page\Entity\PageRevision::$date in src/vendor/doctrine/orm/lib/Doctrine/ORM/UnitOfWork.php on line 2596

      I am absolutely clueless, why this happens. It seems to be affecting only specific data rows, as you might reproduce here: http://de.serlo.org/pages

      The field is defined as followed:

          /**
           * @ORM\Column(type="datetime", options={"default"="CURRENT_TIMESTAMP"})
           */
          protected $date;
      

      However, the exact same database snapshot works fine here: http://ptr.serlo.org/pages

      Attached you will find a screenshot of the datarows. The yellow ones mark each one working and one not working row.

      I have no idea what the problem is here.

        Activity

        Hide
        Marco Pivetta added a comment -

        Discussed this on IRC - very tricky, seems like one of the servers has the reflection property not set to "accessible"

        Show
        Marco Pivetta added a comment - Discussed this on IRC - very tricky, seems like one of the servers has the reflection property not set to "accessible"
        Hide
        Machete added a comment -

        Adding `$class->reflFields[$field]->setAccessible(true)` before line 2596 resolved this issue. Even after removing it, everything worked fine.

        note to self:
        > [18:23] <@ocramius> machete_: can you find out where that particular property is instantiated?
        > [18:23] <@ocramius> should be in `ClassMetadataInfo::wakeUpReflection()` or such
        > [18:25] <@ocramius> if you find that again, consider looking at locations in the code where `new ReflectionClass()` is instantiated

        Show
        Machete added a comment - Adding `$class->reflFields [$field] ->setAccessible(true)` before line 2596 resolved this issue. Even after removing it, everything worked fine. note to self : > [18:23] <@ocramius> machete_: can you find out where that particular property is instantiated? > [18:23] <@ocramius> should be in `ClassMetadataInfo::wakeUpReflection()` or such > [18:25] <@ocramius> if you find that again, consider looking at locations in the code where `new ReflectionClass()` is instantiated

          People

          • Assignee:
            Marco Pivetta
            Reporter:
            Machete
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: