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.

eZ debug

Timing: Jan 18 2025 14:55:37
Script start
Timing: Jan 18 2025 14:55:37
Module start 'content'
Timing: Jan 18 2025 14:55:37
Module end 'content'
Timing: Jan 18 2025 14:55:38
Script end

Main resources:

Total runtime1.0153 sec
Peak memory usage4,096.0000 KB
Database Queries194

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0063 588.7344180.8516
Module start 'content' 0.00630.8706 769.5859572.8516
Module end 'content' 0.87690.1383 1,342.4375336.7734
Script end 1.0152  1,679.2109 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.3759210.0002
Check MTime0.00140.1407210.0001
Mysql Total
Database connection0.00050.050210.0005
Mysqli_queries0.928991.49001940.0048
Looping result0.00230.22991920.0000
Template Total0.979496.520.4897
Template load0.00270.261120.0013
Template processing0.976796.200220.4884
Template load and register function0.00010.014310.0001
states
state_id_array0.00140.136910.0014
state_identifier_array0.00130.127320.0006
Override
Cache load0.00180.1776400.0000
Sytem overhead
Fetch class attribute can translate value0.00140.142630.0005
Fetch class attribute name0.00120.113750.0002
XML
Image XML parsing0.00780.766330.0026
class_abstraction
Instantiating content class attribute0.00000.001460.0000
General
dbfile0.00500.4929330.0002
String conversion0.00000.000530.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/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