Extractor won't get template file
hsalazar - March 1, 2008 - 17:17
| Project: | Translation template extractor |
| Version: | 6.x-2.0 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | duplicate |
Description
Tried to extract strings from token module's components (token and token_actions). Get a blank screen. Afterwards, a two line repeated warning message:
* warning: Invalid argument supplied for foreach() in /hsphere/local/home/.../sites/all/modules/potx/potx.inc on line 469.
* warning: Invalid argument supplied for foreach() in /hsphere/local/home/.../sites/all/modules/potx/potx.inc on line 469.

#1
I'm getting similar results:
* warning: Invalid argument supplied for foreach() in /httpdocs/beijing/sites/default/modules/potx/potx.inc on line 1093.
* warning: Invalid argument supplied for foreach() in /httpdocs/beijing/sites/default/modules/potx/potx.inc on line 1101.
* warning: array_merge() [function.array-merge]: Argument #2 is not an array in /httpdocs/beijing/sites/default/modules/potx/potx.inc on line 1095.
* warning: Invalid argument supplied for foreach() in /httpdocs/beijing/sites/default/modules/potx/potx.inc on line 1101.
* warning: Invalid argument supplied for foreach() in /httpdocs/beijing/sites/default/modules/potx/potx.module on line 147.
* warning: Invalid argument supplied for foreach() in /httpdocs/beijing/sites/default/modules/potx/potx.inc on line 469.
Looks like glob() isn't finding a match and returning FALSE rather than an array and that's causing the subsequent problems.
#2
Well, according to http://php.net/glob glob() would return FALSE in case of error, but an empty array in case of no matches. I wonder why does it end up on the error case on your setups. Does it work for other modules?
#3
Hi @all,
I experience the same problem... it seems to have something to do with open_basedir. when it is disabled, everything works fine (even without the patch), but when it is enabled, I need to apply the above patch to get it work for directories that contain subdirectories.
So, do you already know when this will get into a future release?
Cheers & keep up the good work
hctom
#4
Hm, well, having an open_basedir problem is interesting. I wonder why would you have an open_basedir setting which is below your module / theme folders, that sounds interesting, but if that gets to an error, then well, understood. I am going to look into applying this to the many branches of potx running a bit later.
#5
I think i did not provide enough information in my previous post, which lead to some misunderstandings :-) Of course my open_basedir is not set to a directury underneath my modules/themes folders. It is set to the document root of my webspace. But when this is completely deactivated, the glob-error does not occure anymore. And with the open_basedir setting set, I can only parse directories (module or theme directories) that do not have any sub-directories. So I thought it might have something to do with open_basedir, as when deactivating this option the glob-error also vanishes.
Cheers
hctom
#6
Wow, that sounds like a glob() bug to me. Anyway, I'll look into this, thanks!
#7
You're welcome. Hope to see this in a new release soon, as this module really kicks ass :-) Best thing to get translation templates of your site, themes and modules!
Cheers
hctom
#8
I've committed a similar fix as suggested in the above patch, to go to empty arrays instead of FALSE, so the array functions will not cause problems. There was an issue with GLOB_BRACE not working on certain operating systems. I don't know whether the open_basedir problem would be fixed by using another way to get the list of files. I am about to do a release with these fixes on all branches, so it would be great if you could try again.
Gracefully degrading when glob() does not return an array does not make the module work in itself, so it would be good to get this reproduced and fixed. Marking active since the patch is already applied in a slightly different form, so there is no patch waiting here.
#9
Any feedback on this one?
#10
No feedback in a year, so I assume this worked out. The related fixes are at http://drupalcode.org/viewvc/drupal/contributions/modules/potx/potx.inc?...
Marking a duplicate of #263790: error in potx.inc and potx.module.