jeudi 21 janvier 2016

PHP v5.3 and CKEditor issue - broken tags

I am using CKEditor with SQLite database file on my local testserver with PHP v5.2 and everything works just flowlessly and fine.

But when I upload that on public webserver where PHP v5.3 is installed I got this very strange behavior and I do not know where is the problem: for some strange reason this source string which comes from SQLite db:

<div>
    <strong>
        <span style=\"font-size:36px\"><span style=\"color:rgb(0, 0, 0)\">Kult&uacute;ra v obci na </span>
        <span style=\"background-color:#FF0000\">&uacute;rovni</span></span>
    </strong>
</div>

...becomes this upon sending/saving it to SQLite db file (tho at this stage it is still as it should be inside the db file - I checked that re-saved db file on server) and re-reading the edited db file the content becomes broken once inside webpage like this (checked and copied by Firebug Firefox extension):

<div>
    <strong>
        <span style="\"font-size:36px\"">
            <span 0)\"="" 0,="" style="\"color:rgb(0,">Kultúra v obci na </span>
            <span style="\"background-color:#FF0000\"">úrovni</span>
        </span>
    </strong>
</div>

As you can see something in PHP v5.3 (or at least I think it is the PHP version as that is the only real difference between my local testserver and public webpage server) broke tags containing commas inside their attribute values and also it sets some additional " to places where \" already is - why? Which parameter needs to be set in PHP v5.3 so it behaves as it should (that is as my localserver PHP v5.2)?

To summarize how it goes from OK to broken code step-by-step (if it helps somebody):

  1. 1st page load with displayed string: OK
  2. Starting CKEditor with this loaded string: OK
  3. Checking source code inside CKEditor with this string loaded: OK
  4. Sending this string from CKeditor: OK
  5. Saving this string back to SQLite DB file: OK
  6. 2nd Re-reading/displaying this string after saving: BROKEN

BUT the even stranger fact is that is absolutely the same string that is read the first time webpage loads (remember I did not change anything - I just re-save it to SQLite db file!) and that first initial time it is read OK although those tags are the same as second time, that is containing commas in their tags attribute values...and that second time it becomes broken.

Does anyone know solution to this? I did try searching web - no success, StackOverflow - no success...

Aucun commentaire:

Enregistrer un commentaire