Page 1 of 1
Warning: Invalid error type specified - showing in output
Posted: Thu Nov 11, 2010 3:18 am
by nidheeshchandran
am getting this warning "Warning: Invalid error type specified " for this php line
Code: Select all
trigger_error('Please use the locale view helper: $view->locale()->toDateTime()', 'E_USER_DEPRECATED');
pls help .. thanks.
Re: Warning: Invalid error type specified - showing in outpu
Posted: Thu Nov 11, 2010 3:26 am
by VladSun
Re: Warning: Invalid error type specified - showing in outpu
Posted: Thu Nov 11, 2010 8:34 am
by nidheeshchandran
am a newbie

.. can u pls tell what changes shd i do in that code ?

Re: Warning: Invalid error type specified - showing in outpu
Posted: Thu Nov 11, 2010 2:01 pm
by VladSun
You're a newbie - so read some manuals
http://php.net/manual/en/function.trigger-error.php
Take a look at the examples - it's easy isn't it

Re: Warning: Invalid error type specified - showing in outpu
Posted: Thu Nov 11, 2010 3:17 pm
by nidheeshchandran
thanks .. but i dint understood
do u mean this one
Code: Select all
trigger_error('Please use the locale view helper: $view->locale()->toDateTime()', E_USER_DEPRECATED);
but in that way am getting 2 errors.
Notice: Use of undefined constant E_USER_DEPRECATED - assumed 'E_USER_DEPRECATED'
Warning: Invalid error type specified
and that's why i changed E_USER_DEPRECATED to 'E_USER_DEPRECATED'
Re: Warning: Invalid error type specified - showing in outpu
Posted: Thu Nov 11, 2010 3:51 pm
by VladSun
E_USER_DEPRECATED (integer) User-generated warning message. This is like an E_DEPRECATED, except it is generated in PHP code by using the PHP function trigger_error(). since PHP 5.3.0
Re: Warning: Invalid error type specified - showing in outpu
Posted: Thu Nov 11, 2010 3:53 pm
by cpetercarter
E_USER_DEPRECATED is available only in php 5.3.0 + . I guess you are using an earlier php version.
You get 2 error messages. The first tells you that there is no constant E_USER_DEPRECATED (see above)
Then php says "Well maybe he meant to use a string 'E_USER_DEPRECATED'", and tries it. And that produces the second error message, which says in effect "you can't use a string here, you need an integer'".
Moral : you cant use trigger_error() with an error type which is not recognised by your php version.
Re: Warning: Invalid error type specified - showing in outpu
Posted: Thu Nov 11, 2010 5:30 pm
by nidheeshchandran
i had used another error type E_WARNING
so now first error msg gone .. .but the 2nd invalid error type still shows .. i just want to hide this msg .. page load perfectly and everything fine .. i dont knw for what this error msg and why is it showing ?
can u pls tell more details .. thanks ...
Re: Warning: Invalid error type specified - showing in outpu
Posted: Thu Nov 11, 2010 5:32 pm
by nidheeshchandran
Code: Select all
trigger_error('Please use the locale view helper: $view->locale()->toDateTime()', E_WARNING);
now am using this .. but still it show one warning "Warning: Invalid error type specified"
i want to hide this warning .. what can i do .. sorry for the double post i forget to post the script
Re: Warning: Invalid error type specified - showing in outpu
Posted: Thu Nov 11, 2010 5:44 pm
by VladSun
http://php.net/manual/en/function.trigg ... .php[quote] Parameters
error_type
The designated error type for this error.
It only works with the E_USER family of constants, and will default to E_USER_NOTICE.[/quote]
RTFM! You wasted 12 hours trying to make it work instead of reading the manual for 5 minutes ...
Re: Warning: Invalid error type specified - showing in outpu
Posted: Fri Nov 12, 2010 5:40 am
by nidheeshchandran
actually what i need is remove that warning from output .. and i waste my time .. i deleted that line
Code: Select all
trigger_error('Please use the locale view helper: $view->locale()->toDateTime()', E_WARNING);
and now everything fine ..
thats all i need .. thanks ..
actually can u tell for what this trigger error for ?