I am upgrading Drupal 6.26 to Drupal 7. I had a small handful of nodes (a dozen or so) that contained PHP code. After the upgrade, I've found that the <?php tags have been replaced with <!--?php.

I searched the Google but all I found was http://drupal.org/node/1403918. I'm not using the WYSIWYG module though. I am using CKeditor so I followed the advice in post 1 but that didn't resolve the problem.

I have the PHP filter module enabled.

When I try to edit the node, the <?php tags are not HTML comments so I can't fix it that way. How can I fix this?

Edit 1: I don't think CKeditor has anything to do with this actually. I've completed disabled the CKeditor module and I'm still getting issues mentioned above.

Edit 2: I have a script that resets it back to 6.26. When I re-upgraded, the PHP scripts execute before I enable any non-Core modules. I then enabled everything but CKeditor and it fails so I don't think its CKeditor but another module. I will attempt to further diagnose.

  • Do you have PHP as the input format selected for one of these nodes? Is CKEditor actually appearing in place of the textarea for these nodes? Oct 31, 2012 at 13:55
  • CKeditor is appearing for these nodes and they are either PHP code or HTML + PHP. Oct 31, 2012 at 20:47
  • Right, and if you click "configure" on those input formats at /admin/config/content/formats/ do they have HTML corrector (Correct faulty and chopped off HTML) enabled? The Drupal 7 site I just looked at has it checked by default on the HTML formats. Nov 1, 2012 at 16:14
  • Neither input has the HTML corrector enabled. Nov 2, 2012 at 12:20

3 Answers 3


You don't have to accept this as an answer, but I would recommend not using CKEditor with the PHP input format. In D7's CKEditor module you're able to attach CKEditor to input formats, as opposed to D6 where you specified textfield IDs and paths and such. Therefore, you can just attach CKEditor to the "Filtered HTML" and "Full HTML" input formats and leave PHP alone. I just think it's a bad idea to try and use wysiwyg formatting that contains code like this.

So, my recommendation would be: 1) Disable CKEditor for the PHP input format. 2) Edit the handful of nodes and replace <!--?php with <?php

  • So maybe its not a CKeditor issue after all. I've disabled for those input types as you suggested. When I edit the node after that, the PHP tags appear correctly but when I save, I continue to have that error. Oct 31, 2012 at 20:47
  • You have the error on viewing the node or on editing the node? Oct 31, 2012 at 21:08
  • I have the error viewing the node. When I edit the node, the <?php tags appear correctly. Nov 1, 2012 at 13:02

Disable any additional filters like html corrector on the PHP input format. If it's not caused by CKEditor, it could be this.

  • Thank you for the suggestion but the only filter is the PHP evaluator. Nov 1, 2012 at 13:13

The issue ended up being with the drupal 7 version of http://drupal.org/project/contemplate. By not enabling that module, my issue was fixed.

Thanks to all who responded!

Not the answer you're looking for? Browse other questions tagged or ask your own question.