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

fago’s picture

Status: Active » Postponed (maintainer needs more info)

Do you know it's caused by a php4 compatibility issue? Please post all error messages you receive. Do other conditions work?

eporama@drupal.org’s picture

          o 0 ms After saving new content has been invoked.
          o 5.664 ms Included MODULE.rules.inc files.
          o 6.377 ms Executing the rule New Broken Link on rule set After saving new content
          o 8.092 ms Loaded variable acting user
          o 8.227 ms Condition created content is published evaluated to TRUE.
          o 8.411 ms Action execution: Send a mail to all users of a role
          o 1000000029.722 ms Action execution: Log to watchdog
          o 1000000030.523 ms Evaluation of After saving new content has been finished.
    * Created new alias broken_link/73 for node/73
    * Broken Link Report Erik Peterson has been created.

I 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...

 ...  (Object) stdClass

    *      uid (String, 1 characters ) 1
    *      name (String, 9 characters ) etloadmin
    *      pass (String, 32 characters ) <removed for post>
    *      mail (String, 13 characters ) erikp@<removed for post>
    *      mode (String, 1 characters ) 0
  ...

I'd be glad to look more closely if anyone can point out where this might be being called...

Thanks,
Erik

fago’s picture

hm, 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.

dtj’s picture

Component: Code » Miscellaneous

I tried to install SimpleTest 6.x-2.5, but it also requires PHP5.

fago’s picture

ah use the 1.x branch, I've not updated the tests to 2.x yet.

spydmobile’s picture

I can confirm this behaviour on my platform too:

Drupal 6.9 
Rules 6/x-1.0 Beta 3
Hostname  	rona.site5.com
Operating system 	Linux
Linux kernel version 	2.6.27-grsec
Apache version 	2.2.10 (Unix)
PHP Version 4.4.8
Perl version 	5.8.8 
MySQL version  	4.1.22-standard-log

This is a show stopper!!!!

here is what it says:



    *
          o 0 ms After updating existing content has been invoked.
          o 7.561 ms Included MODULE.rules.inc files.
          o 8.426 ms Executing the rule Reserve Booth on rule set After updating existing content
          o 9.169 ms Loaded variable acting user
          o 9.346 ms Condition This node is a tradeshow booth evaluated to FALSE.
          o 9.433 ms Evaluation of After updating existing content has been finished.
    * Tradeshow Booth D10 has been updated.


fago’s picture

>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.

fago’s picture

another 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.

spydmobile’s picture

sorry, my hosting platform upgraded to php 5! I wont be any use to you now :-(
F

mitchell’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Closing because user upgraded to PHP 5.

Note: According to http://drupal.org/requirements "Recommended: PHP 5.2 or higher"

kenorb’s picture

Status: Closed (fixed) » Closed (works as designed)

"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.

tannerg’s picture

Ok, 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.

Hazlitt’s picture

I 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

kenorb’s picture

Status: Closed (works as designed) » Postponed

Related PHP4 issues with other modules:
#442768: Replacement pattern [nid] doesn't work on PHP4

fago’s picture

Status: Postponed » Active
Hazlitt’s picture

I 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.

fago’s picture

guignonv’s picture

I 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

kenorb’s picture

It's the issue for the real 31337 people;)

klausi’s picture

Status: Active » Closed (fixed)

PHP 4 support has been dropped.

mitchell’s picture

Component: Miscellaneous » Rules Core

Updated component.