After upgrading to 6.x-1.9, when editing an existing node the current body text is not displayed. CKeditor itself shows up, however the body field stays blank.

ckeditor module 6.x-1.0
CKEditor 3.6.2
Drupal 6.25
Firefox 10.0.2 (Ubuntu)

This may be related to #1190772: Fields Vanish When Editing Nodes After Upgrading to 6.x.1.4 (6.x) or #1318196: Content disappearing (7.x).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gaele’s picture

I did resave all profiles and cleared all caches.
Firebug does not show any errors.

gaele’s picture

Reverting back to 6.x-1.8 resolves the issue.

jvieille’s picture

- As 1.9 seems broken, I tried the latest dev : the text appears unformatted in the ckeditor area
- reverting to the previous dev (before 1.9) makes the area blank
- flushing the cash makes it working again

1.9 and after are definitely broken.

GoddamnNoise’s picture

Same problem here. Is there any solution to fix it or the only solution is to revert back to 1.8?

dczepierga’s picture

Status: Active » Postponed (maintainer needs more info)

Hi,
Could u try to update to last stable release?
Before was problem with loading CKEditor during AJAX call executing (Filter XSS), so then u can see blank page - it was fixed in last release and now should works fine.
Pls check that, and write does it help or not.

Greetings

jvieille’s picture

I tried the latest dev, but got a messy unformatted text

mkesicki’s picture

@jvieille,
what input filter do you use ?

jvieille’s picture

full html
But I do not get raw text, html tags are not visible

mkesicki’s picture

What filters do you use In your "Full html" input format ?

wwalc’s picture

@anyone with the same issue - any chance for a private message with a link where this issue can be reproduced? No changes will be made on the site, I need to see the configuration and the list of 3rd party modules, inspect JavaScript variables and check for JavaScript errors.

Alternatively can you check a fresh installation of Drupal and once you confirm that CKEditor works there, start enabling all other third party modules that you have enabled on your live website?

Do you all have the jQuery Update module installed?

GoddamnNoise’s picture

I think i've found what is causing this problem. In my case, the body field is blank only when the "HTML corrector" filter is checked in the CKEditor's profile configuration. If I uncheck the "HTML corrector" filter in the CKEditor's profile configuration, it works as usual and i can see the content of the body field, but when i check again the filter, then the body field is blank.

Drupal 6.23
CKEditor 6.x-1.10

wwalc’s picture

Interesting, can you investigate tit deeper? E.g whether it happens on all pages?
I just tried to enable HTML corrector and I have no problems with reediting articles.

What other filters do you have enabled in CKEditor profile?

GoddamnNoise’s picture

Yes, it always happens. When i try to edit any node, the body field is always blank. The filters i've enabled in CKEditor profile are: HTML filter and HTML corrector. But I have the same problem when only the HTML corrector filter is enabled.

wwalc’s picture

@GoddamnNoise Could you enable HTML corrector again?

Open Firebug to trace Ajax calls and edit any article
When CKEditor loads, you should see something like:
POST http://example.com/index.php?q=ckeditor/xss
can you check what's the result of the response in the "Response" tab?

If it's just a blank page, can you check the error logs / dblog / any other place where PHP errors are logged?

jvieille’s picture

I got the blank area too when reverting back to a previous versions.
A made a full cleaning of all caches (Boost, Advagg...) several times before I could again work with CKeditor.

My messy area might have been due to something like that too. I'll make some more trials when I'll have time.

GoddamnNoise’s picture

Hi, @wwalc,

I've enabled the HTML corrector again, and I've traced the Ajax calls with Firefox's Firebug:

The "Response" tab for "POST http://example.com/index.php?q=ckeditor/xss" is blank. I've checked the dblog looking for PHP errors, but there is no PHP errors in the log. No errors in the Apache logs.

The problem happens with Firefox and with Chromium 17.0.963.79 for Ubuntu 10.04 too.

mkesicki’s picture

@GoddamnNoise,
please check in Firebug 'POST' tab of 'http://example.com/index.php?q=ckeditor/xss'reuqest if there goes any data.
Does 'text' and 'token' values are sent via POST request ?
Can you attach some text with you have problems ? Of course if is not 'secret'.

GoddamnNoise’s picture

I've checked it. Yes, there is data in the "Post" tab. Both, the "text" and "token" values are sent via POST request.

I can't attach the actual text, but it's happening with every node, so it must happens with any text. So, to confirm that, I've createad a new node with this values:

"Title" Field: "CKEditor Test"
"Body" Field: "CKEditor Test"

I've saved the node, and I've tried to edit the node. Then, I see a blank body field. In the "Post" tab of the Firebug console for the 'http://example.com/index.php?q=ckeditor/xss' POST request, i see the "text" and token values. The "text" value is: "<p>CKEditor Test</p>"

GoddamnNoise’s picture

Hi again,

I've been testing the code a few times to gather some information which could help. This is what I think it is happening:

  1. If I uncheck the "HTML Corrector" filter in the CKEditor profile, then it works ok. In this case, the function ckeditor_user_get_profile() is called once. This function looks for the CKEditor profile and it returns that profile.
  2. If I check the "HTML Corrector" filter in the CKEditor profile, then it doesn't work (body field is blank). In this case, the function ckeditor_user_get_profile() is called twice. The first time, this function looks for the CKEditor profile and it returns that profile. But the second time, this function is called from the ckeditor_filter_xss() function, so it looks for the CKEditor profile but it returns FALSE because the $element_id variable is empty and the $_GET['q'] environment variable has the value 'ckeditor/xss'
  3. .

I think that is the problem happening here. Any ideas about how to fix it?.

dczepierga’s picture

@GoddamnNoise, thx for review, but i need one more information:
When ckeditor_user_get_profile() is called twice, do u know from where this function is called first time?

$element_id in this place is not needed, it's only use global variable $user - could u check what get there on first and second call?

Greetings

GoddamnNoise’s picture

Hi,

The first call to the ckeditor_user_get_profile() function is from the ckeditor.module file, ckeditor_process_textarea function, line 502.

The $user received in ckeditor_user_get_profile() is correct in both cases (i've checked $user->uid and it is the same in both cases).

I had never checked the CKEditor's code before, but I think the problem is located here. I think the problem arises because the ckeditor_user_get_profile() function is called from the ckeditor_filter_xss() function.

I've reviewed CKEditor's code in previous versions and in those versions, the ckeditor_user_get_profile() function is not called from the ckeditor_filter_xss() function. Instead, when the ckeditor_filter_xss() function is called, it receives a $POST['filters'] with the filters to apply.

But, in the new CKEditor version, $POST['filters'] doesn't exist and the function ckeditor_user_get_profile() is called from the ckeditor_filter_xss() function to get that information (this is the second call to that function). In the new CKEditor version, when the ckeditor_user_get_profile() function tries to get that information, it calls the ckeditor_is_enabled() function, which, in this second call, always returns FALSE, so the ckeditor_user_get_profile() function returns FALSE too and doesn't return the CKEditor's user profile as expected.

The function ckeditor_is_enabled() returns FALSE because it receives NULL in the $element_id variable and it receives 'ckeditor/xss' as $GET['q'], so it can't get the node type calling the ckeditor_get_nodetype() function.

jvieille’s picture

In my case, my full htpl filter uses the following:

  • HTML corrector
  • Line break converter
  • URL filter
mkesicki’s picture

I can't reproduce this issue. I tried use all mentioned filters with different order (rearrange) and still nothing.
Can you write what settings do you have in "Fields to exclude/include" settings ?
It is possibly to get access to some test site where this issue exists (as mentioned #10)

GoddamnNoise’s picture

Hi,

One question, when you try to reproduce this issue, are you logged in with uid=1 (super admin)?. The issue won't arise if you are logged in as uid=1. To reproduce the issue you must create a CKEditor user profile, activate the "HTML Corrector" filter for that profile and try it logged in with a user who has that CKEditor user profile.

In my case these are the fields i have in "Fields to exclude/include" (I have checked the "include" option):

blog@node/add/blog.edit-body
page@node/add/page.edit-body
blog@node/*/edit.edit-body
page@node/*/edit.edit-body
admin/build/block/configure/block/1.edit-body

Sorry, but I can't give you access to a site where this issue exists.

neurer’s picture

Have two setups with the same issue. Disabling "HTML filter" and "HTML corrector" at CKEditor profile/Security does seem to fix it for me. Input formats remain unchanged.

Joran Lafleuriel’s picture

had the same problem on drupal 6.24 since last ckeditor update 6.x-1.10
#25 suggestion fixed it for me
thanks !

dczepierga’s picture

@GoddamnNoise, really thx for your help. I found where is problem and fix it. Now our team test it - after this i would attach patch here and commit it to GIT.
When it would be ready i will write about it here, so pls be patient.

Greetings

GoddamnNoise’s picture

Thank you very much, dczepierga. Thanks to michal_cksource and wwalc too for all your help.

dczepierga’s picture

Status: Postponed (maintainer needs more info) » Needs review
FileSize
5.71 KB

@GoddamnNoise, thank you for your help to reproduce this too... Nice job!

I've attach patch for this issue. It should help. Please review it and write does it help or not.

Greetings

GoddamnNoise’s picture

Hi, @dczepierga,

I've tried to apply the patch with no success. I've downloaded the CKEditor 6.x-1.10 version, I've uncompressed it, and then, i've copied the patch file to the ckeditor root folder. Then,I've tried to apply the patch, but there were errors:

patch -p0  < 0001-1482874-by-dczepierga-body-field-is-blank.patch 
patching file b/ckeditor.module
Hunk #1 FAILED at 611.
Hunk #2 FAILED at 1290.
2 out of 2 hunks FAILED -- saving rejects to file b/ckeditor.module.rej
patching file b/includes/ckeditor.lib.inc
Hunk #1 FAILED at 491.
Hunk #2 FAILED at 525.
2 out of 2 hunks FAILED -- saving rejects to file b/includes/ckeditor.lib.inc.rej
patching file b/includes/ckeditor.page.inc
Hunk #1 FAILED at 174.
1 out of 1 hunk FAILED -- saving rejects to file b/includes/ckeditor.page.inc.rej
patching file b/includes/ckeditor.popup.html
Hunk #1 FAILED at 92.
1 out of 1 hunk FAILED -- saving rejects to file b/includes/ckeditor.popup.html.rej
patching file b/includes/ckeditor.utils.js
Hunk #1 FAILED at 130.
1 out of 1 hunk FAILED -- saving rejects to file b/includes/ckeditor.utils.js.rej

I think the errors appear because in the patch file there are references to 'a' and 'b' folders which you have probably created to make the patch but which don't exist in the CKEditor 6.x-1.10 version.

dczepierga’s picture

@GoddamnNoise, try to apply patch to last DEV version... we never make patches to stable releases, we work only on DEV version.
When u want to apply patch, first of all u must checkout repository from GIT and switch to 6.x-1.x branch. After this patch should apply without any problem.

GIT when making patch always use 'a' and 'b' folders to mark paths as alias to the source and destination files.

Greetings

GoddamnNoise’s picture

Hi again, @dczepierga,

Ok, i've done a checkout from the 6.x-1.x branch of the GIT repository and I've patched it using GIT. I've tested the patched version and it seems to work ok for me when the 6.x-1.9 and 6.x-1.10 versions fail (using a CKEditor's user profile with the "HTML Corrector" filter enabled as explained in previous comments).

Nice job!. Thanks a lot.

Is it planned to release a new CKEditor version soon or we better apply the patch to the 6.x-1.10 version?

Greetings.

dczepierga’s picture

Status: Needs review » Fixed

Ok, so i commit this patch to GIT (diff)

Really thx for help and review.

CKEditor module will be release asap, if u want u can move patch to stable release, and u will get it after next stable release.

Greetings

GoddamnNoise’s picture

Hi @dczepierga,

I'm not sure about how to move patch to stable release without breaking anything. I'll try to patch the 6.x-1.10 version to use it while the new Ckeditor patched version is not released.

Thanks a lot again, and thanks again to all the CKEditor module team. Nice Job.

Greetings

boazr’s picture

Status: Fixed » Active

Same here:
6.x-1.10 - only when removing all security filters ckeditor shows any text. With any of them checked - the text disappears as soon as the wysiwyg is rendered (switching to plain text or viewing html source does not keep the text).

mkesicki’s picture

Status: Active » Postponed (maintainer needs more info)

@boazr
did you use latest DEV version or use patch attached at #29 ?

dczepierga’s picture

Status: Postponed (maintainer needs more info) » Fixed

@boazr, look to this thread #1497184: Style changes lost after saving - it's probably this same problem which u have, pls review patch in this related issue and write there does it help or not.

I closed this issue, because reported bug is fixed.

Greetings

dczepierga’s picture

Title: body field is blank » [D6] body field is blank
mkesicki’s picture

Status: Fixed » Closed (fixed)
gorod1277’s picture

Got the same issue with blank text field under editing with 6.x-1.11, D6. Removing sec filters resolve the issue, but that is not a solution, right?