The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Invalid Argument Foreach (Admin-pages)
#1
Hey guys,

So having a weird issue, just popped up today and haven't noticed it before.

[Image: 2af3cd8047.png]

On admin-pages.php I am receiving the following error:

Quote:Warning: Invalid argument supplied for foreach() in /#PATH#/admin-pages.php on line 33

The code it's referring to is the part that lists all the php files:

Code:
//Get list of php files for each $path
Code:
foreach ($paths as $path){
Code:
$rows=getPathPhpFiles($abs_us_root,$us_url_root,$path);
Code:
foreach ($rows as $row){
Code:
$pages[]=$row;
Code:
}
Code:
}


As far as I know I haven't changed anything that would effect this, and as you can see in the screenshot, the page is working as intended. I can still manage all the pages and they are all listed properly. Anyone run in to this before?
  Reply
#2
I guess the files to check first are have you modified us_helpers.php or more likely z_us_root.php?
  Reply
#3
Checked both files, I haven't modified anything in them. Went back through my repos commit history to see if I accidentally made a change I shouldn't have, couldn't find anything. Though I am sure I have done something somewhere haha, I would assume this wouldn't just appear out of nowhere.

I have solved it (I think) though. Just made a small re-write to the argument and the error has disappeared and everything still appears to be functioning as intended. Here's my new foreach statement:

Code:
foreach ($paths as $path){
Code:
$rows=getPathPhpFiles($abs_us_root,$us_url_root,$path);
Code:
foreach ((array)$rows as $row){
Code:
$pages[]=$row;
Code:
}
Code:
}
  Reply
#4
Hmmmm. That's very weird. I can't really think about what could have caused that, but I'm glad you figured it out!
  Reply
#5
Hi
This was happening for me as well, and the (array) cast also fixed it.
May be it's some level of debug\error log in PHP.ini perhaps that makes it show up?
Cheers
Chris
  Reply
#6
I'm working on pushing out the final beta of 4.2 so I'll include that.
  Reply
#7
I just put this in 4.2.0

Thanks for the code
  Reply
#8
Oh do I ever love that Dashboard! (sorry had to share)
  Reply
#9
I'm working with picassoo (and anyone else who is interested to give 4.2 a CSS refresh. I'm not a css wizard, so I'm open to ideas.
  Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)