Bug #78169 [Sus]: preloading + require vs fatal error

From: Date: Tue, 10 Sep 2019 09:17:57 +0000
Subject: Bug #78169 [Sus]: preloading + require vs fatal error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222679@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78169&edit=1

 ID:                 78169
 Updated by:         dmitry@php.net
 Reported by:        nicolas dot grekas+php at gmail dot com
 Summary:            preloading + require vs fatal error
 Status:             Suspended
 Type:               Bug
 Package:            opcache
 PHP Version:        7.4.0alpha1
 Block user comment: N
 Private report:     N

 New Comment:

Please provide a simple test case with expected and actual behavior.


Previous Comments:
------------------------------------------------------------------------
[2019-06-15 02:21:28] requinix@php.net

This matter would probably be better suited for the internals list.

------------------------------------------------------------------------
[2019-06-14 21:20:55] nicolas dot grekas+php at gmail dot com

Description:
------------
When opcache.preload is used, requiring twice a file that declares a preloaded class will not yield
any error, while when preloading is not used, one will get a cannot redeclare error.

On the other side, when require_once is used, a preloaded class file is not considered "already
loaded", which means the require happens during execution.

Would it make sense to change both these behaviors to make them more in line with normal engine
behavior?

i.e. "require_once" on a file that was already preloaded wouldn't require it again,
and "require" on a preloaded file that contains a class declaration would yield a
"cannot redeclare" fatal error?

This would be more expected to me. WDYT?



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=78169&edit=1


Thread (3 messages)

« previous php.bugs (#222679) next »