colder / php-weakref

PECL extension that implements weak references and weak maps in PHP
http://pecl.php.net/weakref
Other
36 stars 13 forks source link

Use of Weakref makes PHP development server exit on next request #28

Closed villermen closed 7 years ago

villermen commented 7 years ago

The page will be processed right, and the request will be fulfilled, but the server will exit with exit code 9 after the same page is requested again. Weakref works fine before that. I have set up a small test to confirm that it is the extension:

<?php

$obj = (object) [
    "someProperty" => "someValue"
];

$ref = new Weakref($obj);

// The following is not required for the exit to occur, but confirms that the extension works.
echo $ref->get()->someProperty;

After processing this page, the server will exit. Requesting the page again will crash the server. No error whatsoever is thrown at any point, except for the exit code. I have no idea how I would go around to get a log of an error like this.

Software:

Windows 10
PHP 7.0.11 x64 VC14 thread-safe
Weakref 0.3.2 (for PHP 7.0 TS x64)
villermen commented 7 years ago

I have just tested versions 0.3.1 and 0.3.0 of Weakref, and they also present this issue in the same environment.

colder commented 7 years ago

Thanks for this small reproducible code! This is really useful as crashes in multi-requests settings using a webserver are quite complicated to reproduce normally.

I will investigate shortly!

colder commented 7 years ago

b2a1ffe should fix this issue. I will release a new version shortly.

villermen commented 7 years ago

When is shortly? \~\~

colder commented 7 years ago

Sorry for the delay, I just released a new version on pecl.

Best,

villermen commented 7 years ago

It's been a while, but I've just remembered that I could use Weakref for my development server again. I added and included version 0.3.3 of Weakref for PHP 7.0 x64. I ran the test script I mentioned above and it still has the same result (the server stops after the first request).

villermen commented 7 years ago

Exits on same request (same test script) with

Windows 10
PHP 7.1.4 x64 VC14 TS
Weakref 0.3.3 for PHP 7.1 x64 TS