misleading error message

misleading error message

am 13.01.2008 04:56:14 von Peter Pei

Try the following to see it
class A {
}
function foo(A $a = 1) {
;
}
foo();
?>

Re: misleading error message

am 13.01.2008 04:58:40 von Peter Pei

am using .2.5

Re: misleading error message

am 13.01.2008 05:01:00 von seaside

On 13 Jan., 04:56, "Peter Pei" wrote:

> Try the following to see it
> > =A0class A {
> =A0}
> =A0function foo(A $a =3D 1) {
> =A0 ;
> =A0}
> =A0foo();
> ?>

I get this, which isn't missleading:

>>>
Fatal error: Default value for parameters with a class type hint can
only be NULL in /Applications/MAMP/htdocs/compile/includes/
CParser.inc.php on line 12
<<<

Re: misleading error message

am 13.01.2008 05:03:51 von seaside

On 13 Jan., 05:01, seaside wrote:
> On 13 Jan., 04:56, "Peter Pei" wrote:
>
> > Try the following to see it
> > > > =A0class A {
> > =A0}
> > =A0function foo(A $a =3D 1) {
> > =A0 ;
> > =A0}
> > =A0foo();
> > ?>
>
> I get this, which isn't missleading:

. since you can't pass anything else.

Re: misleading error message

am 13.01.2008 05:04:42 von seaside

On 13 Jan., 05:01, seaside wrote:
> On 13 Jan., 04:56, "Peter Pei" wrote:
>
> > Try the following to see it
> > > > =A0class A {
> > =A0}
> > =A0function foo(A $a =3D 1) {
> > =A0 ;
> > =A0}
> > =A0foo();
> > ?>
>
> I get this, which isn't missleading:

.. since you can't define any other default value [sorry, typo in my
previous posting]

Re: misleading error message

am 13.01.2008 05:05:32 von Jerry Stuckle

Peter Pei wrote:
> Try the following to see it
> > class A {
> }
> function foo(A $a = 1) {
> ;
> }
> foo();
> ?>
>

So, what is your error? I'm not necessarily running the same version as
you.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: misleading error message

am 13.01.2008 05:07:42 von Peter Pei

right, my screen cut off part of the msg ;-)

Re: misleading error message

am 13.01.2008 09:16:13 von radmission05

On Jan 12, 7:56 pm, "Peter Pei" wrote:
> Try the following to see it
> > class A {
> }
> function foo(A $a = 1) {
> ;
> }
> foo();
> ?>

i dont see code like this before, try the following.. hope this will
help.. :P

class A {
var $val;
function A($value)
{
$this->val = $val;
}
}

function foo(new A(1))
{
print $a->val
}

foo();
?>

Re: misleading error message

am 13.01.2008 09:17:49 von radmission05

On Jan 13, 12:16 am, "radmissio...@gmail.com"
wrote:
> On Jan 12, 7:56 pm, "Peter Pei" wrote:
>
> > Try the following to see it
> > > > class A {
> > }
> > function foo(A $a = 1) {
> > ;
> > }
> > foo();
> > ?>
>
> i dont see code like this before, try the following.. hope this will
> help.. :P
>
> > class A {
> var $val;
> function A($value)
> {
> $this->val = $val;
>
> }
> }
>
> function foo(new A(1))
> {
> print $a->val
>
> }
>
> foo();
> ?>

im not familiar with the versions.. :P