I have installed Drupal 7 using the Acquia stack and have also installed the WYSIWYG module.

When I enter the WYSIWYG configuration I click the link to the CKEditor website, download the module and install in the following location as instructed on the WYSIWYG config page:

sites/all/libraries/ckeditor

Now when I refresh the page I get the message "The version of CKEditor could not be detected." Has anyone experienced this on Drupal 7 and know what needs fixing?

Thanks

Comments

DSG’s picture

Fixed by installing previous version 3.5.3

doomdahdoomdoom’s picture

Same error... guess I'll try your fix. Seems like there should be a better way though.

azupan’s picture

In .../modules/wysiwyg/editors/ckeditor.inc change line 68 from

while ($max_lines && $line = fgets($library, 140)) {

to

while ($max_lines && $line = fgets($library)) {

ike185’s picture

Thanks azupan, this did the trick for me! :-)

DanteMM’s picture

Great patch -thanks!

manmanee’s picture

Thank you , work me too.

kateva61’s picture

Thanks for the patch, worked like a charm.

Tim85021’s picture

I have tried everything, I have tried with 3.6 and the patch with no effect, I have used 3.5.3 with no effect, I even tried using the patch proved above to no effect, I just cannot seem to get an editor library working with wysiwyg

emkamau’s picture

I had the same problem and I could not apply the patch because I had no editors folder in the wysiwyg folder. I installed the 7.x-2.x-dev wysiwyg and all seems to be working now.

emk

Amazon’s picture

This worked for me as well. Please consider filing an issue for the WYSIWYG module with a patch.

I'm using WYSIWYG 7.x-2.0 and CKEDITOR 7.x-1.x-dev.

Cheers,
Kieran

Kieran Lal

darora’s picture

Above solution by azupan worked for me too....I was using WYSIWIG 6.x-2.3.....thanks

shivnibble’s picture

solution worked for me also - this added to the module yet? If not, should be.

danishtraveler’s picture

this thing worked for me.. http://www.laan-info.dk/

TwoD’s picture

Please, do NOT use both wysiwyg.module and ckeditor.module, it is unsupported and will cause conflicts. All you need is either wysiwyg.module or ckeditor.module, and of course the CKEdtitor library.

And no, this patch won't get into the module. If the second argument to fgets says 140, you are using an old version of Wysiwyg module. It should say 500.

somewhere2go’s picture

Thanks for the patch, worked like a charm.

Liaz’s picture

Thanks a lot azupan for this easy simple and working solution ;)
++
Wysiwyg 7.x-2.0
CKEditor 3.6

Ankabout’s picture

Worked for me too, thanks.

No new version to fix this yet?

Vc Developer’s picture

Thanks! :)

extensive’s picture

That work for me! in Drupal 7

Garry Egan’s picture

AZUPAN!!

FOR THE WIN BROTHER.

Nice patch.

TwoD’s picture

FYI,
This issue was fixed long ago in the latest Wysiwyg releases. (It may arise again if CKEditor drastically modifies its files, but then we probably need a different fix.)
I would not recommend to completely remove the last argument in the function call since that means the entire CKEditor file is read into the server's memory, on every page load where the editor should appear. That's just a waste of memory. Increase it a bit instead until the error goes away. Then it'll just read the beginnings of each line until it finds CKEditor's version number.
(The line holding the version string in the minified variant of CKEditor holds the entire script!)

theMusician’s picture

The edit to the WYSIWYG module ckeditor.inc file works with D6.22 and CKeditor 3.6.1 as well.

doka’s picture

I've submitted a patch against the wysiwyg module (7.x-2.x-dev) here: http://drupal.org/node/1283274, as proposed by azupan

Doka

david@thrale.com’s picture

Azupan's workaround worked for me in Wysiwg 7.x-2.0 with Drupal 7.12 and the very latest CKeditor

cinetik’s picture

I haven't been through all the threads. Just as a reminder (just because I tend to do the same mistake all over again) :

  • Install WYSIWYG in sites/all/modules : http://drupal.org/project/wysiwyg
  • DO NOT Install Ckeditor module, as reminded above
  • Install Ckeditor library in sites/all/modules : http://ckeditor.com/download (see the first download proposition under "Fully functional, open source editor, with source code included"

This in case you're using WYSIWYG Module. Otherwise, just use the Ckeditor Module alone.

Maedi’s picture

Don't you just wish you could "Like" posts :)

oluabbeys’s picture

Thanks

sakseiw’s picture

In .../modules/wysiwyg/editors/ckeditor.inc change line from function wysiwyg_ckeditor_version($editor)

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

to

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

This changes version number search from single quotes version: '4.0' to double quotes version "4.0"

It worked for me on Drupal 7.17 and wysiwyg 7.x-2.2

Don Greco’s picture

This worked for me
wysiwyg-7.x-2.2 and CKeditor 4.0 full
Thanks again

dtateii’s picture

This fixed it for me too, thanks! (Drupal 7.17, wysiwgy 7.x-2.2, ckeditor 4.0)

richardhare’s picture

This worked for me on Drupal 6.26 CKEditor 4.0 Full

gotomoon’s picture

I'm sure this had saved me from hours of agony. Thanks!

twal’s picture

it works great. Thanks !

rsvelko’s picture

worked good on recent drupal 7 with ckeditor 2-dev

alexPalumbo’s picture

For me i needed to fix the revision matching as it seems to be alphanumeric now

// version:"4.0.1",revision:"d02739be4b"
(preg_match('@version:\"(?:CKEditor )?([\d\.]+)(?:.+revision:\"([\da-z]+))?@', $line, $version))

Alex

jpvivere’s picture

This fix worked for me having just downloaded the latest version of CKEditor as per the WYSIWYG instructions.

Anonymous’s picture

Also worked for me. @ line 81 :-D

darri’s picture

Thanks for this Alex. Your matching code works for me, having just downloaded current version (May 2013) of WYSIWYG module and the CKEditor.

kdmarks’s picture

Using wysiwyg 7.x-2.2 and ckeditor 4.1.1

mapruter’s picture

This worked! Thanks!

cliff98109’s picture

Thanks! Just started using Drupal and didn't realize I'd be modifying code so fast...

jimbobwe’s picture

alexPalumbo's augmented fix here, which was intended to accommodate CKEditor 4.01 is still working like a charm for version 4.3.0 almost one year later! Way to go Alex! Thanks!

rwscid’s picture

Drupal 7.26
WYSIWYG 7.x-2.2
CKEditor 4.3.3.7841b02

Thanks Alex!!!

rcold’s picture

Very thanks!!!

cliffskier’s picture

This worked for me, and I can at least use CKEditor now. But I am getting another error message in Administration>Configuration>Content Authoring:

Notice: Undefined offset: 2 in wysiwyg_ckeditor_version() (line 85 of /home/content/c/l/i/cliffskier/html/phpapps/drupal/sites/all/modules/wysiwyg/editors/ckeditor.inc).

Ninjababe’s picture

Hi there, I got the same error message were you able to find the solution?

Notice: Undefined offset: 2 in wysiwyg_ckeditor_version() (line 85 of /homepages/8/d479514218/htdocs/drupal-7.22/sites/all/modules/wysiwyg/editors/ckeditor.inc).

ashlinry’s picture

I too received an error

Notice: Undefined offset: 2 in wysiwyg_ckeditor_version() (line 85 of /homepages/27/d480673492/htdocs/modules/wysiwyg/editors/ckeditor.inc).

Has anyone found a fix for this error / why is this happening?
Thanks for the fix though!

Chennard’s picture

I removed the error by changing the line:

return $version[1] . '.' . $version[2];

to:

return $version[1] ;

jimbobwe’s picture

...you likely haven't pasted the code in correctly. I had the same issue until I finally just hand-typed the updated portion of the code snippet into the ckeditor.inc file instead of pasting over the entire expression. Idunno, but once I did that it worked. Just a thought...

kubilayrd’s picture

Thanks, worked for me, too.

k0nqu3r0r’s picture

Thanks! Really helps with 4+ versions

aniaorome’s picture

Worked for me too!!
wysiwyg 7.x-2.2 and ckeditor4.0.1

pjmcghee’s picture

this worked for me! thanks for this.

pseudothrax’s picture

I'm using WYSIWYG 7.x-2.2 with CKeditor v 4.1.1 and was running into the same error. This patch worked for me, so thanks sakseiw!

tstermitz’s picture

This change to ckeditor.inc worked for me, but...

WYSIWYG then threw a PDO Exception error on Table not found. I had to uninstall and reenable which made CKEditor work.

Tom Stermitz, Denver Colorado

codepress’s picture

Thanks

It worked for me as well.

lightjuice’s picture

this is great fix that solved the issue. drupal 7.22 with ckeditor 4.1.1.5 now working fine.

kanenas’s picture

Thanks! It works.

dehcar’s picture

sakseiw it worked
WYSIWYG 7.x-2.2
CKEeditor 4.2
Drupal 7.22

mattwmc’s picture

nice! fixed it for me, as well. Thanks.

maazzarif’s picture

Thanks a lot. It also worked for me on drupal 7.24.26 wysiwyg module 7.x-2.2 . I installed ckeditor version 4.3.1. Additionally I also installed ckeditor module version no. 7. x-1.13. Thanks a lot again

mihello’s picture

It works!
this worked for me, Drupal_7.24 + CKEditor_4.3.1_standard

neo_iwokx’s picture

This fixed for me too. Thanks!

wimper’s picture

Tnx!

This worked for me too with :

Core 7.27 - Wysiwyg 7.x-2.2 - CKeditor 4.3.4

Anonymous’s picture

It's now October 2014, I got the error posted over THREE YEARS AGO by the OP and your fix worked for me. Thanks.

Drupal 7.32
WYSIWYG 7.x 2.2
CKEditor 4.4.5

fabul’s picture

I have had the same issue, and corrected it with the same solution as sakseiw.

The function preg_match in Wysiwyg module, line 82 soesn't use the right quotes. ' is used instead of ". You should replace one by the other. That's all.

vvarthan7’s picture

Works like a charm.

WorldFallz’s picture

maybe so, but it's the WRONG answer: https://www.drupal.org/node/1161738#comment-9350229

inwebsolutions’s picture

Thank you! Saved from hours of routine checks.

batigolix’s picture

_redfog’s picture

That's rocks ! Thank you DSG !

morfie78’s picture

In case you get a warning at the top saying that index 2 of $version doesn't exist, change the return of function wysiwyg_ckeditor_version($editor) to:

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

jack-pl’s picture

Instead of changing match code in ckeditor.inc file, you can just help to find what the file is looking for, which is quite easy to do:

Open file ckeditor.js library ( sites/all/libraries/ckeditor/ckeditor.js )
At the very top of this file you will see the comment lines, such as:

/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
*/

Just add to this comment a new line with details about version, so the comment will be:

/*
Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
For licensing, see LICENSE.html or http://ckeditor.com/license
  version:'CKEditor 4.0 SVN',revision:'769d96134b'
*/

Version and revision details you will find somewhere at the beginning of js code, right beneath the comment, something like this:

var b={timestamp:"CAPD",version:"4.0",revision:"769d96134b"...

* do not change anything in the code.

That's it. Just reload the wysiwyg profile page ( admin/settings/wysiwyg/profile )

rodpal’s picture

Thanks!

millionleaves’s picture

Thanks jack-pl - that solution worked for me.

I provide Drupal, Drupal Commerce and CiviCRM development services for customers in New Zealand and beyond

danielbehina’s picture

Perfect fix, thank you. Works like a charm.

nickrud’s picture

I hate with a passion solutions that alter drupal. Thanks.

jackthewelshman’s picture

Thank you, solved the issue for me too. Thanks for the advice.

fotfotfot2000’s picture

merci!
TY

Mathieu Slaedts’s picture

I don't understand wat's behind this, but it works. Thanks for sharing !

cozzi’s picture

Great catch but oh what a terrible thing to have to do.

shomari’s picture

This worked perfectly!

Jacoke’s picture

Big ups and Kudos Jack. Like a charm.
Anyone mentioned this to the guys from CKEditor yet? Future fix?

Cheers.

kinglyr’s picture

Thanks Jack!

I'm using WYSIWYG 7.x-2.2 and CKEDITOR 7.1.1 Full.
I downloaded the ckeditor_4.1.1_full from http://ckeditor.com/download

BTW inside the /var/www/html/sites/all/libraries/ckeditor/ckeditor.js the line that you find the version is:
{var a={timestamp:"D3NA",version:"4.1.1",revision:"5a2a7e3",

Rgrds,

sunly917’s picture

works like a charm

davidmac’s picture

As it seems to be an ongoing issue even now, the solution proposed by @jack-pl is the most pragmatic. Given that the WYSIWYG module simply looks for a the version in a Doc Comment string (much like the libraries module), adding in a comment with the version string is sensible. Why? ... because the CKEDITOR library is updated infrequently and manually, whereas automatic updates of the WYSIWYG module will eventually happen and break the solution(unless it takes account of this issue), by which time most of us will have forgotton (well I will anyway) and will arrive back here looking for the same fix.

DavidMac

jack-pl’s picture

Yes, unfortunately it's true. My solution is only for those people which aren't familiar with PHP or just don't want change anything in php files. The main disadvantage of this issue is an obligation to repeat the same action for each library update.

Changing a regular expression within php file doesn't guarantee anything, and in all probability sooner or later a new php code will be required, so the issue will be ongoing anyway.

davidmac’s picture

At least the Drupal upgrade process doesn't require that the libraries are updated generally, whereas it does for the module, so your fix for the library part of the equation should last longer and cause less headache.

DavidMac

cmwelding’s picture

I applied this patch for the latest full version 4.2 but I am getting following error message. It still seems to be working though.
Notice: Undefined offset: 2 in wysiwyg_ckeditor_version() (line 85 of /home/example/public_html/sites/all/modules/wysiwyg/editors/ckeditor.inc).

deeray’s picture

Thank you Alex, however I am experiencing the same error message as cmwelding, will any dire effect arise If I choose to ignore the error message?

deeray’s picture

Hello, I found a solution here https://drupal.org/node/1883456 and it worked fine!

Lars Bo Jensen’s picture

Thanks, jack-pl. This is the better solution.

Kathelijne’s picture

This worked for me, thanks!

As a side note: how do you even come up with a solution like that? I'm by no means a Drupal guru, but I wouldn't have thought of something like that myself in a 1000 years.

Spanners’s picture

Worked for me, using CKEditor 4.3.1 Standard.

Simon Olsen
--
Follow me on Twitter - http://twitter.com/spanners80
Connect with me on LinkedIn: https://au.linkedin.com/pub/simon-olsen/12/359/143

GuillaumeDuveau’s picture

Thanks Jack. Should be added in WYSIWYG doc

drupalshrek’s picture

Thanks jack-pl, your fix did it for me: https://www.drupal.org/node/1161738#comment-7153730

Yup, I had to do a few minor things afterwards, but then everything was fine:

  • assign the editor to the text format
  • make sure the checkboxes for each of the buttons I wanted were selected
  • change the "Text processing" option of my text fields to "Filtered text (user selects text format)"

My configuration:

  • Drupal 7.28
  • WYSIWYG module 7.x-2.2
  • CKEditor Version 4.4.1

Roll on Drupal 8 where all this hassle should, finally, and not long before time, be at last gone!!

drupalshrek

Anonymous’s picture

thank you, works great for me.

ariangreatzone’s picture

Worked very well. Thank You

crispy80’s picture

thanks a lot!

dipali’s picture

Done.
Thank you Alex.

Details :
When I get error “The version of CKEditor could not be detected.2 whiel editing wysywig profiles in content authoring / admin > configuration > wyswig profiles:

In .../modules/wysiwyg/editors/ckeditor.inc change line 68 from
while ($max_lines && $line = fgets($library, 140)) {
to
while ($max_lines && $line = fgets($library)) {

Further description :
And no, this patch won't get into the module. If the second argument to fgets says 140, you are using an old version of Wysiwyg module. It should say 500.

This issue was fixed long ago in the latest Wysiwyg releases. (It may arise again if CKEditor drastically modifies its files, but then we probably need a different fix.)
I would not recommend to completely remove the last argument in the function call since that means the entire CKEditor file is read into the server's memory, on every page load where the editor should appear. That's just a waste of memory. Increase it a bit instead until the error goes away. Then it'll just read the beginnings of each line until it finds CKEditor's version number.

Now ,this is the final hack :

(The line holding the version string in the minified variant of CKEditor holds the entire script!)
and then I tried :
In .../modules/wysiwyg/editors/ckeditor.inc change line from function wysiwyg_ckeditor_version($editor)
if (preg_match('@version:\'(?:CKEditor )?([\d\.]+)(?:.+revision:\'([\d]+))?@', $line, $version)) {
to
if (preg_match('@version:\"(?:CKEditor )?([\d\.]+)(?:.+revision:\"([\d]+))?@', $line, $version)) {
This changes version number search from single quotes version: '4.0' to double quotes version "4.0"
It worked for me on Drupal 7.2, ckeditor_4.1.1_standard, and wysiwyg-7.x-2.2

Thanks a ton to Alex.

Let me knwo if there are any oher amendments you suggest.

JadH’s picture

Applied @dipali Patch and it worked.

JadH

venkatperi’s picture

Since revision codes can be alphanumeric, an additional change is needed for scanning the revision field (\w instead of \d, e.g. to work with 4.1.2.d6f1e0e). The snippet below consolidates the single/double quote fix with alphanumeric revision codes:

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

mitchseiden’s picture

@venkatperi thanks, that worked great.

Tony Jennings’s picture

Well done - that works great in Drupal 7 with latest ckeditor

ryanschweitzer’s picture

Works great in Drupal 7 and CKEditor 4.2.f74e558

Thanks!

deeray’s picture

sorry for asking, I am new to drupal, Please where do i paste this code?

Anonymous’s picture

In the file: .../modules/wysiwyg/editors/ckeditor.inc at about line 81

replace


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

with


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

Jeroen94’s picture

Thanks @audebytehosting! CKEditor 4.2.1 works for me now!

gwaddell’s picture

Thanks @audebytehosting! Works for me too! v4.2.1 @ line 81

copeasetic’s picture

This needs to rolled into the production version of this module. This issue has been a problem for too long.

aiwetir’s picture

Maybe I'm daft, but I've changed line 81 to the code shown and I still get the error.

Alex Overton’s picture

Thanks @audebytehosting this fixed it for me too.

Chennard’s picture

This worked for me, CKeditor is now detected, but it won't load in my text area's.
I configured all text formats to use CKeditor but still it won't show the buttons.
The text area does get the ckeditor css though and the top-bar but no buttons.

I fixed this. None of the buttons where enabled in CKeditor configuration.

Any suggestions?

My current drupal installation:
Drupal 7.23
CKeditor 4.2 revision f74e558
WYSIWYG 7.x-2.2

Alex Overton’s picture

you have probably worked this out ....if not ...you need to edit the profile ....and add the buttons

look for "Buttons and plugins" then put a tick in the box for each button you would like to appear in the editor.

when you edit the profile...don't forget to enable the profile that you would like it to be on.

EkkoJohnny’s picture

Kudos to all the ideas and quick fixes, but this is maddening. My files are a mess. Time to dump everything and start over - again. Is there actually a solution? Is this the REAL wonderful world of Drupal? Some of us aren't looking to make money off of Drupal. We just want a site. Coding is no problem, well, except for here. Did CK editor hit the market before it was ready? Not hating - just saying. I've given this issue three days of my life and there's no reward. lol

Lars Bo Jensen’s picture

Hi @EkkoJohnny, I'm sorry to hear about your trouble. CKEditor certainly is among the "funny" ones. However, Wysiwyg module on the latest Drupal 7 release and a CKEditor (full version recommended, currently I'm using 4.1.0.80) in sites/all/libraries/ckeditor does the trick for me at several installations. After doing what jack-pl suggests, anyway. Then, of course, assigning the editor to text formats at /admin/config/content/wysiwyg and configuring the editor at e.g. /admin/config/content/wysiwyg/profile/filtered_html/edit.

Good luck! At some point, there will be a reward, I promise.

rvb’s picture

audebytehosting's solution still works for me with CKEditor 4.3.0.d2184ac and Drupal 7.22

jimbobwe’s picture

Thank you SO MUCH for this fix! I'd been fiddling with this thing for several hours! I really wish the troubleshooting documentation on the developer's site was a little more accommodating, given that this is a pretty huge issue if you want to use the @font-your-face module, which requires Wysiwyg, and in combination with that, if you also want to use the latest and greatest version of CKEditor, *not* using Wysiwyg really isn't an option.

BTW, I realize that this thread has become pretty long in the tooth, and that there have been numerous fixes suggested here to solve this issue since the thread began in May of 2011. A lot of the fixes seemed to work for a time before other code changes in one of the modules ended up braking things again. However, I wanted to note that while alexPalumbo's post from nearly a year ago was to accommodate version 4.01 of CKEditor, I've just applied it to version 4.3.0.d2184ac and it still worked like a charm (I'm currently using Drupal 7.24, BTW). So hopefully this means that the patch will hold together for quite sometime to come.

Thanks again to Alex, and to all the rest'a you brainiacs out there as well, helpin' us newbs out in our time of greatest need. :)

reko888’s picture

CKEditor 4.3.3.7841b02
Drupal 7.26

oluabbeys’s picture

Thanks

frg2011’s picture

jack-pl, thank you!
Your solution worked for me.
CKEditor 4.4.0, WYSIWYG version 7.x-2.2

Rabeans’s picture

Thanks Alex, for me worked this patch perfectly. what a difference to little " " instead of ' ' makes....

modules/wysiwyg/editors/ckeditor.inc
line 81
i needed to fix the revision matching as it seems to be alphanumeric now

// version:"4.0.1",revision:"d02739be4b"
(preg_match('@version:\"(?:CKEditor )?([\d\.]+)(?:.+revision:\"([\da-z]+))?@', $line, $version))

Rix-1’s picture

Thanks jack-pl - that was great! Just added the comment and it worked straight away.

mpdonadio’s picture

I still see people commenting here about the version number problem. There is an issue for this at #1853550: Ckeditor 4.0 - The version of CKEditor could not be detected. that has been applied to the -DEV branch, but I don't think this has been applied to a release yet.

Per the patch on the issue, the best rexeg to use us

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

This will work with older and newer versions of CKEditor (it detects both quote styles).

silviateona’s picture

Hi mpdonadio,

Thank you so much, the regex you suggested works perfectly!

Stancione’s picture

Had the undetection problem, thanks a lot.

Boland’s picture

Doesn't work in latest dev branch, just downloaded the latest version. It has the updated regex, but still doesn't work.
It must be all really hard to make this work for every version. I quit, I download the CKEditor module directly, every time I tried the wysiwyg module it gave me such errors.

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)Insert "// version:'4.4.3',revision:'4391' " in first new line (without double quotations) and save it.

enjoy!

VM’s picture

It is my understanding (after reading through the wysiwyg issue queue) that these types of issues are corrected in the -dev version of the wysiwyg module. if that is the case then there isn't a need to hack the library files or the module files.

mrrfakier’s picture

That is correct. I can confirm that the latest dev version solves the problem and works with the latest version of ckeditor (4.4.3). If you notice the current stable version of the wysiwyg module (7.x-2.2) is very old and it is doubtful that it should work with a newer version of ckeditor.

Hooligan’s picture

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

VM’s picture

or use the -dev version where the issue is already corrected and awaiting the next release.

Hooligan’s picture

Only this would work for me.
1)Open "\sites\all\libraries\ckeditor\ckeditor.js" file in a text editor.
2)Insert "// version:'4.4.3',revision:'4391' " in first new line (without double quotations) and save it.

Dave the Brave’s picture

Thanks, that worked for me too

kiliweb’s picture

Thanks, it works for me too :)

rcold’s picture

Very thanks!!!

docans’s picture

Worked for me as well

hemantgoyal’s picture

I have been sitting on this for three days and still haven't been able to fix it. The things which I've tried so far are as follows:

1. Installed the WYSIWYG released version before and then the latest CK Editor which is 4.4.5. After reading the comments and patches on the forum, I tried them all. Which were adding the double quotes or the alpha numeric part. I tried using different versions of CK Editor too. No luck !

2. Found TwoD comments that the latest dev version fixes it. Deleted the previous version of the module and replaced it with the dev version. No luck again. Since lots of people were positive about 4.4.3 version of CK Editor, I changed that too. No luck yet. Also adding the comment with the version number to the ckeditor.js did not help either.

I know I am going wrong somewhere since I am new to Drupal. Am I missing something somewhere ? Sorry but it is frustrating me now, and would appreciate if someone could tell me the exact steps to follow with the versions included.

Thanks again :)

piyrus’s picture

I too was having issue getting CKEditor 4.4.5 to work. After going through a couple of comments in this thread, I started debugging the file sites/all/libraries/ckeditor/ckeditor.js and I found that this time instead of a single quote(') they have double quotes(") around the version tag.

Here is the fix
Go to your ckeditor.inc file WYSIWYG modules path which in my case is
sites/all/modules/wysiwyg/editors/ckeditor.inc

find the function "wysiwyg_ckeditor_version" around line 70 and replace

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

with

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

and it would resolve the issue.

sagesolutions’s picture

Thanks @piyrus, this did the trick for ckeditor version 4.4.6

yosef.homsy’s picture

you did the best smart resolving for this issue

best regards

WorldFallz’s picture

For everyone happily hacking away at the module to recognize CKEditor, please see: https://www.drupal.org/node/1853550#comment-9213657.

According to the maintainer, the proper fix for now (until a new official release is made) is to use the dev version of wysiwyg... NOT just hack in the version fix.

reacraf’s picture

WorldFallz has the best answer to this issue and it WORKS, I also recommend this to avoid issues in the future!

hafizshehbazali’s picture

I have the same problem. I applied the solution of person who said change the line 66

while ($max_lines && $line = fgets($library, 500)) {
to
while ($max_lines && $line = fgets($library)) {

SunnyGambino’s picture

I had same problem here so I wrote new regex for that.

1. Search for modules/wysiwyg/editors/ckeditor.inc
2. Search for "function wysiwyg_ckeditor_version($editor)" around 60th row.
3. Change function to:

function wysiwyg_ckeditor_version($editor) {
  $library = $editor['library path'] . '/ckeditor.js';
  if (!file_exists($library)) {
    return;
  }
  //$library = fopen($library, 'r');
  $max_lines = 8;
  //while ($max_lines && $line = fgets($library, 500)) {
  //var_dump(file_get_contents($library));exit;
  while ($max_lines && $line = file_get_contents($library)) {
    // version:'CKEditor 3.0 SVN',revision:'3665'
    // version:'3.0 RC',revision:'3753'
    // version:'3.0.1',revision:'4391'
    if(preg_match('/version:"(.*?)",revision:"(.*?)"/i', $line, $version)) {  //NEW REGEX HERE
    //if (preg_match('@version:\'(?:CKEditor )?([\d\.]+)(?:.+revision:\'([\d]+))?@', $line, $version)) {
      fclose($library);
      // Version numbers need to have three parts since 3.0.1.
      //$version[1] = preg_replace('/^(\d+)\.(\d+)$/', '${1}.${2}.0', $version[1]);
      return $version[1] . '.' . $version[2];
    }
    $max_lines--;
  }
  fclose($library);
}

Edit Olah’s picture

Thank you @alvilag.
This worked for me.

Jaapx’s picture

Worked for me on 2 sites.

WorldFallz’s picture

This is getting silly now, this post is full of bad advice. See the maintainer's response:

https://www.drupal.org/node/1853550#comment-9213657

This post is now closed.