Preloading experiments with Symfony

  105958
June 17, 2019 12:58 nicolas.grekas+php@gmail.com (Nicolas Grekas)
Hello,

I experimented with preload on a small Symfony app. I have two segfaults on
my patch to make it work, reported here:
https://bugs.php.net/bug.php?id=78175

I also opened https://bugs.php.net/bug.php?id=78169 but were asked to raise
the point on the list:

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.
Would it be possible?

Thanks,
Nicolas
  106904
September 8, 2019 14:03 nicolas.grekas+php@gmail.com (Nicolas Grekas)
Hello,

I didn't get any response to my email from June 17th, yet I think this is
pretty critical, see below.
I did not manage to make preloading with Symfony yet, see
https://bugs.php.net/78512 also?
Thanks for considering, the behavior is unexpected to me, as it deviates
from common behavior.

I opened https://bugs.php.net/bug.php?id=78169 but were asked to raise the
> point on the list: > > 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. > Would it be possible? > > Thanks, > Nicolas >