11<?php
2+
23/**
34 * This file is part of PHPDebugConsole
45 *
@@ -73,7 +74,7 @@ public static function register($pathsExclude = array())
7374 a) want to make sure we modify required files
7475 b) don't want to cache modified files
7576 */
76- \ini_set ('opcache.enable ' , 0 );
77+ \ini_set ('opcache.enable ' , ' 0 ' );
7778 }
7879
7980 /**
@@ -428,7 +429,7 @@ public function stream_read($count)
428429 $ isRequire = !\in_array ($ backtrace [1 ]['function ' ], array ('file_get_contents ' ));
429430 if (!$ this ->declaredTicks && $ isRequire ) {
430431 foreach (self ::$ pathsExclude as $ excludePath ) {
431- if (\strpos ($ this ->filepath , $ excludePath. DIRECTORY_SEPARATOR ) === 0 ) {
432+ if (\strpos ($ this ->filepath , $ excludePath . DIRECTORY_SEPARATOR ) === 0 ) {
432433 $ this ->declaredTicks = true ;
433434 }
434435 }
@@ -444,7 +445,7 @@ public function stream_read($count)
444445 $ this ->declaredTicks = true ;
445446 self ::$ filesModified [] = $ this ->filepath ;
446447 }
447- $ buffer = $ this ->bufferPrepend . $ buffer ;
448+ $ buffer = $ this ->bufferPrepend . $ buffer ;
448449 $ bufferLenAfter = \strlen ($ buffer );
449450 $ diff = $ bufferLenAfter - $ bufferLen ;
450451 $ this ->bufferPrepend = '' ;
@@ -478,6 +479,40 @@ public function stream_seek($offset, $whence = SEEK_SET)
478479 return $ success ;
479480 }
480481
482+ /**
483+ * Change stream options
484+ *
485+ * @param integer $option [description]
486+ * @param integer $arg1 [description]
487+ * @param integer $arg2 [description]
488+ *
489+ * @return boolean
490+ */
491+ public function stream_set_option ($ option , $ arg1 , $ arg2 )
492+ {
493+ if (!$ this ->handle || \get_resource_type ($ this ->handle ) !== 'stream ' ) {
494+ \trigger_error (\sprintf ('The "$handle" property of "%s" need to be a stream. ' , __CLASS__ ), E_USER_WARNING );
495+ return false ;
496+ }
497+ self ::restorePrev ();
498+ switch ($ option ) {
499+ case STREAM_OPTION_BLOCKING :
500+ $ return = \stream_set_blocking ($ this ->handle , $ arg1 );
501+ break ;
502+ case STREAM_OPTION_READ_TIMEOUT :
503+ $ return = \stream_set_timeout ($ this ->handle , $ arg1 , $ arg2 );
504+ break ;
505+ case STREAM_OPTION_WRITE_BUFFER :
506+ $ return = \stream_set_write_buffer ($ this ->handle , $ arg1 );
507+ break ;
508+ default :
509+ \trigger_error (\sprintf ('The option "%s" is unknown for "stream_set_option" method ' , $ option ), E_ERROR );
510+ $ return = false ;
511+ }
512+ self ::register ();
513+ return $ return ;
514+ }
515+
481516 /**
482517 * Retrieve information about a file resource
483518 *
0 commit comments