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

updatenbxmlcontents.php replacing old versions with wrong values

    XMLWordPrintable

    Details

      Description

      EZP-26224 has a script to fix bad formed values in XML Text, namely \xc2\x92 and
       
      characters.

      When the script is executed, it duplicates the latest version to all stored versions, effectively deleting the old content.

      The problem seems to come from updatenbxmlcontents.php#L7 and a possible solution could be proceeding with the following changes, but it still needs to be tested.

      Unable to find source-code formatter for language: diff. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      - $db->query( "UPDATE ezcontentobject_attribute SET data_text='$xmlData' WHERE id='$id'" );
      + $db->query( "UPDATE ezcontentobject_attribute SET data_text='$xmlData' WHERE id='$id' and version='$version'" );
      Steps to reproduce
      1. Create a new article with the API and add the following lines to the XML Text (Edit the comment and copy the lines from the plain text version)
        <?xml version="1.0" encoding="utf-8"?>
        <section xmlns:image="http://ez.no/namespaces/ezpublish3/image/"
                 xmlns:xhtml="http://ez.no/namespaces/ezpublish3/xhtml/"
                 xmlns:custom="http://ez.no/namespaces/ezpublish3/custom/">
                 <paragraph>Antes tarde do que...&amp;nbsp;mais nunca.’</paragraph>
                 <paragraph>Há males que vêm para...&amp;nbsp;para o mal.’</paragraph>
        </section>
      2. Open the backend and create three versions. Add Edit #00x to the first line of each of the versions.
      3. Execute the script
        cd ezpublish_legacy
        php update/common/scripts/updatenbxmlcontents.php -n
      4. Clear the caches
      5. Confirm the versions were changed to the latest version

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                eduardo.fernandes-obsolete@ez.no Eduardo Fernandes (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: