misleading error message
Try the following to see it
<?php
class A {
}
function foo(A $a = 1) {
;
}
foo();
?>
Re: misleading error message
am using .2.5
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
<<<
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.
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]
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
==================
Re: misleading error message
right, my screen cut off part of the msg ;-)
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();
?>
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