# Undefined property notice

- Thread: https://externals.io/message/31732
- Original archive: https://news-web.php.net/php.internals/31732
- Started by Jakub Vrana on 2007-08-20T10:20:42+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #31732 — Jakub Vrana — 2007-08-20T10:20:42+00:00

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

PHP have the Undefined variable/property notice to inform a programmer
about using uninitialized variables/properties. While both $b = $b + 5
and $c += 5 issues the notice (and also $a["b"] = $a["b"] + 5 and
$a["c"] += 5 in case of arrays), in case of objects only $o->b = $o->b + 5
issues the notice but $o->c += 5 not. Shouldn't be the notice issued
also with $o->c += 5? It is clearly usage of an undefined property.

Jakub Vrana

---

## #31733 — Derick Rethans — 2007-08-20T10:48:26+00:00

URL: https://externals.io/message/31732#31733 · In reply to: #31732

> PHP have the Undefined variable/property notice to inform a programmer
> about using uninitialized variables/properties. While both $b = $b + 5
> and $c += 5 issues the notice (and also $a["b"] = $a["b"] + 5 and
> $a["c"] += 5 in case of arrays), in case of objects only $o->b = $o->b + 5
> issues the notice but $o->c += 5 not. Shouldn't be the notice issued
> also with $o->c += 5? It is clearly usage of an undefined property.

I'd say it should.

Derick

---

## #31734 — Scott MacVicar — 2007-08-20T11:15:33+00:00

URL: https://externals.io/message/31732#31734 · In reply to: #31732

I had always assumed this was down to the use of __set

class foo
{
	function __set($var, $value) { }
}

$o = new foo;
$o->b = $o->b + 5;
$o->c += 5;

Displays the exact same properties.

Scott

Jakub Vrana wrote:
> PHP have the Undefined variable/property notice to inform a programmer
> about using uninitialized variables/properties. While both $b = $b + 5
> and $c += 5 issues the notice (and also $a["b"] = $a["b"] + 5 and
> $a["c"] += 5 in case of arrays), in case of objects only $o->b = $o->b + 5
> issues the notice but $o->c += 5 not. Shouldn't be the notice issued
> also with $o->c += 5? It is clearly usage of an undefined property.
> 
> Jakub Vrana
