Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-20527

(Public API) creating/updating a new object is throwing a language exception

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: 5.0, 5.1-dev
    • Fix Version/s: QA tracked issues, 5.1
    • Labels:
      None
    • Environment:

      RHEL 6.3
      PHP 5.3.3
      Mysql 5.1.61

    • Sprint:
      Stetind Sprint 7

      Description

      Every time i try to create or update an object using public API i get the following error

      There was 1 error:
       
      1) eZPublishAPIInteger::testTC1397CreateIntegerObject
      eZ\Publish\Core\Base\Exceptions\NotFoundException: Could not find 'Language' with identifier '0'
       
      /var/www/apache2php53/ezp5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/Language/Cache.php:79
      /var/www/apache2php53/ezp5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/Language/CachingHandler.php:110
      /var/www/apache2php53/ezp5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/ObjectState/Mapper.php:120
      /var/www/apache2php53/ezp5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/ObjectState/Mapper.php:143
      /var/www/apache2php53/ezp5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Persistence/Legacy/Content/ObjectState/Handler.php:115
      /var/www/apache2php53/ezp5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/Repository/ContentService.php:627
      /var/www/apache2php53/ezp5/vendor/ezsystems/ezpublish-kernel/eZ/Publish/Core/SignalSlot/ContentService.php:237
      /var/www/apache2php53/ezp5/ezpublish_testsystem/extension/ezpublishapitests/classes/ezpublishapitesthelper.php:780
      /var/www/apache2php53/ezp5/ezpublish_testsystem/extension/ezpublishapitests/tests/ezpublishapi/ezpublishapi/datatypes/integer/ezpublishapiinteger.php:154
      /var/www/apache2php53/ezp5/ezpublish_testsystem/extension/selenium/classes/ezpselenesetest.php:724
      /var/www/apache2php53/ezp5/ezpublish_testsystem/extension/ezpublishapitests/classes/ezpublishapitest.php:116
      /var/www/apache2php53/ezp5/ezpublish_testsystem/extension/ezpublishapitests/tests/ezpublishapi/ezpublishapi/datatypes/integer/ezpublishapiinteger.php:137
      /var/www/apache2php53/ezp5/ezpublish_testsystem/extension/selenium/classes/ezpselenesetest.php:753
      /var/www/apache2php53/ezp5/ezpublish_testsystem/tests/toolkit/ezptestrunner.php:372
       
      FAILURES!
      Tests: 1, Assertions: 22, Errors: 1.
      
      

        Issue Links

          Activity

          Hide
          Joao Pingo (Inactive) added a comment -
          Show
          Joao Pingo (Inactive) added a comment - Code used on test https://gist.github.com/jpingo/bf69d704c162677c5fc1
          Hide
          Bertrand Dunogier added a comment -

          Confirmed. Something wrong with the language ID when loading object states.

          Show
          Bertrand Dunogier added a comment - Confirmed. Something wrong with the language ID when loading object states.
          Hide
          Bertrand Dunogier added a comment -

          This error would come from invalid data in ezcobj_state_group_language. real_language_id is set to 0, and this is invalid.

          See https://jira.ez.no/browse/EZP-19169. For the default language (ID 2), ezcobj_state_group_language.real_language_id should be set to 2, while language_id will be 3 (always available bit).

          I take it that your test database is somehow outdated, at least in regards to this change.

          Show
          Bertrand Dunogier added a comment - This error would come from invalid data in ezcobj_state_group_language. real_language_id is set to 0, and this is invalid. See https://jira.ez.no/browse/EZP-19169 . For the default language (ID 2), ezcobj_state_group_language.real_language_id should be set to 2, while language_id will be 3 (always available bit). I take it that your test database is somehow outdated, at least in regards to this change.
          Hide
          Bertrand Dunogier added a comment - - edited

          Note: this is the quick workaround that avoids the error:

          UPDATE ezcobj_state_group_language SET real_language_id = language_id & ~1;
          

          But the data source of course needs to be fixed.

          Show
          Bertrand Dunogier added a comment - - edited Note: this is the quick workaround that avoids the error: UPDATE ezcobj_state_group_language SET real_language_id = language_id & ~1; But the data source of course needs to be fixed.
          Hide
          Joao Pingo (Inactive) added a comment -

          @Bertrand
          I found the issue, there is a difference between the cleandata.sql schema and the db_data.dba schema (which we use for testing)
          on db_data.dba https://github.com/ezsystems/ezpublish-legacy-ee/blob/master/share/db_data.dba no value is set for the real_language_id field which by default on db_schema.dba is set to 0

          Show
          Joao Pingo (Inactive) added a comment - @Bertrand I found the issue, there is a difference between the cleandata.sql schema and the db_data.dba schema (which we use for testing) on db_data.dba https://github.com/ezsystems/ezpublish-legacy-ee/blob/master/share/db_data.dba no value is set for the real_language_id field which by default on db_schema.dba is set to 0
          Hide
          Bertrand Dunogier added a comment - - edited

          Okay, it turns out that there actually is an issue.

          The share/db_data.dba file hasn't been updated in https://github.com/ezsystems/ezpublish-legacy/commit/8823cc7b nor in https://github.com/ezsystems/ezpublish-legacy/commit/245c5cfd.

          It obviously doesn't really bother legacy, though, or this would have shown up before.

          Show
          Bertrand Dunogier added a comment - - edited Okay, it turns out that there actually is an issue. The share/db_data.dba file hasn't been updated in https://github.com/ezsystems/ezpublish-legacy/commit/8823cc7b nor in https://github.com/ezsystems/ezpublish-legacy/commit/245c5cfd . It obviously doesn't really bother legacy, though, or this would have shown up before.
          Hide
          Bertrand Dunogier added a comment - - edited

          The fix in the original issue (EZP-19169) still applies:

          MySQL

          UPDATE ezcobj_state_group_language SET real_language_id = language_id & ~1;
          

          PostgreSQL

          UPDATE ezcobj_state_group_language SET real_language_id = language_id & ~1
          

          Oracle

          UPDATE ezcobj_state_group_language SET real_language_id = language_id - bitand(language_id, 1);
          

          Show
          Bertrand Dunogier added a comment - - edited The fix in the original issue ( EZP-19169 ) still applies: MySQL UPDATE ezcobj_state_group_language SET real_language_id = language_id & ~1; PostgreSQL UPDATE ezcobj_state_group_language SET real_language_id = language_id & ~1 Oracle UPDATE ezcobj_state_group_language SET real_language_id = language_id - bitand(language_id, 1);
          Hide
          Bertrand Dunogier added a comment -
          Show
          Bertrand Dunogier added a comment - db_data.dba + SQL update files fixed in master (5.1): https://github.com/ezsystems/ezpublish-legacy/commit/47c69cd900ed1ff9e170cb5bd8c53c91407dd648 .
          Hide
          Joao Pingo (Inactive) added a comment -

          Verified on master ... all works fine

          Show
          Joao Pingo (Inactive) added a comment - Verified on master ... all works fine

            People

            • Assignee:
              Unassigned
              Reporter:
              Joao Pingo (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 30 minutes
                2h 30m

                  Agile