# Bug in namespaces and type hints

- Thread: https://externals.io/message/41788
- Original archive: https://news-web.php.net/php.internals/41788
- Started by Marcin Kurzyna on 2008-11-10T01:08:04+00:00
- Messages: 4
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #41788 — Marcin Kurzyna — 2008-11-10T01:08:04+00:00

URL: https://externals.io/message/41788#41788

Hi, 
recent change in namespace code introduced new bug, please consider:

<?php
  namespace tests;

  class t1 {
    function abc(\stdClass $std = null) {
    }
  }
?>

triggers "Fatal error: Default value for parameters with a class type hint can only be NULL" where the same w/o namespace definition works as 
expected (no error). 

this is tested with currently newest snap: 2008.11.09 23:30 (UTC)

I haven't filed bug report for this yet i'll do it if required.

TIA for quick fix ;-)
Marcin Kurzyna

---

## #41789 — Stanislav Malyshev — 2008-11-10T04:10:06+00:00

URL: https://externals.io/message/41788#41789 · In reply to: #41788

Hi!

> recent change in namespace code introduced new bug, please consider:

Current code needs some change and cleanup, which will be done shortly.

-- 
Stanislav Malyshev, Zend Software Architect
stas@zend.com   http://www.zend.com/
(408)253-8829   MSN: stas@zend.com

---

## #41817 — Felipe Pena — 2008-11-10T12:14:17+00:00

URL: https://externals.io/message/41788#41817 · In reply to: #41788

2008/11/9 Marcin Kurzyna <m.kurzyna@crystalpoint.pl>:
> Hi,
> recent change in namespace code introduced new bug, please consider:
>
> <?php
>  namespace tests;
>
>  class t1 {
>    function abc(\stdClass $std = null) {
>    }
>  }
> ?>
>
> triggers "Fatal error: Default value for parameters with a class type hint can only be NULL" where the same w/o namespace definition works as
> expected (no error).
>
> this is tested with currently newest snap: 2008.11.09 23:30 (UTC)
>
> I haven't filed bug report for this yet i'll do it if required.
>

Nice Marcin!
I have added 4 new tests about that issue, that wasn't detected with
the current tests.

Thanks.

-- 
Regards,
Felipe Pena.

---

## #41853 — Timm Friebe — 2008-11-11T13:36:42+00:00

URL: https://externals.io/message/41788#41853 · In reply to: #41788

Hi,

> recent change in namespace code introduced new bug, please consider:
>
> <?php
>  namespace tests;
>
>  class t1 {
>    function abc(\stdClass $std = null) {
>    }
>  }
> ?>
>
> triggers "Fatal error: Default value for parameters with a class type hint 
> can only be NULL"
> where the same w/o namespace definition works as expected (no error).

http://sitten-polizei.de/php/zend-constants-lookup.diff might be a possible 
fix for this.

- Timm
