Something strange happening with arrays
Posted: Wed Jul 26, 2006 9:58 am
I am trying to load Wordpress onto a linux server. When I execute the following 'for each':
print_r($this->roles);
foreach ($this->roles as $role => $data) {
I get:
Warning: Invalid argument supplied for foreach() in /home/ourposition/blogs/wp-includes/capabilities.php on line 19
so I added the print_r, to see what was in the 'roles' array. Here is what I get (abbreviated):
a:5:{s:13:\"administrator\";a:2:{s:4:\"name\";s:13:\"Administrator\";s:12:\"capabilities\";a:30:{s:13:\"switch_themes\";b:1;s:11:\"edit_themes\";b:1;s:16:\"activate_plugins\";b:1;s:12:\
so I run EXACTLY the same code on my local XP system. First, no warning, and as you would expect the print_r looks like this (abbreviated):
Array ( [administrator] => Array ( [name] => Administrator [capabilities] => Array ( [switch_themes] => 1 [edit_themes] => 1 [activate_plugins] => 1 [edit_plugins] => 1 [edit_users] => 1 [edit_files] => 1 [manage_options] => 1 [moderate_comments] => 1 [manage_categories] => 1
It looks like, under linux, the print_r is dumping out a "internal" format of the array. Is this an indication of what the problem is?
Thanks for any help because the Wordpress install is "virgin"; i.e., no changes, and the Wordpress people brag about how it is a "foolproof" installation that takes a matter of minutes. Nope!
Larry Woods
print_r($this->roles);
foreach ($this->roles as $role => $data) {
I get:
Warning: Invalid argument supplied for foreach() in /home/ourposition/blogs/wp-includes/capabilities.php on line 19
so I added the print_r, to see what was in the 'roles' array. Here is what I get (abbreviated):
a:5:{s:13:\"administrator\";a:2:{s:4:\"name\";s:13:\"Administrator\";s:12:\"capabilities\";a:30:{s:13:\"switch_themes\";b:1;s:11:\"edit_themes\";b:1;s:16:\"activate_plugins\";b:1;s:12:\
so I run EXACTLY the same code on my local XP system. First, no warning, and as you would expect the print_r looks like this (abbreviated):
Array ( [administrator] => Array ( [name] => Administrator [capabilities] => Array ( [switch_themes] => 1 [edit_themes] => 1 [activate_plugins] => 1 [edit_plugins] => 1 [edit_users] => 1 [edit_files] => 1 [manage_options] => 1 [moderate_comments] => 1 [manage_categories] => 1
It looks like, under linux, the print_r is dumping out a "internal" format of the array. Is this an indication of what the problem is?
Thanks for any help because the Wordpress install is "virgin"; i.e., no changes, and the Wordpress people brag about how it is a "foolproof" installation that takes a matter of minutes. Nope!
Larry Woods