Joomla! Discussion Forums



It is currently Tue Nov 24, 2009 3:54 pm (All times are UTC )

 




Post new topic Reply to topic  [ 23 posts ] 
Author Message
Posted: Tue May 29, 2007 12:19 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Apr 25, 2007 10:23 am
Posts: 9
Location: Athens, Greece
Hi, everyone.

  First of all, well done on a great job in J! 1.5, it seems like a very well-built, solid framework. I've decided to take the risk of using nightly builds for a -hopefully- large community website, due to be online by the end of the year.

What I recently got is the following warning ONLY in my front page (/templates/community/body.php, which is include()'d from /templates/community/index.php). It is just the html skeleton of the website with slight if..endif blocks that slightly change the skeleton depending on the loaded component. I'm only accessing the JURI instance, apart from that nothing more advanced is used. Other components in the website don't get the warning to appear.

It started appearing from a nightly build, roughly in the beginning of May. Still appears in May 28th nightly build. I Googled the error message and it seems to appear in numerous other Joomla installations. Anyway, here goes:

Quote:
Warning: Invalid argument supplied for foreach() in c:\web\root\joomla\libraries\joomla\environment\request.php on line 393


Note: I'm not a J! expert, but I'm working without modifying the core, using template overrides and custom modules and components.

Don't really know what to post as debug information, so I injected a debug_backtrace() printout right in the beginning of the set() method in request.php. Here is the output:

Code:
    [0] => Array
        (
            [file] => C:\web\root\joomla\libraries\joomla\application\router.php
            [line] => 187
            [function] => set
            [class] => JRequest
            [object] => JRouter Object
                (
                    [_mode] => 0
                    [_vars] => Array
                        (
                        )

                    [_errors] => Array
                        (
                        )
                )

            [type] => ->
            [args] => Array
                (
                    [0] =>
                    [1] => get
                    [2] =>
                )
        )

    [1] => Array
        (
            [file] => C:\web\root\joomla\libraries\joomla\application\application.php
            [line] => 121
            [function] => parse
            [class] => JRouter
            [object] => JRouter Object
                (
                    [_mode] => 0
                    [_vars] => Array
                        (
                        )

                    [_errors] => Array
                        (
                        )
                )

            [type] => ->
            [args] => Array
                (
                    [0] => http://localhost/joomla/
                )

        )

    [2] => Array
        (
            [file] => C:\web\root\joomla\includes\application.php
            [line] => 85
            [function] => route
            [class] => JApplication
            [object] => JSite Object
                (
                    [_pathway] =>
                    [_clientId] => 0
                    [_router] => JRouter Object
                        (
                            [_mode] => 0
                            [_vars] => Array
                                (
                                )

                            [_errors] => Array
                                (
                                )

                        )

                    [_messageQueue] => Array
                        (
                        )

                    [_errors] => Array
                        (
                        )

                    [requestTime] => 2007-05-29 15:04
                )

            [type] => ->
            [args] => Array
                (
                )
        )

    [3] => Array
        (
            [file] => C:\web\root\joomla\index.php
            [line] => 59
            [function] => route
            [class] => JSite
            [object] => JSite Object
                (
                    [_pathway] =>
                    [_clientId] => 0
                    [_router] => JRouter Object
                        (
                            [_mode] => 0
                            [_vars] => Array
                                (
                                )

                            [_errors] => Array
                                (
                                )
                        )

                    [_messageQueue] => Array
                        (
                        )

                    [_errors] => Array
                        (
                        )

                    [requestTime] => 2007-05-29 15:04
                )

            [type] => ->
            [args] => Array
                (
                )
        )


Any suggestions ? Thanks for your time in advance!


Top
  E-mail  
 
Posted: Wed May 30, 2007 11:40 pm 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Fri Aug 12, 2005 12:47 am
Posts: 6431
Hmm very hard to say what the problem is based on this info, anything else you could add ? For example what code does trigger this ?

_________________
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.nooku.org - multi-lingual content manager and rapid extension development framework for Joomla 1.5
http://www.joomlatools.eu - training, consulting and extension development


Top
   
 
Posted: Fri Jun 01, 2007 9:36 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Apr 25, 2007 10:23 am
Posts: 9
Location: Athens, Greece
Thanks for your reply,

Did a fair amount of testing by (un)publishing my modules involved in my frontpage, none seems to trigger the error. Funny thing is, there isn't any fancy code in it either.. I only use
Code:
JURI::getInstance()
and the instance's
Code:
getVar()
method, to decide the skeleton I'm going to echo. Removing the code doesn't help either, the warning still comes up.

I'll post again if I come up with anything.. darn frontpage looks ugly, it messes with my header navigation as well :(

Ektoras


Top
  E-mail  
 
Posted: Fri Jun 01, 2007 1:42 pm 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Fri Aug 12, 2005 12:47 am
Posts: 6431
Other question, what version of 1.5 are you developing on ?

_________________
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.nooku.org - multi-lingual content manager and rapid extension development framework for Joomla 1.5
http://www.joomlatools.eu - training, consulting and extension development


Top
   
 
Posted: Fri Jun 01, 2007 3:00 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Apr 25, 2007 10:23 am
Posts: 9
Location: Athens, Greece
I'm working on the nightly builds. Keeping my backups of course, I update from the trunk once or twice a week.


Top
  E-mail  
 
Posted: Fri Jun 01, 2007 4:10 pm 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Fri Aug 12, 2005 12:47 am
Posts: 6431
Strange, very hard to find out what the exact problem is if we don't know what the cause is.

_________________
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.nooku.org - multi-lingual content manager and rapid extension development framework for Joomla 1.5
http://www.joomlatools.eu - training, consulting and extension development


Top
   
 
Posted: Mon Jun 04, 2007 8:33 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Apr 25, 2007 10:23 am
Posts: 9
Location: Athens, Greece
Indeed... well, for presentation's sake I had to modify the set() method in libraries/joomla/environment/request.php as follows. It didn't seem to hurt anything, at least visible.

Code:
   function set($array, $hash = 'default', $overwrite = true)
   {
      if(is_array($array))
         foreach($array as $key => $value) {
            JRequest::setVar($key, $value, $hash, $overwrite);
         }
   }


Why this method is called in the first place still eludes me though - as I mentioned I'm not -yet- an expert in the Joomla framework ;)

Thanks for your help, i'll post again in case something changes in a future revision.


Top
  E-mail  
 
Posted: Mon Jun 04, 2007 9:41 pm 
User avatar
Joomla! Ace
Joomla! Ace
Offline

Joined: Wed Oct 05, 2005 7:25 am
Posts: 1012
Location: Amsterdam
May I ask, have you got Joscomment installed et all? Because on the dutch joomla board people did have problems with that. Check out this link: http://forum.joomla.org/index.php?topic=94636.msg489190

I have not seen this for some time, not on the nightly build s of late.

I did see this however a couple of months ago when we were still testing the Beta 1, but my brain does not engage on  what it was.

I presume that you have done clean installs ? I know that it might sound as a cliche but one has to ask.

Also is this happening with the standard content? No extra legacy components installed?

_________________
Joomla Bug Squad

Note: Sending me private messages for personal support, without this been requested, would lead to ignoring any of your posts in future!


Top
   
 
Posted: Tue Jun 05, 2007 9:02 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Apr 25, 2007 10:23 am
Posts: 9
Location: Athens, Greece
Hi there. Seen the thread you mentioned, but..

No joscomment, neither have I enabled Legacy plugin and any 1.0 modules. It's a clean Joomla 1.5 installation, plus three (as of now) custom components coded by me.

But I don't think those components have something to do with it, since the error appears on the frontpage. No component displayed there, only some modules on the left and right columns, which I've tried unpublishing one by one to see if the error ceases to appear.

The inner pages have the same layout with the frontpage, except for the loaded component in the middle column, and do not generate the error. :S

Ektoras


Top
  E-mail  
 
Posted: Tue Jun 05, 2007 9:49 am 
User avatar
Joomla! Ace
Joomla! Ace
Offline

Joined: Wed Oct 05, 2005 7:25 am
Posts: 1012
Location: Amsterdam
Without sounding "learning" , but leading the life of an problem analyst as I do, it would be advisable to go back to your clean install without your components. Make shure everything works according to expectation.
If that is the case, add your first component and see what happens.
Work your way through like that and you will at least be able to pinpoint the culprit causing the error.
Once you know that, the next stage is to find out why this particular item gives you the " for each" problem and investigate further.

Right now it is hard to say if it caused by Joomla 1.5 or something else. It must be some counter that set empty or is the result of a calculation.

_________________
Joomla Bug Squad

Note: Sending me private messages for personal support, without this been requested, would lead to ignoring any of your posts in future!


Top
   
 
Posted: Tue Jun 05, 2007 3:16 pm 
User avatar
Joomla! Virtuoso
Joomla! Virtuoso
Online

Joined: Sat Sep 24, 2005 11:01 pm
Posts: 4481
Location: Toronto, Canada
Noxaeterna wrote:
Hi, everyone.

  First of all, well done on a great job in J! 1.5, it seems like a very well-built, solid framework. I've decided to take the risk of using nightly builds for a -hopefully- large community website, due to be online by the end of the year.

What I recently got is the following warning ONLY in my front page (/templates/community/body.php, which is include()'d from /templates/community/index.php). It is just the html skeleton of the website with slight if..endif blocks that slightly change the skeleton depending on the loaded component. I'm only accessing the JURI instance, apart from that nothing more advanced is used. Other components in the website don't get the warning to appear.

It started appearing from a nightly build, roughly in the beginning of May. Still appears in May 28th nightly build. I Googled the error message and it seems to appear in numerous other Joomla installations. Anyway, here goes:

Quote:
Warning: Invalid argument supplied for foreach() in c:\web\root\joomla\libraries\joomla\environment\request.php on line 393


Note: I'm not a J! expert, but I'm working without modifying the core, using template overrides and custom modules and components.

Don't really know what to post as debug information, so I injected a debug_backtrace() printout right in the beginning of the set() method in request.php. Here is the output:


Any suggestions ? Thanks for your time in advance!


Can you check to make sure that one of your menu items in the Main Menu has the 'Default' star beside it?

I managed to set the default item to an unpublished menu item, and the resulting errors were:
Notice: Trying to get property of non-object in /var/www/j15/libraries/joomla/application/router.php on line 184

Notice: Trying to get property of non-object in /var/www/j15/libraries/joomla/application/router.php on line 187

Warning: Invalid argument supplied for foreach() in /var/www/j15/libraries/joomla/environment/request.php on line 395

Notice: Trying to get property of non-object in /var/www/j15/libraries/joomla/application/router.php on line 190

Notice: Trying to get property of non-object in /var/www/j15/includes/application.php on line 361

Notice: Trying to get property of non-object in /var/www/j15/includes/application.php on line 361

Notice: Trying to get property of non-object in /var/www/j15/includes/application.php on line 367

Notice: Trying to get property of non-object in /var/www/j15/includes/application.php on line 367

Assuming you had your error levels set to display warnings and not notices, this would result in only the one warning being displayed regarding request, and core updates would account for the difference of 2 lines.

Ian

_________________
Joomla! Leadership Team - Production Working Group
Joomla! Bug Squad Coordinator
Joomla! Developer Documentation Team
Please don't say something 'isn't working'. Explain what you tried, and what happened as a result.


Top
   
 
Posted: Wed Jun 06, 2007 8:14 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Wed Apr 25, 2007 10:23 am
Posts: 9
Location: Athens, Greece
Ian, that was brilliant. You just made my morning! :-)
[me=Noxaeterna]happily returns back to coding.[/me]


Top
  E-mail  
 
Posted: Wed Jun 06, 2007 8:16 am 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Wed Jun 06, 2007 8:12 am
Posts: 1
Hi all,

I get the following error when I am trying to preview the default templates in Joomla 1.5 Beta 2 version.

Warning: Invalid argument supplied for foreach() in C:\wamp\www\Joomla\includes\application.php on line 412.

This is a clean install and I have not touched any other part of administration site so far.

Can anyone  let me know what is the issue here.

Thanks
Charan.


Top
   
 
Posted: Wed Jun 06, 2007 9:13 am 
User avatar
Joomla! Ace
Joomla! Ace
Offline

Joined: Wed Oct 05, 2005 7:25 am
Posts: 1012
Location: Amsterdam
Check out the above, may be you have the same problem and follow Ianmac' s tips!

_________________
Joomla Bug Squad

Note: Sending me private messages for personal support, without this been requested, would lead to ignoring any of your posts in future!


Top
   
 
Posted: Wed Jun 06, 2007 10:02 am 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Fri Aug 12, 2005 12:47 am
Posts: 6431
@Ian : is this problem already reported ?

_________________
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.nooku.org - multi-lingual content manager and rapid extension development framework for Joomla 1.5
http://www.joomlatools.eu - training, consulting and extension development


Top
   
 
Posted: Wed Jun 06, 2007 10:11 am 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sun Nov 06, 2005 8:49 am
Posts: 21
This error sounds familiar -- it's PHP5's way of saying the object iterated over in a foreach is not an array. Defensive coding practices would suggest that you replace a blunt

foreach ($ar as $k => $v) ...

by

if (iforeach ($ar as $k => $v) ...

Looking at includes/application.php, line 412 reads : foreach($item->tree as $menupath) ...


Top
  E-mail  
 
Posted: Wed Jun 06, 2007 12:13 pm 
User avatar
Joomla! Virtuoso
Joomla! Virtuoso
Online

Joined: Sat Sep 24, 2005 11:01 pm
Posts: 4481
Location: Toronto, Canada
Jinx wrote:
@Ian : is this problem already reported ?


When diagnosing that...  I did some menu manager testing...  bugs are filed here:

http://forum.joomla.org/index.php/topic,177398.0.html

Ian

_________________
Joomla! Leadership Team - Production Working Group
Joomla! Bug Squad Coordinator
Joomla! Developer Documentation Team
Please don't say something 'isn't working'. Explain what you tried, and what happened as a result.


Top
   
 
Posted: Wed Jun 06, 2007 12:16 pm 
User avatar
Joomla! Virtuoso
Joomla! Virtuoso
Online

Joined: Sat Sep 24, 2005 11:01 pm
Posts: 4481
Location: Toronto, Canada
Though Jinx, in that thread I didn't mention anything about handling lack of default...  should we throw a 500 if there is no default menu item?

Ian

_________________
Joomla! Leadership Team - Production Working Group
Joomla! Bug Squad Coordinator
Joomla! Developer Documentation Team
Please don't say something 'isn't working'. Explain what you tried, and what happened as a result.


Top
   
 
Posted: Thu Jun 07, 2007 1:51 am 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Fri Aug 12, 2005 12:47 am
Posts: 6431
Without a default the system fails, so I think we should prevent from removing the default item and in case this would happen add a check and display a 500.

Can you update your bug report with this info, i'll try to get to it in the coming days.

_________________
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.nooku.org - multi-lingual content manager and rapid extension development framework for Joomla 1.5
http://www.joomlatools.eu - training, consulting and extension development


Top
   
 
Posted: Thu Jun 07, 2007 2:28 am 
User avatar
Joomla! Virtuoso
Joomla! Virtuoso
Online

Joined: Sat Sep 24, 2005 11:01 pm
Posts: 4481
Location: Toronto, Canada
Agreed.

Will update the bug report.

Ian

_________________
Joomla! Leadership Team - Production Working Group
Joomla! Bug Squad Coordinator
Joomla! Developer Documentation Team
Please don't say something 'isn't working'. Explain what you tried, and what happened as a result.


Top
   
 
Posted: Thu Jun 07, 2007 1:13 pm 
User avatar
Joomla! Champion
Joomla! Champion
Offline

Joined: Fri Aug 12, 2005 12:47 am
Posts: 6431
Thanks.

_________________
Johan Janssens - Joomla Co-Founder, Lead Developer of Joomla 1.5

http://www.nooku.org - multi-lingual content manager and rapid extension development framework for Joomla 1.5
http://www.joomlatools.eu - training, consulting and extension development


Top
   
 
Posted: Thu Jun 14, 2007 12:31 pm 
Joomla! Fledgling
Joomla! Fledgling
Offline

Joined: Thu Jun 14, 2007 12:24 pm
Posts: 1
pdelbar wrote:
This error sounds familiar -- it's PHP5's way of saying the object iterated over in a foreach is not an array. Defensive coding practices would suggest that you replace a blunt

foreach ($ar as $k => $v) ...

by

if (iforeach ($ar as $k => $v) ...

Looking at includes/application.php, line 412 reads : foreach($item->tree as $menupath) ...




It should be:

Code:
if(is_array($item->tree)) {
  foreach($item->tree as $menupath) {
    $this->_pathway->addItem( $menus[$menupath]->name, 'index.php?Itemid='.$menupath);
  }
}


Top
   
 
Posted: Thu Jun 14, 2007 1:33 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sun Nov 06, 2005 8:49 am
Posts: 21
Thanks -- that's what I intended to see appear. Part of the code got scrambled somehow.


Top
  E-mail  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ] 

Quick reply

 



Who is online

Users browsing this forum: becyn, ianmac, Jack155Q4, jeremywilken, PommeVerte and 37 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group