Maybe bug in Nette SafeStream

steelbull
Member | 240
+
0
-

Hi, I found a following failure in Nette 2.4:

THX for solve bug : -)

Failure description:

The bug is relevant only for PHP7 and higher version (PHP 5.6 runs without failure). After some days or weeks of nonstop running of PHP server, all newly updated Nette apps will crash and display error message (see Symptoms).
…but older non-updated nette 2.4 apps running on same server are working. Also another non-nette apps also working. After restart of the server, problem is solved.

Symptoms:

Warning: require(): file:// wrapper is disabled in the server configuration in D:\_SERVER_DATA\_web\rwa\vendor\composer\autoload_real.php on line 66

Warning: require(D:\_SERVER_DATA\_web\rwa\vendor\symfony\polyfill-mbstring\bootstrap.php): failed to open stream: no suitable wrapper could be found in D:\_SERVER_DATA\_web\rwa\vendor\composer\autoload_real.php on line 66

Fatal error: require(): Failed opening required 'D:\_SERVER_DATA\_web\rwa\vendor\composer/../symfony/polyfill-mbstring/bootstrap.php' (include_path='.;C:/_SERVER/php71/') in D:\_SERVER_DATA\_web\rwa\vendor\composer\autoload_real.php on line 66

Failure analysis:

I found problem on autoload_real.php on line 66, where is following line require($file) inside foreach cycle. Autoload real is loading all files until loader.php (Nette SafeStream).
Loader.php is loaded, but after register of SafeStream (Nette\Utils\SafeStream::register()) something will broke and autoload cannot continue in loading files and display error (see Symptoms).

Server:

Build Date 	Jan 2 2018 13:46:49
Compiler 	MSVC14 (Visual C++ 2015)
Architecture 	x86
Configure Command 	cscript /nologo configure.js "--enable-snapshot-build" "--enable-debug-pack" "--with-pdo-oci=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--with-oci8-12c=c:\php-sdk\oracle\x86\instantclient_12_1\sdk,shared" "--enable-object-out-dir=../obj/" "--enable-com-dotnet=shared" "--with-mcrypt=static" "--without-analyzer" "--with-pgo"
Server API 	Apache 2.0 Handler
Virtual Directory Support 	enabled
Configuration File (php.ini) Path 	C:\Windows
Loaded Configuration File 	C:\_SERVER\php71\php.ini
Scan this dir for additional .ini files 	(none)
Additional .ini files parsed 	(none)
PHP API 	20151012
PHP Extension 	20151012
Zend Extension 	320151012
Zend Extension Build 	API320151012,TS,VC14
PHP Extension Build 	API20151012,TS,VC14
Debug Build 	no
Thread Safety 	enabled
Zend Signal Handling 	disabled
Zend Memory Manager 	enabled
Zend Multibyte Support 	provided by mbstring
IPv6 Support 	enabled
DTrace Support 	disabled
Registered PHP Streams	php, 0, glob, data, http, ftp, zip, compress.zlib, compress.bzip2, https, ftps, phar
Registered Stream Socket Transports	tcp, udp, ssl, sslv3, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters	convert.iconv.*, mcrypt.*, mdecrypt.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.*, bzip2.*
hacafrakus
Member | 14
+
+1
-

Seems like a PHP bug to me. Your file wrapper gets renamed to 0 for whatever reason.

I suggest:

  • remove nette/safe-stream package unless you actually need it,
  • if some other package requires it, try to downgrade it to <2.3.0 where wrapper wasn't registered automatically,
  • might be related to 2.3.2 release, so
    • upgrade to ^2.3.2
    • or downgrade to <2.3.2
steelbull
Member | 240
+
0
-

Yes, I already do this. Also I agree, that problem can be in PHP7. I writed this issue, because I lost much time to found this problem. Also I writed more discuss threads to the Nette forum, but It was complicated to explain and nobody found an answer. Therefore this thread can help for users with will catch similar problem, like me.

THX :-)

hacafrakus wrote:

Seems like a PHP bug to me. Your file wrapper gets renamed to 0 for whatever reason.

I suggest:

  • remove nette/safe-stream package unless you actually need it,
  • if some other package requires it, try to downgrade it to <2.3.0 where wrapper wasn't registered automatically,
  • might be related to 2.3.2 release, so
    • upgrade to ^2.3.2
    • or downgrade to <2.3.2