Forums / General / ezwebin - is this a bug?

ezwebin - is this a bug?

Author Message

Russell Michell

Wednesday 23 September 2009 3:18:18 pm

Hi there,

I developed an extension for ez 4.0.1 which uses its own templates in its own 'design' directory - and it works great. I've now installed it into 4.1.3 and before I could test it, I got an error:

Warning: Invalid argument supplied for foreach() in /path/to/ezpublish/extension/ezwebin/autoloads/ezpagedata.php on line 392

I'm using siteaccesses with separate CSS, templates etc which override ezwebin. The ezdeploy extension is being used by the siteaccess extension.

So I fumbled around in ezpagedata.php and found that on line 391 a foreach block is epecting $path to be an array - but it wasn't:

// Generate relative path array as well full path id array and path css classes for div#page
$path = isset( $moduleResult['path'] ) ? $moduleResult['path'] : array();

eZ thought that this check for $moduleResult['path'] being set was enough. However it was returning 'false' - ie, it wasn't an array, hence the error message.

Adding a further check for it being an array fixed it:

// Generate relative path array as well full path id array and path css classes for div#page
$path = (isset( $moduleResult['path']) && is_array($moduleResult['path'])) ? $moduleResult['path'] : array();

<b>However</b> the reason I haven't submitted this as a bug, is that I'm not 100% I've configured my extension correctly for 4.1.3, here are my ini settings for the extension:

<b>extension/ezdeploy/settings/design.ini.append.php</b>

[ExtensionSettings]
DesignExtensions[]
DesignExtensions[]=ezdeploy
DesignExtensions[]=my-custom-design

[DesignSettings]
SiteDesign=ezdeploy

<b>extension/ezdeploy/settings/menu.ini.append.php</b>

[MenuSettings]
HideLeftMenuClasses[]
HideLeftMenuClasses[]=frontpage
HideLeftMenuClasses[]=blog
HideLeftMenuClasses[]=blog_post
AlwaysAvailable=true

<b>extension/ezdeploy/settings/module.ini.append.php</b>

[ModuleSettings]
ExtensionRepositories[]=ezdeploy
ModuleList[]=deploy

<b>extension/ezdeploy/settings/site.ini.append.php</b>

[RoleSettings]
PolicyOmitList[]=deploy/deploy

<b>extension/ezdeploy/settings/ezdeploy.ini</b>

# General Deployment Settings:
[DeploymentSettings]
# What's the URL you wish to fetch? Format: <hostname>[:<port-number>][/<path>]
TargetURL=my-hostname.co.nz
# The path to the command-line version of the deploy script:
ShellScript=/var/www/htdocs/ez-site/extension/ezdeploy/bin/shell/ezdeploy.sh
# The path to a local directory where the 'static' content is to be generated:
ShellScriptArgTargetDir=/var/www/htdocs/cms-deploy/ezpublish/
# Wether or not to log output from wget and rsync:
DeployLog=enabled
# What's the hostname where your staging server can be found? (Where you can view the generated content in a browser)
StagingServer=my-hostname.co.nz
# What's the path on the staging-server where your static content is located?
# Format: [/<dir-1>/[<dir-2>/]]
StagingServerPath=/cms-deploy/ezpublish/
# Use this setting until next version include a <select> menu with all avalable siteaccess listed as options:
SiteAccessForDeployment=my-design

# These settings are only used when InvocationMethod=web in DeploymentSettings above:
[DeploymentRsyncSettings]
# The user on the remote machine you wish to rsync your static content to:
RsyncRemoteUser=webdev
# The hostname of the remote machine:
RsyncRemoteHost=my-staging-server.co.nz
# The path to a directory on the remote machine where you wish to rsync your static content to:
RsyncRemotePath=/work/webdev/htdocs/ezpublish
# Allow rsync to be invoked via the webUI (see notes in README on issues with this) one of 'web' or 'cli':
InvocationMethod=cli

# Link Checking Settings
[LinkCheckSettings]
# Turn on/off the checking of external URLs in ez's pages:
LinkCheck=enabled

If anyone can spot anything obviously wrong with this, I'd sure appreciate some feedback.

Thanks a lot,
Russell

Russell Michell, Wellington, New Zealand.
We're building! http://www.theruss.com/blog/
I'm on Twitter: http://twitter.com/therussdotcom

Believe nothing, consider everything.

Bruce Morrison

Wednesday 23 September 2009 11:42:41 pm

Hi Russ

The error is not in relation to anything in the configuration but in a module (maybe deploy/delpoy ?).

Make sure that $Result['path'] is assigned an array even if it's an empty one:

$Result['path'] = array();

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Russell Michell

Thursday 24 September 2009 1:46:28 pm

Thanks a lot Bruce, I reverted ezpagedata.php and added the code into my extension - that sorted it!

Thanks again,
Russell

Russell Michell, Wellington, New Zealand.
We're building! http://www.theruss.com/blog/
I'm on Twitter: http://twitter.com/therussdotcom

Believe nothing, consider everything.