misleading error message

Try the following to see it
<?php
class A {
}
function foo(A $a = 1) {
;
}
foo();
?>
Peter Pei [ So, 13 Januar 2008 04:56 ] [ ID #1906685 ]

Re: misleading error message

am using .2.5
Peter Pei [ So, 13 Januar 2008 04:58 ] [ ID #1906686 ]

Re: misleading error message

On 13 Jan., 04:56, "Peter Pei" <yan... [at] telus.com> wrote:

> Try the following to see it
> <?php
> =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
<<<
seaside [ So, 13 Januar 2008 05:01 ] [ ID #1906687 ]

Re: misleading error message

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

=2E. since you can't pass anything else.
seaside [ So, 13 Januar 2008 05:03 ] [ ID #1906688 ]

Re: misleading error message

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

=2E.. since you can't define any other default value [sorry, typo in my
previous posting]
seaside [ So, 13 Januar 2008 05:04 ] [ ID #1906689 ]

Re: misleading error message

Peter Pei wrote:
> Try the following to see it
> <?php
> 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 [at] attglobal.net
==================
Jerry Stuckle [ So, 13 Januar 2008 05:05 ] [ ID #1906691 ]

Re: misleading error message

right, my screen cut off part of the msg ;-)
Peter Pei [ So, 13 Januar 2008 05:07 ] [ ID #1906692 ]

Re: misleading error message

On Jan 12, 7:56 pm, "Peter Pei" <yan... [at] telus.com> wrote:
> Try the following to see it
> <?php
> class A {
> }
> function foo(A $a = 1) {
> ;
> }
> foo();
> ?>

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

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

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

foo();
?>
radmission05 [ So, 13 Januar 2008 09:16 ] [ ID #1906702 ]

Re: misleading error message

On Jan 13, 12:16 am, "radmissio... [at] gmail.com" <radmissio... [at] gmail.com>
wrote:
> On Jan 12, 7:56 pm, "Peter Pei" <yan... [at] telus.com> wrote:
>
> > Try the following to see it
> > <?php
> > class A {
> > }
> > function foo(A $a = 1) {
> > ;
> > }
> > foo();
> > ?>
>
> i dont see code like this before, try the following.. hope this will
> help.. :P
>
> <?php
> 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
radmission05 [ So, 13 Januar 2008 09:17 ] [ ID #1906703 ]
PHP » comp.lang.php » misleading error message

Vorheriges Thema: Session Problem
Nächstes Thema: highlight_file() strange line breaks