Closed (fixed)
Project:
Custom Breadcrumbs
Version:
6.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
15 Feb 2010 at 01:25 UTC
Updated:
25 Mar 2010 at 00:00 UTC
Jump to comment: Most recent file
Comments
Comment #1
MGN commentedGenerally, this advanced option should only be used by people who understand php. There is a warning on the form page indicating it is possible to break your site if it is used incorrectly. Still, I can work on improving the documentation in the readme file.
Comment #2
MGN commentedComment #3
marrch_caat commentedYou're right, the PHP snippets shouldn't be used by someone who doesn't know PHP. But it's not obvious that the $node is passed to the snippet ByRef - and it's not a really common way, and many similar snippets in Drupal modules receive only clone of data to prevent it's modification. The purpose of the snippet id only construction of breadcrumbs data, not some actions affecting node itself. So I suppose that if there is some need to allow the snippet modifiing $node data, it should at least be made absolutely clear that the data is passed ByRef. IMHO.
Comment #4
MGN commentedI agree, and thinking about further the $node variable shouldn't be passed by reference. Do you know of an instance in the code where this is occurring? I thought it was only be passed by value...
Comment #5
marrch_caat commentedWell, I wasn't really correct using the word "byref". But it's an object, and when it's passed by value - it just can't be destroyed or replaced with a new one, but its fields can be modified or even destroyed anyway. To prevent that, it's good practice to use clone() or Drupal wrapper drupal_clone() function, and when it's about visibility or similar PHP snippets - it's usually done so. That's what I meant...
Comment #6
MGN commentedOk, I think I see what you are getting at. I think the attached patch addresses this problem, can you test it out and see if it behaves as you would expect?
Thanks
Comment #7
marrch_caat commentedYes, the patch is working as I supposed.
Comment #8
MGN commentedThanks. Committed to 6.x-2.x-dev for further testing. http://drupal.org/node/714450