p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional PHP Design Patterns (http://p2p.wrox.com/forumdisplay.php?f=513)
-   -   Chapt 22 - manage.php (http://p2p.wrox.com/showthread.php?t=82462)

harpua February 2nd, 2011 03:21 PM

Chapt 22 - manage.php
 
On my server I have notices turned on, I was noticing that I get the following errors when I select the "Add User" link from the users page.

Code:

Notice: Undefined index: user in /views/default/users/manage.php on line 8
Notice: Undefined index: user in /views/default/users/manage.php on line 14
Notice: Trying to get property of non-object in /views/default/users/manage.php on line 14
Notice: Undefined index: user in /views/default/users/manage.php on line 27
Notice: Trying to get property of non-object in /views/default/users/manage.php on line 27

I have gone in and added isset($view['user']) functions throughout the code, is there a better way to handle this?

AaronSaray February 2nd, 2011 06:43 PM

Probably using isset() is the best solution. You could also make some sort of dynamic object with magic methods to return blank when queried, but that's way overkill. Good catch!


All times are GMT -4. The time now is 10:35 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.