Closed (fixed)
Project:
Drupal core
Version:
5.x-dev
Component:
blog.module
Priority:
Critical
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
15 Dec 2006 at 00:56 UTC
Updated:
12 Jan 2007 at 21:31 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
jpetso commentedHm... I just noticed that it does work on the earlier version of my blog on localhost. I haven't changed anything in regard with input filters though, so I have no idea why it works locally and fails with the online version. Maybe I'll just try upgrading to today's rc1... I guess the BBCode module isn't responsible for this, or at least it seems to be that way.
Comment #2
jpetso commentedTalking to drewish on IRC, it seems probable that there's some difference between PHP4 (which is installed on the server, v4.4.4) and PHP5 (which is installed on my local PC, v5.1.6). Quote:
I also tested the RSS feed with urlfilter, and as that doesn't work as well I'm reassigning this bug to Drupal core.
Comment #3
drewish commentedThe node being called needs to be returned not passed by reference.
Comment #4
drewish commentedit's got a patch
Comment #5
drewish commentedi'd love some reviews...
Comment #6
joshk commentedI think this may be a misdiagnosis of the problem. Some filters (e.g. the basic html filter, url-to-link maker) are applied, although BBcode changes are not in evidence. However, patch doesn't make bbcode work for me. I think the issue may be with how bbcode module does its translations.
Here's my test node:
Viewing this node with the base "filtered html" setting + bbcode gives the expected result. Viewing source, here's what's being output to the browser:
Notice that the [b] has turned into a
<span>declaration with inline CSS style. I think that may be the issue. Here's the source from the rss feed:This is the same with or without the patch. It seems that the data is being put into the feed, and it's really a matter of the receiving end of the rss being able to parse the span with inline style data. Firefox certainly doesn't.
Comment #7
RobRoy commentedYeah, I just looked into it and hook_view says that you should modify the passed-by-reference node AND return that node. It's a bit odd, but this issue should be against blog_view() and maybe should look like this patch. Is this only with blog.module? Do page taxonomy feeds work okay? Please recatgorize if this patch doesn't help or you feel it's not the right approach.
With that said, I cannot reproduce this error on a fresh copy of 5.x-dev using PHP 4.4.4, so I'll try and do a test on PHP 5 later if this patch doesn't resolve the problem.
See http://api.drupal.org/api/HEAD/function/hook_view to see how the example does it.
Comment #8
dries commentedIs chunk required?
It's prone to error, IMO, as people will tend to optimize that code to 'return node_prepare()'.
Comment #9
drewish commentedDries, I agree it does seem really awkward. Since this is a change from 4.7 it really ought to be documented in the module update guide as such.
Comment #10
forngren commentedPatch without the chunk. Aint it beautiful? One changed byte.
Comment #11
drewish commentedforngren, that won't work because node_prepare() doesn't take $node by reference.
Comment #12
drewish commentedthis fixes the poll module which also doesn't take $node by reference. it also adds a comment to explain the purpose of the "extra" operation.
please pardon the DOS line endings.
Comment #13
RobRoy commented@forngren/Dries - This chunk is definitely intentional and required because of the explanation drewish gave above. Look at the http://api.drupal.org/api/HEAD/function/hook_view example and docs. We need to set $node to change the referenced $node and then return it to be consistent with what the docs say, so IMO my patch still stands.
Comment #14
drewish commentedi hope what robroy meant was his patch with my poll module addition stands ;) i'd really rather not have to try to re-explain it in another issue.
Comment #15
RobRoy commented@drewish, Yeah, that poll inclusion is good. In theory it should be in another issue, but it's pretty small so it's probably alright here. Small nit: there needs to be a period at the end of the blog_view comment you added.
Comment #16
RobRoy commentedOh and you can download Notepad++ to easily convert patches to Unix line endings.
Comment #17
drewish commentedrobroy, i'd almost added a period but the bread crumb comment above didn't have one and i couldn't remember what the "official" style was.
usually i use dos2unix to convert line endings but i hadn't had a chance to dig up a copy on this computer.
Comment #18
Anonymous (not verified) commentedIs the returned value used? The issue here is that the node_view change allows for $node within the function to modify the array memory area as given by the caller so that when the callee modifies the value and then returns the caller already has the changes. So, there is no reason to return $node from the callee.
Comment #19
RobRoy commented@drewish - The official style is to have a period at the end, so any added comments should conform to this style IMO, even if surrounding comments do not.
@earnie - Please see http://api.drupal.org/api/HEAD/function/hook_view as I stated above. "The passed-by-reference $node parameter should be modified as necessary and returned so it can be properly presented by theme('node', $node)."
Comment #20
drewish commentedearnie, it is used. take a look at node_build_content(). my original proposal in comment #3 was to just have node_feed() work the same way.
Comment #21
Anonymous (not verified) commentedOk, you'll need to forgive my ignorance here but I still don't see a need to return $node from blog_view or hook_view. The return actually removes the advantage of passing the node array by reference. So I would code the chunk as
because of this chunk
With the change to pass the node array by reference then code that does something like ``$node = mymodule_view($node);'' is wrong since it removes all hope of needing the call by reference in the first place.
BTW, I think the call by reference change for the node array needs extended to node_prepare as well but that is a different issue.
Comment #22
RobRoy commented@earnie - Yes, I understand what you're saying, but this change is to get existing view hooks to work as described on the api docs. Your issues for hook_view and hook_prepare would be two separate API changing issues for D6 as the current implementation seems to require both pass by reference and returning that node for certain direct calls to hook_view as stated in the docs.
Comment #23
Anonymous (not verified) commented@drewish: As I read your patch given in node_rss.patch per #3 in review of hook_view, it shouldn't be needed.
@RobRoy: Which is the reason I asked if it was used when I chimed in. However, hook_view needs patched to remove the return and node_prepare needs patched to make use of call by reference for the node array for the next API change release.
Now where is that TODO list? :)
Comment #24
Anonymous (not verified) commented@drewish: dos2unix can be found in http://downloads.sf.net/mingw/mingw-utils-0.3.tar.gz. The file is only a 1.5MB download.
Comment #25
heine commentedWe need to get this straight as ambiguity can lead to nasty XSS problems on PHP 4.
Either we fix the hook_view docs and apply drewish's patch in #3, making a return $node mandatory for hook_view (my preference) or we rewrite node_build_content and node_prepare to work with the a reference to $node.
Comment #26
chx commentedFirst of all, there is no easy solution here, we are late in cycle and need to change something. My 2c is on http://drupal.org/files/issues/node_rss.patch and fixing hook_view documentation. Less references are always better.
Comment #27
dries commentedI agree with chx (#26). Let's go with that patch, and make sure the documentation gets fixed. We're in a code freeze, but it is not too late to fix critical bugs elegantly.
Comment #28
RobRoy commentedI agree with that. I did a quick search to make sure that no other invoke calls to hook_view expect the referenced node to be changed, and they don't. I'll update the docs now.
Comment #29
RobRoy commentedHEAD docs for hook_view and node_example_view have been updated.
Comment #30
Anonymous (not verified) commentedI actually tried a modification yesterday of node_build_content and node_prepare as in the attached file. I'll post a second file with the blog.module changes needed since I can only attach one file per post. The changes are against HEAD.
Comment #31
Anonymous (not verified) commentedAnd the blog.module changes
Comment #32
drummI committed the patch agreed upon by Dries and chx since the documentation seems to be moving.
Comment #33
RobRoy commented@earnie - Those are separate issues and are probably best suited for 6.x-dev.
Comment #34
(not verified) commented