Drupal 5.1, Workflow 5.x-1.0b1

I have a workflow with two states: Draft and Publish. It simply toggles the published flag and touches the date, but the default is Draft and unpublished.

When I go to the Workflow tab and set the state to Publish and schedule it for tomorrow (without entering a time), Workflow changes the state instantly. Watchdog gets a lot of errors similar to:

  • Illegal offset type in /home/ahknight/www/drupal-5.1/modules/taxonomy/taxonomy.module on line 1154.
  • Illegal offset type in /home/ahknight/www/drupal-5.1/modules/taxonomy/taxonomy.module on line 1151.
  • Illegal offset type in isset or empty in /home/ahknight/www/drupal-5.1/modules/taxonomy/taxonomy.module on line 1150.

The database is an upgrade from 4.7 which is where this workflow was created.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

greggles’s picture

Status: Active » Closed (duplicate)

I believe this is actually a pathauto problem: http://drupal.org/node/92900

mfredrickson’s picture

The watch dog errors might be pathauto's, but workflow claims the problem that scheduling d/n work.

This will be fixed in the next 5.x release of workflow.

greggles’s picture

Status: Closed (duplicate) » Active
greggles’s picture

Status: Active » Fixed

apparently this is _already_ committed. yay fixes!

superfly’s picture

Version: 5.x-1.0-beta1 » 5.x-1.0

This is apparently fixed, but it still doesn't work for me. I thought it might be related to another issue, that being that the node I'm trying to get through the workflow was created before the workflow was assigned, and I even changed the code to match the change there, but still nothing is happening. I'm still getting those errors.

* warning: Illegal offset type in /var/www/ioltechnology/modules/taxonomy/taxonomy.module on line 1150.
* warning: Illegal offset type in /var/www/ioltechnology/modules/taxonomy/taxonomy.module on line 1151.
* warning: Illegal offset type in /var/www/ioltechnology/modules/taxonomy/taxonomy.module on line 1154.
* warning: Illegal offset type in /var/www/ioltechnology/modules/taxonomy/taxonomy.module on line 1150.
* warning: Illegal offset type in /var/www/ioltechnology/modules/taxonomy/taxonomy.module on line 1151.
* warning: Illegal offset type in /var/www/ioltechnology/modules/taxonomy/taxonomy.module on line 1154.

superfly’s picture

Sorry, forgot to post the other details..

Drupal 5.1
PHP 4.4.2-1.1
Apache 2.0.55
MySQL 4.1.15

greggles’s picture

Project: Workflow » Pathauto
Category: bug » support
Priority: Critical » Normal

superfly - it would be more relevant to know the version of pathauto that you are using.

Also - are you using category or localizer?

superfly’s picture

*sigh* it must be that older nodes thing... just created a new node and the system works fine.

superfly’s picture

ai, it seems i'm good at counting my chickens before they've hatched. This still doesn't work. My workflow updates correctly, but I still get those "taxonomy" errors. I'm using workflow 5.x-1.0 and pathauto 5.x-1.0. I'm not using category or localizer.

* warning: Illegal offset type in /var/www/mysite/modules/taxonomy/taxonomy.module on line 1150.
* warning: Illegal offset type in /var/www/mysite/modules/taxonomy/taxonomy.module on line 1151.
* warning: Illegal offset type in /var/www/mysite/modules/taxonomy/taxonomy.module on line 1154.
* warning: Illegal offset type in /var/www/mysite/modules/taxonomy/taxonomy.module on line 1150.
* warning: Illegal offset type in /var/www/mysite/modules/taxonomy/taxonomy.module on line 1151.
* warning: Illegal offset type in /var/www/mysite/modules/taxonomy/taxonomy.module on line 1154.

greggles’s picture

superfly - can you try upgrading to the 5.x-1.x-dev version of pathauto and also can you see if the problem still exists without the workflow module?

superfly’s picture

greggles, this is happens when i update the workflow. i have a number of other sites running pathauto, and it doesn't happen there. only on this one site which is running the workflow module. also, the upgrade to dev didn't help.

codepoet’s picture

I'm in the same boat as superfly with the dev version, FYI.

greggles’s picture

Status: Fixed » Active

so then we need an active status ;)

greggles’s picture

Title: Workflow and Pathauto results in illegal offset errors with scheduled nodes » Pathauto's taxonomy pattern code is too specific (results in illegal offset errors with scheduled nodes with certain modules)

Nodes created via blogapi seem to have this problem as well: http://drupal.org/node/129382

The solution I plan to follow is to use the new DRUPAL-5--2 branch to implement token.module and then let token.module handle this.

I'll post back as I get closer on that so that you all can test.

freeman-1’s picture

Hi,

I run Drupal 5.1 with pathauto 5.x-1.0 and Taxonomy enabled. I ran into this problem as well - things work, but watchdog keeps logging "illegal offset in isset or empty" errors in the taxonomy module. I tested with pathauto 5.x-1.1 and the problem exists as well.

A debug trace shows the problem with the call from pathauto_node.inc:214 :

$term = taxonomy_get_term($first_term_id);

Seems the issue lies with the $value variable in the code above line 214. In my run, $value is an object type - and there's no handling for objects in the code. So I added this snippet at line 202 :

       elseif (is_object($value)) {
         $temptid = $value->tid;
         if ($temptid) {
           $first_term_id = $temptid;
           break;
         }
       }

before the existing array-handling part :

       elseif (is_array($value)) {
         $temptid = array_shift($value);
         if ($temptid) {
           $first_term_id = $temptid;
           break;
         }
       }

And it looks like the object type version is now handled correctly.

Things still look a little hard-coded to me, I'm not sure if it works for nodes with multiple taxonomy terms.

greggles’s picture

Version: 5.x-1.0 » 5.x-1.1

freeman (and everyone else who hasn't) please upgrade to the 1.1 release of pathauto or even the 1.x-dev version. It includes several bug fixes which should help. Then, if you still have the same error, please confirm it in this issue.

thanks.

freeman-1’s picture

Greggles, I did upgrade to 1.1 and the problem persisted. I've applied the same snippet to 1.1 and it resolves the issue. Thanks.

greggles’s picture

Ok, I just wanted to make sure.

Can you provide it as a patch to make it easy for others to test? http://drupal.org/diffandpatch

Thanks.

freeman-1’s picture

FileSize
652 bytes

Sure. Here is the patch against 1.1.

greggles’s picture

Status: Active » Needs review

Great - now we just need a review - since this is an issue that is quite complex (due to the nature of taxonomy terms and the possible configuration options for them) I'd appreciate it if lots of folks could test out this patch.

Thanks!

greggles’s picture

And in case anyone is unclear on the steps to review this:

1) install pathauto 5.1.1 and apply this patch
2) configure a pattern for your nodes that involves vocab/catetgory/catpath etc.
3) create nodes
4) see if you get the right paths (without errors)

simplymenotu’s picture

Assigned: Unassigned » simplymenotu
Status: Needs review » Reviewed & tested by the community

Testing results :
pathauto 5.x-1.1 and the above patch created vocab/terms appropriately.

/vocab/term/sub-term

Vocabs tested :

free tagging
single, optional
single, required
multiple, optional
multiple, required

greggles’s picture

Status: Reviewed & tested by the community » Needs review

thanks simplymentou! I'd still like some more testing/reviews prior to committing, but I do very much appreciate your help.

simplymenotu’s picture

Posting testing notes per greggles on IRC

1. install pathauto 5.x-1.1

2. apply patch
#19 submitted by freeman on March 29, 2007 - 11:00 new
Attachment: pathauto_node.inc__0.patch (652 bytes)

3. config vocab
* The configuration options have been saved.
* Bulk update of terms completed, 6 aliases generated.

4. create vocab
freetagging

5. add term "term 1"
* Created new alias nodes-freetag/term-1/term-1 for taxonomy/term/7
* Created new term term 1.

6. create a page
freetagging terms
- term 1 (found term)
- something else
- nada
* Created new alias nodes-freetag/something-else/something-else for taxonomy/term/9
* Created new alias nodes-freetag/nada/nada for taxonomy/term/10
* Created new alias http-drupal-org-node-123001 for node/54
* Your Page has been created.

7. create vocab
multiple select

8. create page
multiple and freetag used
* Created new alias nodes-freetag/test/test for taxonomy/term/17
* Created new alias my-office-home for node/55
* Your Page has been created.

9. create page with freetag term the same as multiple-select term
* Created new alias nodes-freetag/chair/chair for taxonomy/term/18
* Created new alias nodes-freetag/chair-freetag/chair-freetag for taxonomy/term/19
* Created new alias office-chair for node/56
* Your Page has been created.

10. create vocab
single, required
single, optional

11. create page with single vocab
no issues

Soren Jones’s picture

I was getting the same error superfly reported in #5/#9 with Drupal 5.1, Workflow 5.x-1.1, and Pathauto 5.x-1.1 when updating the workflow state on an item with one two-state workflow.

I am not using Category. I am using Localizer 5.x-1.9.

I applied freeman's pathauto_node.inc__0.patch from #19 and am no longer getting the error.

Thank you.

Hetta’s picture

Version: 5.x-1.1 » 5.x-1.2

Still a problem in pathauto 5.x-1.2, with drupal 5.1
I added the code snippet given by freeman in #15, which fixed the problem.

Thanks!

patchak’s picture

I can confirm that the patch solved the problem with me too!

Thanks

rootwork’s picture

Patch worked for me too. Yay!

greggles’s picture

For the people testing and responding that it works for you - can you also state what kinds of tests you did?

Thanks.

patchak’s picture

I installed pathauto and was getting that taxonomy error every time I blocked a feed source from leech with the content blocker module. While searching for that error I found this issue..and I figured I could give it a shot..

I installed the latest pathauto 5.x (not pathauto 2) and applied the change, now the error is gone and I have so side effect at all. I tried to update all my paths and create some new node paths to test it out, and yet the error seems gone!

Patchak

mwander’s picture

This is my first review. Please bear with me. (Plus I think my situation was a bit different than some of the others above.)

Situation was that I had previously been running cron against nodes in a Drupal environment with Scheduler, Pathauto, and Taxonomy.

Following running cron, if any changes were made to the nodes that related to these modules, I received many of the error messages listed above (only on the first view of the site after running cron).

Installed patch on Pathauto 5.x-1.2. Corrected all error messages.

Much thanks!

andremolnar’s picture

Status: Needs review » Needs work

Duplicated the error with workflow 1.1 and pathauto 1.2.
The node with workflow in question was using an optional free tagged vocabulary as well as a required multi-select vocabulary (no hierarchy)

When workflow published the node a series of offset warning (line 1150, 1151 and 1154 of taxonomy.module) are displayed.
It makes no difference whether or not any free tagged terms were entered.

Applied the patch -
Followed the same workflow path as before and all errors no longer appear.

Seems to do the trick for me.... BUT

I haven't dug/traced through the code thoroughly to see if $value is every even possibly an array. I actually think that it might never be an array if its source is the $node->taxonomy object. If there are some situations where $value somehow manages to be an array - then an alternate solution would be to cast the variable as array rather than do the extra conditional to assign $tempid.

Regardless the code patch needs to be re-written to not duplicate the four lines of code:

         if ($temptid) {
           $first_term_id = $temptid;
           break;
         }
andremolnar’s picture

FileSize
1.39 KB

Actually just took a closer look at the code - and the same sort of casting I suggest is being done at line 169/170

        $typed_input = $value;
        foreach ((array)$typed_input as $vid => $vid_value) {

So with that in mind I propose the attached patch - which checks if value is an object - and if it is casts it as an array. And in the above two lines takes that casting out of the for loop (so the casting isn't done each and every time).

Tested under the same conditions mentioned above - seems to work just fine. But more testing would be required.

andre

greggles’s picture

Status: Needs work » Needs review

I believe it is an array when the node is a new node that has been created manually. It's only an object when using a module like leech or workflow or...

I do agree that I'd like to see more testing/reviews of the code.

andremolnar’s picture

If that is the case - then the new supplied patch *should* be fine. If $value is an array - it stays an array - if its an object, it becomes an array. If it is anything else (e.g. string) - it stays the same.

I've got my patch employed on a dev server with tests happening constantly. I'll try to keep you updated if anything strange starts happening. But so far it is holding up.

andre

tjharman’s picture

I was having problems with the illegal offset errors, only triggered when I installed the fasttoggle module.

Installing the patch in #33 has resolved the errors for me.

Thanks,

Tim

kaimuki’s picture

I just downloaded PathAuto 5.x-1.2 yesterday, and today got the error messages below.
I'm a newbie, and have read through all the couple bug threads, and am not sure if the problem
is fixed in 5.x-1.2, or do I still have to apply some sort of patches?

I am running localizer, and none of the other stuff that seemed to have caused some others problems. I get the error message when clicking "create translation" so I'm pretty sure it's a localizer related situation.

My site is under construction, so I'm willing to give access to someone if they want to see what is going on and turn on/off some modules, etc. Or run a test if someone gives me some instructions on what they want done.

Aloha,
kai

* warning: Illegal offset type in /home/uchinan/public_html/modules/taxonomy/taxonomy.module on line 1150.
* warning: Illegal offset type in /home/uchinan/public_html/modules/taxonomy/taxonomy.module on line 1151.
* warning: Illegal offset type in /home/uchinan/public_html/modules/taxonomy/taxonomy.module on line 1154.
* warning: Illegal offset type in /home/uchinan/public_html/modules/taxonomy/taxonomy.module on line 1150.
* warning: Illegal offset type in /home/uchinan/public_html/modules/taxonomy/taxonomy.module on line 1151.
* warning: Illegal offset type in /home/uchinan/public_html/modules/taxonomy/taxonomy.module on line 1154.

kaimuki’s picture

I applied the patch in #33, and it seems to have got rid of the error messages.
I'll report back if there is any other odd behavior.
Thanks.

Anonymous’s picture

I had the same scenario as #36 where Pathauto was working just fine until I installed fast toggle.

I saw the errors that have been described many times already in this thread, applied patch from #33 and I can confirm that it fixed the errors and everything works great again.

Thanks,
txcrew

beginner’s picture

Category: support » bug
Status: Needs review » Needs work

couldn't apply the patch because it has non-standard (UNIX) end of lines.
See guidelines: http://drupal.org/patch/create

FYI, the same error (illegal offset) occurs with me when I enable pathauto and use it together with a custom module which uses node_load().
I don't use any of the other modules mentioned in this thread, so the common denominator is definitely pathauto.

greggles’s picture

Status: Needs work » Fixed

While it would be nice to have the proper EOL all the time I'll still quite happily accept patches that fix problems.

Applied to 5.x-1 branch. Thanks!

Anonymous’s picture

Status: Fixed » Closed (fixed)
dgtlmoon’s picture

Version: 5.x-1.2 » 4.7.x-1.x-dev

getting the same error in 4.x but this patch wont fit the 4.x release

any ideas?

is this still related to the typecasting bug here

http://drupal.org/node/155515

dgtlmoon’s picture

Status: Closed (fixed) » Postponed (maintainer needs more info)
greggles’s picture

Status: Postponed (maintainer needs more info) » Patch (to be ported)

It probably is. I suggest you manually port the patch and that will tell you.

Otherwise, you really should upgrade soon. Once 6.x is out there will no longer be support for 4.7.

greggles’s picture

@dgtlmoon - was your issue solved by http://drupal.org/node/104905 perhaps?

dgtlmoon’s picture

FileSize
388 bytes

after the most recent patch to 4.x-dev $first_term_id is still returning an object

im surprised $term = taxonomy_get_term($first_term_id); on line 216 doesnt return an error because that function is expecting an integer

i get this error when ever i transition a workflow state on a node.

see attached patch

greggles’s picture

Status: Patch (to be ported) » Closed (fixed)

@dgtlmooon - sorry, I'm not supporting 4.7 any more and nobody else has tested this so I'm marking it closed to clean the queue.

If you'd like to become the maintainer of the 4.7 branch I'd be happy to give you permissions. Just contact me directly.