There is a one word error in the node.module that prevents seeing the full text version of content posts in preview. The full version heading in preview is only followed by two blank lines.

The issue is described in this discussion. A fix for the problem was posted in this discussion, but it seems never to have been formally submitted, reviewed and committed. It is a very simple fix, and unless it conflicts with something it should probably be corrected in the distributed files.

The module has:

$output .= node_view($node, 1, FALSE, 0);

The published fix is:

$output .= node_view(clone($node), 1, FALSE, 0);

Is there any reason this has not been corrected since 4.6.2 (it is still in the current 4.7CVS and CS0.8.3RC5b)? Other than it was just something that fell through the cracks and was overlooked?

CommentFileSizeAuthor
#6 node_preview_6.patch989 bytesgreggles
#4 node_preview_5.patch982 bytesgreggles
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

killes@www.drop.org’s picture

If there was no issue opened for this, how should we get to know about it? There are too many posts in the forums to read all of them. The fix suggests a problem with php 5. Can anybody who uses php 5 look into it?

thomherfs’s picture

That's why I mentioned it.

As I said, I assumed that it was a little issue that fell through the cracks.

I ran across if while looking for something else in the forums and thought it should be called to someone's attention.

I'm not using PHP5 on the sites I'm working with, so it isn't really something I can deal with. I imagine that there are a lot of little things like this hidden in the forum discussions that were never officially reported since the end-user with the problem thought that posting it in the forum was good enough.

paddy_deburca’s picture

There is a drupal_clone() function to implement clone() on those PHP platforms that do not natively have the function.

Paddy.

greggles’s picture

Status: Active » Needs review
FileSize
982 bytes

I can confirm this using PHP5 and a fresh checkout of HEAD. I'm not sure if it also impacts the PHP4.x users or not (I didn't test that).

I'm unclear about paddys' comment regarding clone and weather I should be using drupal_clone instead of clone. I can confirm that this fix worked for me and didn't seem to break other stuff (note - I didn't do extensive testing).

Tobias Maier’s picture

Status: Needs review » Needs work

http://api.drupal.org/api/HEAD/function/drupal_clone
-->replace clone() with drupal_clone()

greggles’s picture

Status: Needs work » Needs review
FileSize
989 bytes

Tobias - I had seen that API doc and I'll take your brief message to mean that the patch should use drupal_clone, my question is basically why?

Thanks kindly for the review. I have updated the patch.

Tobias Maier’s picture

http://de3.php.net/manual/en/language.oop5.cloning.php
because clone() is only available in php 5+ and not in php4

Tobias Maier’s picture

if you take a look at drupal_clone() then you can see that it checks if you are using php5 and if this is true then it uses clone() if not the it copies the object

greggles’s picture

Thanks kindly for the help, Tobias.

chx’s picture

Status: Needs review » Needs work

yes you should use drupal_clone for this.

chx’s picture

Status: Needs work » Needs review

i missed _6 sorry. (thanks webchick for pointing out)

sime’s picture

Status: Needs review » Reviewed & tested by the community

I recreated the problem in php5. I applied the patch - fixed the problem. I have all the modules installed, so I created various content types and also inserted

into the text to see if I could break anything. All good, I've updated the ticket status.

killes@www.drop.org’s picture

Status: Reviewed & tested by the community » Fixed

Applied.

Anonymous’s picture

Status: Fixed » Closed (fixed)