# What ZEND_ACC_ALLOW_STATIC is supposed to do

- Thread: https://externals.io/message/79682
- Original archive: https://news-web.php.net/php.internals/79682
- Started by Tjerk Meesters on 2014-12-16T00:56:43+00:00
- Messages: 2
- 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

---

## #79682 — Tjerk Meesters — 2014-12-16T00:56:43+00:00

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

Hi,

I was looking at the documentation for DOMDocument::loadHTML() [1] that mentions the following:

> This function may also be called statically to load and create a DOMDocument object. The static invocation may be used when no DOMDocument properties need to be set prior to loading.

However, this can’t be done in strict mode [2]:

> Strict Standards: Non-static method DOMDocument::loadHTML() should not be called statically in …

This behaviour seems to be intended when ZEND_ACC_ALLOW_STATIC is used [3] and can be fixed by using ZEND_ACC_STATIC instead.

My questions:

1) Is that the right kind of fix? 
2) Is ZEND_ACC_ALLOW_STATIC meant to be used only for BC? If not, why are we raising strict errors?


[1] http://php.net/manual/en/domdocument.loadhtml.php <http://php.net/manual/en/domdocument.loadhtml.php>
[2] http://3v4l.org/JC7p0#v500 <http://3v4l.org/JC7p0#v500>
[3] http://lxr.php.net/xref/PHP_5_5/Zend/zend_vm_def.h#1935 <http://lxr.php.net/xref/PHP_5_5/Zend/zend_vm_def.h#1935

---

## #79683 — Rowan Collins — 2014-12-16T01:19:10+00:00

URL: https://externals.io/message/79682#79683 · In reply to: #79682

>Hi,
>
>I was looking at the documentation for DOMDocument::loadHTML() [1] that
>mentions the following:
>
> > […]
>DOMDocument object. The static invocation may be used when no
>DOMDocument properties need to be set prior to loading.
>
>However, this can’t be done in strict mode [2]:
>
> > […]
>not be called statically in …
>
>This behaviour seems to be intended when ZEND_ACC_ALLOW_STATIC is used
>[3] and can be fixed by using ZEND_ACC_STATIC instead.
>
>My questions:
>
>1) Is that the right kind of fix? 
>2) Is ZEND_ACC_ALLOW_STATIC meant to be used only for BC? If not, why
>are we raising strict errors?

Surely that's just the same as a userland method which happens not to use $this ("allow static") and one marked "static" so *must* be called statically?
