include the includes so that more functions can be called directly

fhelmschrott - April 28, 2007 - 19:23
Project:Token
Version:5.x-1.7
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

First of all there are syntax errors in both of the contrib modules (even, i18n) - the if patterns start with : instead of { but end with } instead of endif;

The after installing i got a missed function error regarding some toke function i could not remember. After complete deinstalling of the pathauto module this was gone. Now when i go to the settings page i get a few errors which get even more when trying to update the settings:

* warning: Invalid argument supplied for foreach() in /.../modules/pathauto/pathauto_user.inc on line 63.
* warning: Invalid argument supplied for foreach() in /.../modules/pathauto/pathauto_user.inc on line 16.
* warning: Invalid argument supplied for foreach() in /.../modules/pathauto/pathauto.module on line 194.
* warning: Invalid argument supplied for foreach() in /.../modules/pathauto/pathauto.module on line 194.
* warning: Invalid argument supplied for foreach() in /.../modules/pathauto/pathauto_user.inc on line 63.
* warning: Invalid argument supplied for foreach() in /.../modules/pathauto/pathauto_user.inc on line 16.
* warning: Invalid argument supplied for foreach() in /.../modules/pathauto/pathauto.module on line 194.
* warning: Invalid argument supplied for foreach() in /.../modules/pathauto/pathauto.module on line 194.

(i just removed parts of the path and substituted it with...)

#1

greggles - April 29, 2007 - 19:16

Thanks for testing the 5.x-2 version of pathauto which is not stable, but does need help testing.

I committed those contrib files without much testing (as you can see) so I will need to fix them soon.

Can you provide the fix to the syntax problem you found as a patch? http://drupal.org/patch/create

#2

fhelmschrott - April 29, 2007 - 21:01

note that the second (bigger) problem doesn't have to do with the contrib files. Will try my best with the patch but as i didn't do it before it would surely take some time. Probably it would be better if you fix the two lines yourself.

#3

greggles - April 30, 2007 - 03:53
Title:Syntax error in contrib modules and fatal error after installation» Syntax error in contrib modules
Status:active» fixed

Ok, I fixed those typos. It's a great practice to create/submit patches for issues when you know the solution. It doesn't take much more time and is very helpful to other users.

I'm unable to repeat the problem that you mentioned on the settings page. Can you try uninstalling pathauto (from admin/build/modules/uninstall ) and then reinstall it and see if it works? Is that what you already did? If so can you try installing it on a second (test) site to see if the problem still occurs?

Thanks.

#4

fhelmschrott - April 30, 2007 - 07:13

uninstalling and reinstalling was what i already did and didn't bring up any changes. I'll try to install another D5-instance today and install it there once more. Will report later.

#5

greggles - April 30, 2007 - 16:56
Status:fixed» active

fhelmschrott - in irc today dldedge confirmed this issue, so I must be missing something. I'll do a clean/install checkout myself to confirm this.

Thanks.

#6

fhelmschrott - May 1, 2007 - 05:50
Title:Syntax error in contrib modules» Syntax error in contrib modules and fatal error after installation

i just also did a clean install. The problem seems to be within / in the use of the tokens. function token_get_list() seems to return inappropiate values sometimes.

in pathauto_users e.g. the array $patterns which is filled by the function doesn't contain an array 'user'. Also token_get_list('taxonomy'); and token_get_list('node'); return the same content. unfortunately i'm not the big coder so i couldn't find the problem myself but hopefully my findings will help you.

#7

fhelmschrott - May 1, 2007 - 06:24

I did my first diff try today and built the 2 patches for the contrib modules. please doublecheck them. Next time i'll try cvsdiff then.

AttachmentSize
node_event.patch 966 bytes

#8

fhelmschrott - May 1, 2007 - 06:24

looks like i cannot attach archives so another post required for the second one.

AttachmentSize
node_i18n.patch 714 bytes

#9

greggles - May 1, 2007 - 15:35

Well, I just did some testing and still cannot get the "invalid argument supplied foreach" problem, so I'm really confused. I'll try one more time tonight.

I already patched the two inc files in contrib, though I appreciate you providing the patch. In general they look fine.

#10

greggles - May 1, 2007 - 15:45

I think I got it!!!

Ok, to use Pathauto 5.x-2 you need to use the latest code in token module . I'm doing that, but I imagine that you are using Token 5.x-1.6. That won't work :(

Can you try again with a checkout of the Token module from cvs?

You can get the code with this command:

cvs -d :pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib co -r DRUPAL-5 contributions/modules/token

#11

greggles - May 1, 2007 - 16:46

In a couple minutes there will be a new official release of token at http://drupal.org/node/140568

When that node is publicly available you'll be able to get the right file directly yourselves and it should work :)

Let me know if you still have problems after that.

Thanks.

#12

fhelmschrott - May 2, 2007 - 14:10

unfortunately this doesn't change anything. i completely uninstalled pathauto and token and reinstalled both (token first). I stillt get the same errors:

* warning: Invalid argument supplied for foreach() in /net/web/_local/ss/htdocs/modules/pathauto/pathauto_user.inc on line 63.
* warning: Invalid argument supplied for foreach() in /net/web/_local/ss/htdocs/modules/pathauto/pathauto_user.inc on line 16.
* warning: Invalid argument supplied for foreach() in /net/web/_local/ss/htdocs/modules/pathauto/pathauto.module on line 194.
* warning: Invalid argument supplied for foreach() in /net/web/_local/ss/htdocs/modules/pathauto/pathauto.module on line 194.

#13

yettyn - May 2, 2007 - 14:23

Hi,

the problem seam to still be there, got this above General Settings when clicking Pathauto in siteconfiguration

* warning: Invalid argument supplied for foreach() in /var/www/.../drupal/sites/all/modules/pathauto/pathauto_user.inc on line 16.
* warning: Invalid argument supplied for foreach() in /var/www/.../drupal/sites/all/modules/pathauto/pathauto.module on line 194.

using pathauto 5.x-2.x-dev dated 20 march and token 1 May release.

Y

#14

yettyn - May 2, 2007 - 14:29

correction, pathauto is the latest of course as I downloaded it today :-) 20 march was just the initial release.

#15

fhelmschrott - May 2, 2007 - 14:38

the errors still appear but it seems to work now. I just did some testing and it saves the values. The errors seem to come from the description part where the single fields get described beneath each of the forms.

btw: pathauto makes '039' out of a single quote '. is this intentionally or can it be changed?

#16

greggles - May 2, 2007 - 21:08
Title:Syntax error in contrib modules and fatal error after installation» include the includes so that more functions can be called directly
Project:Pathauto» Token
Version:5.x-2.x-dev» 5.x-1.7
Status:active» needs review

Ok, now I really think I've got it...

I don't know why it was working OK for me for a while, but I finally was able to reproduce the bug and figured out that it's because pathauto calls token_get_list directly which doesn't include the token_user.inc, for example.

Here is a patch which will include the necessary files in either theme_token_help or token_get_list - whichever is called. I separated out the include code into a separate function so that I'm not pulling the old "copy past antipattern" ;)

Testing and reviews welcome.

AttachmentSize
token_includes.patch 2.36 KB

#17

yettyn - May 5, 2007 - 16:09

Applied your patch and now I get:

    * warning: Invalid argument supplied for foreach() in /var/www/www.astrocalc.com/drupal/sites/all/modules/pathauto/pathauto_user.inc on line 39.
    * warning: Invalid argument supplied for foreach() in /var/www/www.astrocalc.com/drupal/sites/all/modules/pathauto/pathauto_user.inc on line 63.
    * warning: Invalid argument supplied for foreach() in /var/www/www.astrocalc.com/drupal/sites/all/modules/pathauto/pathauto_user.inc on line 16.
    * warning: Invalid argument supplied for foreach() in /var/www/www.astrocalc.com/drupal/sites/all/modules/pathauto/pathauto.module on line 194.
    * warning: Invalid argument supplied for foreach() in /var/www/www.astrocalc.com/drupal/sites/all/modules/pathauto/pathauto.module on line 194.
    * warning: Invalid argument supplied for foreach() in /var/www/www.astrocalc.com/drupal/sites/all/modules/pathauto/pathauto.module on line 194.

maybe something needs to be done in pathauto as well? I'm no php pro so can't really tell.

#18

greggles - May 5, 2007 - 16:28

Maybe I'm crazy - but the other night I had a similar problem on a test site where I was running postgresql. Is anyone who gets these errors running postgres? As I said, it could have just been a really confused installation on my part...

#19

yettyn - May 5, 2007 - 20:13

mysql 4.1.22, sorry ;-)

#20

fhelmschrott - May 5, 2007 - 21:15

just wanted to let you know it seems to work after applying the patch. Great work - thanks ;)

#21

David N - May 11, 2007 - 06:54

I'm getting the same errors as post #13, on lines 16 and 194. Using current Token (May 1) and Pathauto releases.

#22

greggles - May 11, 2007 - 22:36
Status:needs review» fixed

I had a small problem with the patch, but I committed this to help people test pathauto5.x-2.

Once the tarball gets rerolled it should be working reasonably well.

#23

Christefano - May 19, 2007 - 12:19

Is this issue really closed? I'm having the same errors with token with this patch listed at #16 with pathauto 2-dev.

#24

greggles - May 19, 2007 - 13:26

@christefano - currently this is only checked into the 5.x-dev version of Token. Did you get your token tarball from http://drupal.org/node/143907 ?

#25

fhelmschrott - May 22, 2007 - 06:45

just to let you know - the latest dev-version of token still doesn't include that patch. i still got the errors installing from the latest dev-version. After applying the token_include.patch everything's working fine.

#26

Anonymous - June 5, 2007 - 06:46
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.