see: http://drupal.org/node/58714
The theme() function does not function identically under php4 and php5. It would be helpful to have this explained in the API documentation.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | theme-php4-5-note_1.txt | 693 bytes | pwolanin |
| #1 | theme-php4-5-note_0.txt | 577 bytes | pwolanin |
Comments
Comment #1
pwolanin commentedAttached is a first attempt to document this better.
Comment #2
drummI would like to see a notice about how theme functions should never use pass by reference in their implementations (despite apparently being possible with PHP 5). That would make code a bit unpredictable and incomaptible with 4.
Comment #3
pwolanin commentedYes, I agree- but I wan't sure how/where to include this. Suggestions welcome.
Comment #4
pwolanin commentedOk- added more to the attached (if it's not overkill). In terms of PHP 5 behavior is that it seems all objects (like $node) are passed by reference in PHP 5. See, for example, http://www.php.net/manual/en/language.oop5.basic.php#51624
I'm new to PHP programming, but this difference between PHP 4 and PHP 5 seems like it could cause some subtle bugs if drupal code is developed on one and then used on the other?
Comment #5
pwolanin commentedre-reading this, the wording seem good enough- any comments?
Comment #6
chx commentedFirst of all, only objects are passed by reference. And regardless of PHP version because
theme()does not define any references the arguments are not taken by reference. So if you want to mention this, then specify objects in the comment but I do not think this needs commenting because it's a well known fact that PHP5 works this way. We do not need to restate PHP documentation in the comments. We only mention PHP bugs.