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.

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 18 2025 15:07:58
Script start
Timing: Jan 18 2025 15:07:58
Module start 'layout'
Timing: Jan 18 2025 15:07:58
Module start 'content'
Timing: Jan 18 2025 15:07:59
Module end 'content'
Timing: Jan 18 2025 15:07:59
Script end

Main resources:

Total runtime1.1248 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0079 589.7031152.6094
Module start 'layout' 0.00790.0043 742.312539.4141
Module start 'content' 0.01231.1115 781.7266567.7891
Module end 'content' 1.12370.0011 1,349.515616.1797
Script end 1.1248  1,365.6953 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.2852160.0002
Check MTime0.00130.1166160.0001
Mysql Total
Database connection0.00100.088710.0010
Mysqli_queries1.068594.9903570.0187
Looping result0.00090.0792550.0000
Template Total1.064394.620.5321
Template load0.00260.230720.0013
Template processing1.061794.384820.5308
Template load and register function0.00010.007510.0001
states
state_id_array0.00310.279610.0031
state_identifier_array0.00230.201020.0011
Override
Cache load0.00200.1822400.0001
Sytem overhead
Fetch class attribute can translate value0.00050.048120.0003
Fetch class attribute name0.00090.076650.0002
XML
Image XML parsing0.00090.076120.0004
class_abstraction
Instantiating content class attribute0.00000.000760.0000
General
dbfile0.00080.0704220.0000
String conversion0.00000.000740.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
14content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
9content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 34
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs