[PHP-DEV] What ZEND_ACC_ALLOW_STATIC is supposed to do

2014-12-15 Thread Tjerk Meesters
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



Re: [PHP-DEV] What ZEND_ACC_ALLOW_STATIC is supposed to do

2014-12-15 Thread Rowan Collins
On 16 December 2014 00:56:43 GMT, Tjerk Meesters tjerk.meest...@gmail.com 
wrote:
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?

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?


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php