Closed (fixed)
Project:
Rules
Version:
6.x-1.x-dev
Component:
Rules Core
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
25 Sep 2008 at 15:01 UTC
Updated:
26 May 2012 at 17:09 UTC
I'm not sure if there have to be some special option set, but after testing on PHP 4.x evaluation is always FALSE (when checking type of content).
0 ms After updating existing content has been invoked.
36.094 ms Included MODULE.rules.inc files.
38.312 ms Executing the rule Test on rule set After updating existing content
43.929 ms Loaded variable acting user
45.975 ms Condition updated content is Page evaluated to FALSE.
46.202 ms Evaluation of After updating existing content has been finished.
Page Test has been updated.
Problem is somewhere during getting the data: $data = &$this->data->get(); (rules.variables.inc file) and rules_condition_content_is_type() function reciving empty $node->type variable (modules\node.rules.inc file).
Comments
Comment #1
fagoDo you know it's caused by a php4 compatibility issue? Please post all error messages you receive. Do other conditions work?
Comment #2
eporama@drupal.org commentedI can concur with the issue, running PHP 4.4.8. There is no actual error, it simply returns "false" and merrily goes on its way. It appears to be limited to the content-of-type condition. The above is "content-is-published" condition which succeeds.
The content type condition is consistently evaluating $node->type as null in the function "rules_condition_content_is_type". It appears from dumping $node in a dpm($node); call that $node is referencing the acting user instead of the actual node...
I'd be glad to look more closely if anyone can point out where this might be being called...
Thanks,
Erik
Comment #3
fagohm, that's odd. It sounds to be a rather critical PHP4 related bug. Could you run the simpletests provides by the rules simpletest module on your site? Unfortunately I've no php4 development site.
Furthermore you could check rules_get_variables(), which variables it should get ($names) and which it returns.
Comment #4
dtj commentedI tried to install SimpleTest 6.x-2.5, but it also requires PHP5.
Comment #5
fagoah use the 1.x branch, I've not updated the tests to 2.x yet.
Comment #6
spydmobile commentedI can confirm this behaviour on my platform too:
This is a show stopper!!!!
here is what it says:
Comment #7
fago>This is a show stopper!!!!
yep, it's really odd. However I've no idea why this shouldn't work in php4. Do other conditions work?
Please export an example rule containing the condition for me, perhaps something gets wrong already on configuration time. I need to setup a PHP4 testing environment first, so I am able to hunt this bug.
Comment #8
fagoanother user reported this #359697: "Content has type" recognition doesn't work
>i.e., When I look at the function rules_condition_content_is_type() and output the value of $node, there's no $node->type;
ok, so it looks like $node is somehow broken. On which events can you experience the problem? Please test all content related events whether it is working right.
Comment #9
spydmobile commentedsorry, my hosting platform upgraded to php 5! I wont be any use to you now :-(
F
Comment #10
mitchell commentedClosing because user upgraded to PHP 5.
Note: According to http://drupal.org/requirements "Recommended: PHP 5.2 or higher"
Comment #11
kenorb commented"Required: PHP version 4.3.5 or higher"
There is a problem, there is some solution, so closing it doesn't solve the problem. Somebody need to spend some time to debug it and make a patch for compability with PHP 4.x.
I don't need this module currently, but when somebody will not have any choice, it have to be fixed later. Some hint for this person can be in the first post, that object via reference is not retrieved correctly.
Changed for more appropriate status.
Comment #12
tannerg commentedOk, so I am the guy that really needs this to work. I am working on a project at a University and they have no intention of stepping into the new millennium and running PHP5. This is a total showstopper for me as using rules to trigger actions based on content type is hard to live without.
Is there any chance of this bug getting fixed? Is there are work around I am not thinking of?
I'm running rules-6.x-1.0-rc1
Here is the debug that gets spit out. You can see the check for content of type evaluates to FALSE when it should be TRUE.
#
* 0 ms After saving new content has been invoked.
* 0.703 ms Executing the rule Conference Room Request Created on rule set After saving new content
* 5.164 ms Loaded variable acting user
* 5.735 ms Condition Created content is Conference Room Reservation Request evaluated to FALSE.
* 6.057 ms Evaluation of After saving new content has been finished.
Comment #13
Hazlitt commentedI am also having exactly the same problem. My host is running PHP 4.4.8.
The rules module always evaulates a content type argument to FALSE.
This is also happening when checking the value of a CCK field.
I really need this functionality for a couple of projects I am working on. I have only been working with Drupal for a few months so I don't know how to go about troubleshooting or fixing the problem.
Hazlitt
Comment #14
kenorb commentedRelated PHP4 issues with other modules:
#442768: Replacement pattern [nid] doesn't work on PHP4
Comment #15
fagoalso see #462624: PHP4 issues
Comment #16
Hazlitt commentedI contact the ISP who told me that the virtual server can be switched to PHP 5 mode.
So I changed it over and the rules module is working fine now.
Comment #17
fagoMarked #478330: Keeps on evaluating to False on "Has Content Type" when running rule "after saving new content" as duplicate.
Comment #18
guignonvI have the same issue on a server running PHP4. I noticed when I use "var_dump($node);" (or $node_unchanged, or other global variables) that the object returned seems to be in fact the $user object! Therefore, it doesn't have a ->type property and fails the "node type test" (returns always FALSE).
I don't have any fix so far. If anyone has an idea why under Drupal 6+PHP4 all the variables provided by the rule module (like $node, $node_unchanged,...) point to the $user variable... :-s
Comment #19
kenorb commentedIt's the issue for the real 31337 people;)
Comment #20
klausiPHP 4 support has been dropped.
Comment #21
mitchell commentedUpdated component.