With the latest Ckeditor 4.2, WYSIWYG API reports:
"The version of CKEditor could not be detected."
at '/admin/config/content/wysiwyg'

See related:
#1853550: Ckeditor 4.0 - The version of CKEditor could not be detected.
#1151804: WYSIWYG can't detect latest CKeditor (build 3.6).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jenlampton’s picture

Status: Active » Needs review
FileSize
729 bytes

patch as recommended by #55 from the previous issue.

rocketeerbkw’s picture

Status: Needs review » Closed (duplicate)

As noted in #1853550: Ckeditor 4.0 - The version of CKEditor could not be detected. this has already been fixed in 7.x-2.x-dev. If you need to patch 7.x-2.2, at least use the patch that got committed which was #136.

luinva’s picture

Where does the patch go?

Found it.

philipjohn’s picture

I've tried #2 with both 7.x-2.2 and 7.x-2.x-dev but with no impact.

I've also had no luck with any of the patches from #1853550: Ckeditor 4.0 - The version of CKEditor could not be detected.

P.s. I'm an issues queue novice - how do I nicely link to other issues? (Thanks @rocketeerbkw)

rocketeerbkw’s picture

I tested ckeditor 4.2.1 and it works on 7.x-2.x-dev with no additional patches.

You can link to issues with just the issue number using [#12345], see the fifth bullet point below the issue message.

luinva’s picture

Solution:
editors/ckeditor.inc
line: 81

Replace:
if (preg_match('@version:\'(?:CKEditor )?([\d\.]+)(?:.+revision:\'([\d]+))?@', $line, $version)) {
With
if (preg_match('@version:[\"|\'](?:CKEditor )?([\d\.]+)(?:.+revision:[\"|\']([\d]+))?@', $line, $version)) {

simon147’s picture

I just updated to the latest version of wysiwyg module and run into this bug. It seems to be still active (all the duplacates seem to be closed) making me a bit confused.

Applying the above code fixes the problem, then however get the following error message "

Notice: Undefined offset: 2 in wysiwyg_ckeditor_version() (line 85 of /home/tedxlaus/public_html/wiki/sites/all/modules/wysiwyg/editors/ckeditor.inc).

Any idea what is wrong?

bagsmode’s picture

Issue summary: View changes

I had to perform the update to the preg_match if statement, as well as to the return statement within:

return $version[1] . '.' . (!isset($version[2]) ? '' : $version[2]);

CTGreybeard’s picture

Combining the changes from posts 6 and 8 worked for me.

CKEditor version 4.3.4.40 is the one I downloaded and installed today.

MediaFormat’s picture

+1 for #6 with CKEditor 4.4.0.98

jdeg’s picture

+1 for #6 with CKEditor 4.x

scromie’s picture

+1 for #6 with CKEditor 4.4.1

smartsystems160’s picture

+100 for #6. worked flawlessly for me with CKEditor 4.4.1.568, Wysiwyg 7.x-2.2 version

TwoD’s picture

#6 is not enough!

Don't complain about missing buttons or ineffective settings if that's the only patch you use. Many more changes have already been made to 7.x-2.x-dev to stay compatible with all changes between CKEditor 3 and 4.

ThomasRedstone’s picture

It's also not really a great regex, the revisions are hex, and there is also the possibility of someone wanting to use an older version, so really the correct hack is this:

    if (preg_match('@version:\'(?:CKEditor )?([\d\.]+)(?:.+revision:\'([\d]+))?@', $line, $version) ||
        preg_match('@version:"(?:CKEditor )?([\d\.]+)"(?:.+revision:"([\da-f]+))?@', $line, $version)) {

But has been said, using Dev is a much better option (using a stable build is only a stable choice if you use it with the libraries it's designed to be used with).

wingchuihk’s picture

download coeditor 4.4.3 with Drupal 7.3-- after install below location and it still not detached.

=======

The version of CKEditor could not be detected.

Extract the archive and copy its contents into a new folder in the following location:
sites/all/libraries/ckeditor

So the actual library can be found at:
sites/all/libraries/ckeditor/ckeditor.js

Do NOT download the "CKEditor for Drupal" edition.

hamedsbt’s picture

I installed "Wysiwyg v7.x-2.2" and latest ckeditor so had same problem and my friend fixed it for me :)

1)Open "\sites\all\libraries\ckeditor\ckeditor.js" file in a text editor.
2)Add "// version:'4.4.3',revision:'4391' " in first line (without double quotations) and save it.

enjoy!

Anonymous’s picture

wow hamedsbt. thank you!

phpcoder2015’s picture

#17 worked great with CKEditor 4.4.6 ( 2014.11.25), thanks man!

awells’s picture

Thanks to hamedsbt for #17 ... worked for me as well (changed to 4.4.7 though)

izmeez’s picture

This is not an issue with the latest wysiwyg-7.x-2.x-dev

wgallop99’s picture

#6 worked for me and I am on version 7.x-2.0-beta1 of Wysiwyg and version 4.5.6.91 of Ckeditor...am I using the wrong version of wysiwyg?

ercder’s picture

#6 worked for me with on Drupal 7.41, CKeditor 4.5.6, and Wysiwyg 7.x-2.2

TwoD’s picture

@wgallop99, @ercder. Do NOT use those patches, they only appear to work and you'll get confusing problems later. There's a reason why this was marked duplicate.

ercder’s picture

Thanks @TwoD, was in a pinch and had I spent further time on this would have read your other warnings. Thanks.

ambereyes’s picture

#17 worked for me as well with "// version:'4.5.8'

ray_at_boxtm’s picture

for #7 I would suggesting another fix, Because the revision of CKEditor used when the Wysiwyg release was 4.4.2 or so. it revision starts with digits such as '1567b48', but later release of CKEditor such as version 4.5.9 comes with different revision such as "b47abaf" which starts with alpha-bet. So I think a better solution would be add alphabet to the preg_match regex check such as change

if (preg_match('@version:[\"|\'](?:CKEditor )?([\d\.]+)(?:.+revision:[\"|\']([\d]+))?@', $line, $version)) {
to
if (preg_match('@version:[\"|\'](?:CKEditor )?([\d\.]+)(?:.+revision:[\"|\']([a-z\d]+))?@', $line, $version)) {

And also I assume the revision only contains lowercase and 0-9 digits.

at line 85 of ....sites/all/modules/wysiwyg/editors/ckeditor.inc

TwoD’s picture

As already mentioned several times both here and elsewhere, just changing the version detection string will only trick the stable version of the module into using a version of the editor it can't handle. You must expect bugs if hacking the stable version instead of using the -dev snapshot, which does handle CKEDitor 4 properly.