Waza04 Posted January 31, 2003 Share Posted January 31, 2003 O Dear, I have another problem!! I have a problem with adminincludesclassesobject_info.php When I click on a customer in Admin I get this error, and it alos brings up a NEW customer form: Warning: reset() [function.reset]: Passed variable is not an array or object in w:intranethtdocsshopcatalogadminincludesclassesobject_info.php on line 17 Warning: Variable passed to each() is not an array or object in w:intranethtdocsshopcatalogadminincludesclassesobject_info.php on line 18 This is my file: <?php/* $Id: object_info.php,v 1.5 2002/01/30 01:14:20 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2001 osCommerce Released under the GNU General Public License */ class objectInfo { // class constructor function objectInfo($object_array) { reset($object_array); while (list($key, $value) = each($object_array)) { $this->$key = tep_db_prepare_input($value); } } } ?> I have had a simalair problem before: http://www.oscommerce.com/forums/viewtopic.php...7&highlight=key Please help guys, I really need to get this working before midnight. Cheers, Warren Ashcroft PS A reply would be grately appreciated Link to comment Share on other sites More sharing options...
Waza04 Posted February 1, 2003 Author Share Posted February 1, 2003 Anybody?? :'( I ave tears in my eyes!! :( Cheers, Warren Link to comment Share on other sites More sharing options...
rdavido Posted February 1, 2003 Share Posted February 1, 2003 Well, it looks like the function is expecting an array rather than an object, so we can check to see if the what is passed is an array. Likely it is a string being passed (though I can easily be wrong). Why not try running a quick test to see if the value is an array and, if its not, make it one: if (!is_array($object_array){ settype($object_array, "array"); } Give that a whirl. You can also try seeing what type is being passed by using the gettype function. Just make this your first statement inside the function and it should spit out what type of variable you are trying to pass to it. echo gettype($object_array); For more on these functions, visit http://www.php.net/manual/en/printwn/index.php *edit* Link to comment Share on other sites More sharing options...
rdavido Posted February 1, 2003 Share Posted February 1, 2003 you should try to backtrack to see what file is passing the variable to object_info.php, This is likely a bug that should be fixed. What php file or function is using the object_info class that is giving you the error? The variable type should be set back in whichever file is originally passing the variable to the object_info class rather than resetting the type here. It may cause other problems if this variable is propigated with the uncorrect variable type. Just tell us what you were doing that resulted in this problem. Is the function passing the variable to object_info.php a standard osCommerce script or something you edited/wrote? *edit* Link to comment Share on other sites More sharing options...
Waza04 Posted February 1, 2003 Author Share Posted February 1, 2003 When I click on a customer in Admin, it does this rather than viewing the cutomer details, so therefore it is calling this file form customers.php I think. I have not edited this file before, so I dont why it shud turn nasty, wot do you think I should do? I have edited the customers.php before though!! Cheers, Warren Link to comment Share on other sites More sharing options...
rdavido Posted February 1, 2003 Share Posted February 1, 2003 I would restart with a fresh version of the file you edited and remake your edits one by one to see what you did to kill it. It's likely a variable you created and is getting passed to object_info.php. There is nothing wrong with object_info.php, there is something wrong with the variables(s) you are passing to the object_info function from the file you are accessing that calls the function. *edit* Link to comment Share on other sites More sharing options...
Waza04 Posted February 1, 2003 Author Share Posted February 1, 2003 Hiya All, Solved the problem, this is what caused it: http://www.oscommerce.com/community/contributions,118 Any body got any ideas on how to get it to work? As this is a really usefull mod!! Cheers, Warren Ashcroft PS Im using 2.2 Link to comment Share on other sites More sharing options...
rdavido Posted February 6, 2003 Share Posted February 6, 2003 Well, I don't have that module, but I just had that problem. When I moved osCommerce from my development server to my live server, I could no longer add products and got the same error you mentioned above. I went crazy (like you) going through and seeing what the problem may be. Since everything was working on my development server, I knew it had to be because the live server was set up *somehow* differently. So I rechecked all file permissions, privileges and configuration.php, all with no luck. Then, since I run my admin section through SSL, I switched SSL for the admin section off, no change. I turned ssl back on. Hmm..., I thought, what else? The PHP CONFIGURATION for the server! I compared the php.ini files between my development server and my live server and noticed that I disallowed file uploads on the live server configuration (and you should too!). "Hmm," I ruminated, " I don't really want to let anyone upload files and since I scp (secure copy) all my files to the server I don't need it. It shouldn't make a difference, but I'll try it since its the only difference I can find between the configuration on the two servers." So I turned file_uploads = On, did a graceful apache restart and it fixed the problem. I really don't like that I have to have file_uploads on :evil: - I don't ever upload files via php, its inherently insecure. Especially if you are not doing mime-type checks, resetting permissions and making sure to turn off executable permissions (php saves them as executable files!) among other things to ensure someone is not doing something nasty. What a great way to give someone access to upload a trojan horse to your system! Hooray! :twisted: *edit* Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.