Page MenuHomePhabricator

AASTNode in libphutil missing tokenCache declaration
Closed, ResolvedPublic

Description

libphutil/src/parser/aast/api/AASTNode.php has a tokenCache attribute which is not declared. This causes selectTokensOfTypes to miss the cache every time.

Steps to reproduce:

Event Timeline

Specifically, the issue is that this class extends Phobject, which implements __set() and throws when an undeclared property is written to. The exception is swallowed elsewhere in the stack.

This was likely introduced accidentally by 3ff84448; the cache presumably functioned before then. Declaring this property would not be necessary without the inherited implementation of __set().

epriestley triaged this task as Normal priority.
epriestley added a project: Infrastructure.

D15358 should fix this by declaring the property. Nice catch on finding this!

Why not change Phobject::__isset and Phobject::__unset to throw an exception in the same way that Phobject::__get and Phobject::__set do?

I think that would be reasonable.