You are here: Re: [PHP] Re: User error handler must not modify error context « PHP « IT news, forums, messages
Re: [PHP] Re: User error handler must not modify error context

Posted by Robert Cummings on 09/20/05 06:23

On Mon, 2005-09-19 at 23:09, Jasper Bryant-Greene wrote:
> Noel wrote:
> > Actually, that's all of it aside from the function statement and the
> > return statement.
> >
> > function funcTitle ($title='') {
> > global $mywebsite;
> > if ($_POST['title']) $title = $_POST['title'];
> > elseif ($_GET['title']) $title = $_GET['title'];
> > elseif (!$title) $title = $mywebsite;
> > return '<title>'.$title.'</title>';
> > }
> >
> > I don't see anything wrong with the code, do you? After all, the error
> > does not occur if I try to comment out the user_error_handler()
> > function. And also, this error didn't occur in the previous version.
> > Nothing has been modified in the PHP codes when the PHP version has been
> > upgraded to 4.4. Only after the upgrade did this error occurred.

Check your error reporting level. Your code above is sloppy since you
don't bother checking to see if the title entry exists in the $_POST or
$_GET arrays first.

function funcTitle( $title='' )
{
global $mywebsite;

if( isset( $_POST['title'] ) && $_POST['title'] )
{
$title = $_POST['title'];
}
else
if( isset( $_GET['title'] ) && $_GET['title'] )
{
$title = $_GET['title'];
}
else
if( !$title )
{
$title = $mywebsite;
}

return '<title>'.$title.'</title>';
}

Cheers,
Rob.
--
..------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация