diff --git a/app/Console/Commands/PMTranslationsPlugins.php b/app/Console/Commands/PMTranslationsPlugins.php new file mode 100644 index 000000000..1a6f5b41c --- /dev/null +++ b/app/Console/Commands/PMTranslationsPlugins.php @@ -0,0 +1,210 @@ +pluginsPath = realpath(base_path() . DIRECTORY_SEPARATOR . "workflow" . DIRECTORY_SEPARATOR . "engine" . DIRECTORY_SEPARATOR . "plugins"); + } + + /** + * Execute the console command. + */ + public function handle() + { + $pluginNames = $this->option('name'); + $processAll = $this->option('all'); + $processType = $this->option('type'); + $directoryPlugins = []; + if ($processAll) { + $directoryPlugins = $this->filterFiles(array_diff(scandir($this->pluginsPath), ['..', '.'])) ?: []; + } elseif ($pluginNames) { + $directoryPlugins = $pluginNames; + } else { + $this->comment("Please use the --all option or introduce the plugin name (--name=namePlugin)"); + return; + } + $this->info('Start converting'); + $bar = $this->output->createProgressBar(count($directoryPlugins)); + foreach ($directoryPlugins as $name) { + if ($processType == 'po') { + $this->generateI18nFromPoFiles($name); + } elseif ($processType == 'laravel') { + $this->generateI18nFromLaravelLang($name); + } + $bar->advance(); + } + $bar->finish(); + $this->info("\nFinish"); + } + + /** + * Generate files i18n from .po. + * + * @param object $pluginName + * @return void + */ + private function generateI18nFromPoFiles($pluginName) + { + $pluginPath = $this->pluginsPath . DIRECTORY_SEPARATOR . $pluginName; + if (is_dir($pluginPath)) { + // Translate for files .po in plugin + $translationsDirectory = $pluginPath . DIRECTORY_SEPARATOR . 'translations'; + $scannedDirectory = is_dir($translationsDirectory) ? array_diff(scandir($translationsDirectory), ['..', '.']) : null; + if ($scannedDirectory) { + $this->i18next = new I18Next(); + foreach ($scannedDirectory as $index => $item) { + $filePath = $translationsDirectory . DIRECTORY_SEPARATOR . $item; + $pathParts = pathinfo($filePath); + $isPofile = !empty($pathParts['extension']) && $pathParts['extension'] === 'po'; + + if ($isPofile) { + $basename = explode('.', $pathParts['basename']); + $language = $basename[1]; + + $this->i18next->setLanguage($language); + + //read file .po + $str = new stdClass(); + $poFile = new i18n_PO($filePath); + $poFile->readInit(); + while ($translation = $poFile->getTranslation()) { + $translatorComments = $poFile->translatorComments; + $references = $poFile->references; + + $ifContinue = empty($translatorComments[0]) && empty($translatorComments[1]) && empty($references[0]); + if ($ifContinue) { + continue; + } + $ifNotTranslation = !($translatorComments[0] === 'TRANSLATION'); + if ($ifNotTranslation) { + continue; + } + $key = explode("/", $translatorComments[1]); + $str->{$key[1]} = $translation['msgstr']; + } + $this->i18next->setPlugin($language, $pluginName, $str); + } + } + $this->saveFileJs($pluginName); + } + } + } + + /** + * Generate files i18n from resource/lang/*. + * + * @param $pluginName + * @return void + */ + private function generateI18nFromLaravelLang($pluginName) + { + $pluginPath = $this->pluginsPath . DIRECTORY_SEPARATOR . $pluginName; + if (is_dir($pluginPath)) { + // Translate for files resources/lang in plugin + $translationsDirectory = $pluginPath . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'lang'; + $scannedDirectory = is_dir($translationsDirectory) ? array_diff(scandir($translationsDirectory), ['..', '.']) : null; + if ($scannedDirectory) { + $this->i18next = new I18Next(); + foreach ($scannedDirectory as $lang) { + $dirLanguage = $pluginPath . DIRECTORY_SEPARATOR . 'resources' . DIRECTORY_SEPARATOR . 'lang' . DIRECTORY_SEPARATOR . $lang; + $scannedLanguage = is_dir($dirLanguage) ? array_diff(scandir($dirLanguage), ['..', '.']) : []; + foreach ($scannedLanguage as $index => $item) { + $filePath = $dirLanguage . DIRECTORY_SEPARATOR . $item; + $pathParts = pathinfo($filePath); + $isPhpFile = !empty($pathParts['extension']) && $pathParts['extension'] === 'php'; + if ($isPhpFile) { + $file = explode(".", $item); + array_pop($file); + $filename = implode("_", $file); + $arrayLanguage = [$filename => require_once($dirLanguage . DIRECTORY_SEPARATOR . $item)]; + $this->i18next->setLanguage($lang); + $this->i18next->setPlugin($lang, $pluginName, json_decode(json_encode($arrayLanguage))); + } + } + } + $this->saveFileJs($pluginName); + } + } + } + + /** + * Save js file generate of translate files. + * + * @param string $pluginName + */ + private function saveFileJs($pluginName) + { + $folderToSave = $this->pluginsPath . DIRECTORY_SEPARATOR . $pluginName . DIRECTORY_SEPARATOR . "public_html" . DIRECTORY_SEPARATOR . "js"; + if (!is_dir($folderToSave)) { + $create = $this->choice('The "js" folder does not exist, Do you want to create the folder?', ['Yes', 'No'], 0); + if (strtolower($create) == 'yes') { + G::mk_dir($folderToSave, 0775); + } + } + $this->i18next->saveJs($pluginName, $folderToSave . DIRECTORY_SEPARATOR . $pluginName . ".i18n"); + } + + /** + * Remove files, return only folders. + * + * @param $scannedDirectory + * @return array + */ + private function filterFiles($scannedDirectory) + { + $onlyFolders = []; + foreach ($scannedDirectory as $index => $item) { + $pluginPath = $this->pluginsPath . DIRECTORY_SEPARATOR . $item; + if (is_dir($pluginPath)) { + array_push($onlyFolders, $item); + } + } + return $onlyFolders; + } +} diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php new file mode 100644 index 000000000..5012ffaf8 --- /dev/null +++ b/app/Console/Kernel.php @@ -0,0 +1,39 @@ +singleton( Kernel2::class, - Kernel::class + App\Console\Kernel::class ); $app->singleton( diff --git a/config/app.php b/config/app.php index 18c615493..fad6a83a2 100644 --- a/config/app.php +++ b/config/app.php @@ -12,7 +12,7 @@ 'log' => env('APP_LOG', 'single'), 'log_level' => env('APP_LOG_LEVEL', 'debug'), 'cache_lifetime' => env('APP_CACHE_LIFETIME', 60), - + 'timezone' => 'UTC', 'providers' => [ FilesystemServiceProvider::class, CacheServiceProvider::class, diff --git a/config/constants.php b/config/constants.php new file mode 100644 index 000000000..f51963dc0 --- /dev/null +++ b/config/constants.php @@ -0,0 +1,10 @@ + [ + 'pmVariable' => [ + 'regEx' => '/^[a-zA-Z\_]{1}\w+$/' + ] + ] +]; + diff --git a/config/customMimeTypes.php b/config/customMimeTypes.php new file mode 100644 index 000000000..e3ec006b8 --- /dev/null +++ b/config/customMimeTypes.php @@ -0,0 +1,669 @@ + 'x-world/x-3dmf', + '3dmf' => 'x-world/x-3dmf', + 'a' => 'application/octet-stream', + 'aab' => 'application/x-authorware-bin', + 'aam' => 'application/x-authorware-map', + 'aas' => 'application/x-authorware-seg', + 'abc' => 'text/vnd.abc', + 'acgi' => 'text/html', + 'acutc' => 'application/vnd.acucorp', + 'afl' => 'video/animaflex', + 'afm' => 'application/x-font-type1', + 'afp' => 'application/vnd.ibm.modcap', + 'ai' => 'application/postscript', + 'aif' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'aim' => 'application/x-aim', + 'aip' => 'text/x-audiosoft-intra', + 'ani' => 'application/x-navi-animation', + 'aos' => 'application/x-nokia-9000-communicator-add-on-software', + 'aps' => 'application/mime', + 'arc' => 'application/octet-stream', + 'arj' => 'application/octet-stream', + 'art' => 'image/x-jg', + 'asf' => 'video/x-ms-asf', + 'asm' => 'text/x-asm', + 'asp' => 'text/asp', + 'asx' => 'video/x-ms-asf-plugin', + 'asx ' => 'video/x-ms-asf', + 'atc' => 'application/vnd.acucorp', + 'au' => ['audio/basic', 'audio/x-au'], + 'avi' => 'video/x-msvideo', + 'avs' => 'video/avs-video', + 'bat' => 'application/x-msdownload', + 'bcpio' => 'application/x-bcpio', + 'bin' => 'application/x-macbinary', + 'bm' => 'image/bmp', + 'bmp' => 'image/x-windows-bmp', + 'boo' => 'application/book', + 'book' => ['application/vnd.framemaker', 'application/book'], + 'boz' => 'application/x-bzip2', + 'bpk' => 'application/octet-stream', + 'bsh' => 'application/x-bsh', + 'bz' => 'application/x-bzip', + 'bz2' => 'application/x-bzip2', + 'c' => 'text/x-c', + 'c++' => 'text/plain', + 'c4d' => 'application/vnd.clonk.c4group', + 'c4f' => 'application/vnd.clonk.c4group', + 'c4g' => 'application/vnd.clonk.c4group', + 'c4p' => 'application/vnd.clonk.c4group', + 'c4u' => 'application/vnd.clonk.c4group', + 'cap' => 'application/vnd.tcpdump.pcap', + 'cat' => 'application/vnd.ms-pki.seccat', + 'cb7' => 'application/x-cbr', + 'cba' => 'application/x-cbr', + 'cbr' => 'application/x-cbr', + 'cbt' => 'application/x-cbr', + 'cbz' => 'application/x-cbr', + 'cc' => 'text/x-c', + 'ccad' => 'application/clariscad', + 'cco' => 'application/x-cocoa', + 'cct' => 'application/x-director', + 'cdf' => 'application/x-netcdf', + 'cer' => 'application/x-x509-ca-cert', + 'cha' => 'application/x-chat', + 'chat' => 'application/x-chat', + 'class' => 'application/x-java-class', + 'com' => ['application/x-msdownload', 'text/plain'], + 'conf' => 'text/plain', + 'cpio' => 'application/x-cpio', + 'cpp' => 'text/x-c', + 'cpt' => 'application/x-cpt', + 'crl' => 'application/pkix-crl', + 'crt' => 'application/x-x509-user-cert', + 'csh' => 'text/x-script.csh', + 'css' => 'text/css', + 'cst' => 'application/x-director', + 'cxt' => 'application/x-director', + 'cxx' => ['text/x-c', 'text/plain'], + 'dataless' => 'application/vnd.fdsn.seed', + 'dcr' => 'application/x-director', + 'deepv' => 'application/x-deepv', + 'def' => 'text/plain', + 'deploy' => 'application/octet-stream', + 'der' => 'application/x-x509-ca-cert', + 'dic' => 'text/x-c', + 'dif' => 'video/x-dv', + 'dir' => 'application/x-director', + 'dist' => 'application/octet-stream', + 'distz' => 'application/octet-stream', + 'djv' => 'image/vnd.djvu', + 'djvu' => 'image/vnd.djvu', + 'dl' => 'video/x-dl', + 'dll' => 'application/x-msdownload', + 'dmp' => 'application/vnd.tcpdump.pcap', + 'dms' => 'application/octet-stream', + 'doc' => ['application/msword', 'text/html'], + 'docx' => 'application/octet-stream', + 'dot' => 'application/msword', + 'dp' => 'application/commonground', + 'drw' => 'application/drafting', + 'dump' => 'application/octet-stream', + 'dv' => 'video/x-dv', + 'dvi' => 'application/x-dvi', + 'dwf' => 'model/vnd.dwf', + 'dwg' => 'image/x-dwg', + 'dxf' => 'image/x-dwg', + 'dxr' => 'application/x-director', + 'el' => 'text/x-script.elisp', + 'elc' => ['application/octet-stream', 'application/x-elc'], + 'emf' => 'application/x-msmetafile', + 'eml' => 'message/rfc822', + 'emz' => 'application/x-msmetafile', + 'env' => 'application/x-envoy', + 'eps' => 'application/postscript', + 'es' => 'application/x-esrehber', + 'es3' => 'application/vnd.eszigno3+xml', + 'et3' => 'application/vnd.eszigno3+xml', + 'etx' => 'text/x-setext', + 'evy' => 'application/x-envoy', + 'exe' => ['application/x-dosexec', 'application/octet-stream'], + 'f' => 'text/x-fortran', + 'f77' => 'text/x-fortran', + 'f90' => 'text/x-fortran', + 'fdf' => 'application/vnd.fdf', + 'fgd' => 'application/x-director', + 'fh' => 'image/x-freehand', + 'fh4' => 'image/x-freehand', + 'fh5' => 'image/x-freehand', + 'fh7' => 'image/x-freehand', + 'fhc' => 'image/x-freehand', + 'fif' => 'image/fif', + 'fli' => 'video/x-fli', + 'flo' => 'image/florian', + 'flx' => 'text/vnd.fmi.flexstor', + 'fm' => 'application/vnd.framemaker', + 'fmf' => 'video/x-atomic3d-feature', + 'for' => 'text/x-fortran', + 'fpx' => 'image/vnd.net-fpx', + 'frame' => 'application/vnd.framemaker', + 'frl' => 'application/freeloader', + 'funk' => 'audio/make', + 'fxp' => 'application/vnd.adobe.fxp', + 'fxpl' => 'application/vnd.adobe.fxp', + 'g' => 'text/plain', + 'g3' => 'image/g3fax', + 'gex' => 'application/vnd.geometry-explorer', + 'gif' => 'image/gif', + 'gl' => 'video/x-gl', + 'gqf' => 'application/vnd.grafeq', + 'gqs' => 'application/vnd.grafeq', + 'gre' => 'application/vnd.geometry-explorer', + 'gsd' => 'audio/x-gsm', + 'gsm' => 'audio/x-gsm', + 'gsp' => 'application/x-gsp', + 'gss' => 'application/x-gss', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'gzip' => 'multipart/x-gzip', + 'h' => ['text/x-c', 'text/x-h'], + 'hdf' => 'application/x-hdf', + 'help' => 'application/x-helpfile', + 'hgl' => 'application/vnd.hp-hpgl', + 'hh' => ['text/x-c', 'text/x-h'], + 'hlb' => 'text/x-script', + 'hlp' => 'application/x-winhelp', + 'hpg' => 'application/vnd.hp-hpgl', + 'hpgl' => 'application/vnd.hp-hpgl', + 'hqx' => 'application/x-mac-binhex40', + 'hta' => 'application/hta', + 'htc' => 'text/x-component', + 'htm' => 'text/html', + 'html' => 'text/html', + 'htmls' => 'text/html', + 'htt' => 'text/webviewhtml', + 'htx' => 'text/html', + 'icc' => 'application/vnd.iccprofile', + 'ice' => 'x-conference/x-cooltalk', + 'icm' => 'application/vnd.iccprofile', + 'ico' => 'image/x-icon', + 'ics' => 'text/calendar', + 'idc' => 'text/plain', + 'ief' => 'image/ief', + 'iefs' => 'image/ief', + 'ifb' => 'text/calendar', + 'iges' => 'model/iges', + 'igs' => 'model/iges', + 'ima' => 'application/x-ima', + 'imap' => 'application/x-httpd-imap', + 'in' => 'text/plain', + 'inf' => 'application/inf', + 'inkml' => 'application/inkml+xml', + 'ins' => 'application/x-internett-signup', + 'ip' => 'application/x-ip2', + 'isu' => 'video/x-isvideo', + 'it' => 'audio/it', + 'iv' => 'application/x-inventor', + 'ivr' => 'i-world/i-vrml', + 'ivy' => 'application/x-livescreen', + 'jam' => 'audio/x-jam', + 'jav' => 'text/x-java-source', + 'java' => 'text/x-java-source', + 'jcm' => 'application/x-java-commerce', + 'jfif' => 'image/pjpeg', + 'jfif-tbnl' => 'image/jpeg', + 'jpe' => ['image/jpeg', 'image/pjpeg'], + 'jpeg' => ['image/jpeg', 'image/pjpeg'], + 'jpg' => ['image/pjpeg', 'image/jpeg'], + 'jpgm' => 'video/jpm', + 'jpm' => 'video/jpm', + 'jps' => 'image/x-jps', + 'js' => 'text/ecmascript', + 'json' => ['text/plain', 'text/json', 'text/javascript'], + 'jsonp' => 'application/javascript', + 'jut' => 'image/jutvision', + 'kar' => ['audio/midi', 'music/x-karaoke'], + 'kne' => 'application/vnd.kinar', + 'knp' => 'application/vnd.kinar', + 'kpr' => 'application/vnd.kde.kpresenter', + 'kpt' => 'application/vnd.kde.kpresenter', + 'ksh' => 'text/x-script.ksh', + 'ktr' => 'application/vnd.kahootz', + 'ktz' => 'application/vnd.kahootz', + 'kwd' => 'application/vnd.kde.kword', + 'kwt' => 'application/vnd.kde.kword', + 'la' => 'audio/x-nspaudio', + 'lam' => 'audio/x-liveaudio', + 'latex' => 'application/x-latex', + 'lha' => 'application/x-lha', + 'lhx' => 'application/octet-stream', + 'list' => 'text/plain', + 'list3820' => 'application/vnd.ibm.modcap', + 'listafp' => 'application/vnd.ibm.modcap', + 'lma' => 'audio/x-nspaudio', + 'log' => 'text/plain', + 'lrf' => 'application/octet-stream', + 'lsp' => 'text/x-script.lisp', + 'lst' => 'text/plain', + 'lsx' => 'text/x-la-asf', + 'ltx' => 'application/x-latex', + 'lzh' => 'application/x-lzh', + 'lzx' => 'application/x-lzx', + 'm' => 'text/x-m', + 'm13' => 'application/x-msmediaview', + 'm14' => 'application/x-msmediaview', + 'm1v' => 'video/mpeg', + 'm2a' => 'audio/mpeg', + 'm2v' => 'video/mpeg', + 'm3a' => 'audio/mpeg', + 'm3u' => 'audio/x-mpequrl', + 'm4a' => ['audio/mp4', 'audio/x-m4a'], + 'm4u' => 'video/vnd.mpegurl', + 'maker' => 'application/vnd.framemaker', + 'man' => ['text/troff', 'music/x-karaoke'], + 'map' => 'application/x-navimap', + 'mar' => ['application/octet-stream', 'text/plain'], + 'mb' => 'application/mathematica', + 'mbd' => 'application/mbedlet', + 'mc$' => 'application/x-magic-cap-package-1.0', + 'mcd' => 'application/x-mathcad', + 'mcf' => 'text/mcf', + 'mcp' => 'application/netmc', + 'me' => ['text/troff', 'application/x-troff-me'], + 'mesh' => 'model/mesh', + 'mht' => 'message/rfc822', + 'mhtml' => 'message/rfc822', + 'mid' => ['audio/midi', 'application/x-troff-me'], + 'midi' => ['audio/midi', 'application/x-troff-me'], + 'mif' => 'application/x-mif', + 'mime' => ['message/rfc822', 'www/mime'], + 'mj2' => 'video/mj2', + 'mjf' => 'audio/x-vnd.audioexplosion.mjuicemediafile', + 'mjp2' => 'video/mj2', + 'mjpg' => 'video/x-motion-jpeg', + 'mk3d' => 'video/x-matroska', + 'mks' => 'video/x-matroska', + 'mkv' => 'video/x-matroska', + 'mm' => 'application/x-meme', + 'mme' => 'application/base64', + 'mod' => 'audio/x-mod', + 'moov' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'movie' => 'video/x-sgi-movie', + 'mp2' => ['audio/mpeg', 'video/x-mpeq2a'], + 'mp2a' => 'audio/mpeg', + 'mp3' => ['video/x-mpeg', 'audio/mpeg'], + 'mp4' => 'video/mp4', + 'mp4a' => 'audio/mp4', + 'mp4v' => 'video/mp4', + 'mpa' => 'video/mpeg', + 'mpc' => 'application/x-project', + 'mpe' => 'video/mpeg', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpg4' => 'video/mp4', + 'mpga' => 'audio/mpeg', + 'mpp' => 'application/vnd.ms-project', + 'mpt' => ['application/vnd.ms-project', 'application/x-project'], + 'mpv' => 'application/x-project', + 'mpx' => 'application/x-project', + 'mrc' => 'application/marc', + 'ms' => ['text/troff', 'application/x-troff-ms'], + 'msh' => 'model/mesh', + 'msi' => 'application/x-msdownload', + 'mv' => 'video/x-sgi-movie', + 'mvb' => 'application/x-msmediaview', + 'mxml' => 'application/xv+xml', + 'mxu' => 'video/vnd.mpegurl', + 'my' => 'audio/make', + 'mzz' => 'application/x-vnd.audioexplosion.mzz', + 'nap' => 'image/naplps', + 'naplps' => 'image/naplps', + 'nb' => 'application/mathematica', + 'nc' => 'application/x-netcdf', + 'ncm' => 'application/vnd.nokia.Something is wronguration-message', + 'nif' => 'image/x-niff', + 'niff' => 'image/x-niff', + 'nitf' => 'application/vnd.nitf', + 'nix' => 'application/x-mix-transfer', + 'nsc' => 'application/x-conference', + 'ntf' => 'application/vnd.nitf', + 'nvd' => 'application/x-navidoc', + 'o' => 'application/octet-stream', + 'oda' => 'application/oda', + 'oga' => 'audio/ogg', + 'ogg' => 'audio/ogg', + 'omc' => 'application/x-omc', + 'omcd' => 'application/x-omcdatamaker', + 'omcr' => 'application/x-omcregerator', + 'onepkg' => 'application/onenote', + 'onetmp' => 'application/onenote', + 'onetoc2' => 'application/onenote', + 'oprc' => 'application/vnd.palm', + 'p' => 'text/x-pascal', + 'p10' => 'application/x-pkcs10', + 'p12' => 'application/x-pkcs12', + 'p7a' => 'application/x-pkcs7-signature', + 'p7b' => 'application/x-pkcs7-certificates', + 'p7c' => ['application/pkcs7-mime', 'application/x-pkcs7-mime'], + 'p7m' => 'application/x-pkcs7-mime', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'part' => 'application/pro_eng', + 'pas' => 'text/pascal', + 'pbm' => 'image/x-portable-bitmap', + 'pcap' => 'application/vnd.tcpdump.pcap', + 'pcl' => 'application/x-pcl', + 'pct' => 'image/x-pict', + 'pcx' => 'image/x-pcx', + 'pdb' => ['application/vnd.palm', 'chemical/x-pdb'], + 'pdf' => 'application/pdf', + 'pfa' => 'application/x-font-type1', + 'pfb' => 'application/x-font-type1', + 'pfm' => 'application/x-font-type1', + 'pfunk' => 'audio/make.my.funk', + 'pfx' => 'application/x-pkcs12', + 'pgm' => 'image/x-portable-greymap', + 'php' => 'text/x-php', + 'pic' => ['image/x-pict', 'image/pict'], + 'pict' => 'image/pict', + 'pkg' => ['application/octet-stream', 'application/x-newton-compatible-pkg'], + 'pko' => 'application/vnd.ms-pki.pko', + 'pl' => 'text/x-script.perl', + 'plx' => 'application/x-pixclscript', + 'pm' => 'text/x-script.perl-module', + 'pm4' => 'application/x-pagemaker', + 'pm5' => 'application/x-pagemaker', + 'png' => 'image/png', + 'pnm' => 'image/x-portable-anymap', + 'pot' => 'application/vnd.ms-powerpoint', + 'pov' => 'model/x-pov', + 'ppa' => 'application/vnd.ms-powerpoint', + 'ppm' => 'image/x-portable-pixmap', + 'pps' => 'application/vnd.ms-powerpoint', + 'ppt' => ['application/x-mspowerpoint', 'application/vnd.ms-office'], + 'ppz' => 'application/mspowerpoint', + 'pqa' => 'application/vnd.palm', + 'pre' => 'application/x-freelance', + 'prt' => 'application/pro_eng', + 'ps' => 'application/postscript', + 'psd' => 'application/octet-stream', + 'pvu' => 'paleovu/x-pv', + 'pwz' => 'application/vnd.ms-powerpoint', + 'py' => 'text/x-script.phyton', + 'pyc' => 'application/x-bytecode.python', + 'qcp' => 'audio/vnd.qcelp', + 'qd3' => 'x-world/x-3dmf', + 'qd3d' => 'x-world/x-3dmf', + 'qif' => 'image/x-quicktime', + 'qt' => 'video/quicktime', + 'qtc' => 'video/x-qtc', + 'qti' => 'image/x-quicktime', + 'qtif' => 'image/x-quicktime', + 'qwd' => 'application/vnd.quark.quarkxpress', + 'qwt' => 'application/vnd.quark.quarkxpress', + 'qxb' => 'application/vnd.quark.quarkxpress', + 'qxd' => 'application/vnd.quark.quarkxpress', + 'qxl' => 'application/vnd.quark.quarkxpress', + 'qxt' => 'application/vnd.quark.quarkxpress', + 'ra' => ['audio/x-pn-realaudio', 'audio/x-realaudio'], + 'ram' => 'audio/x-pn-realaudio', + 'ras' => 'image/x-cmu-raster', + 'rast' => 'image/cmu-raster', + 'rexx' => 'text/x-script.rexx', + 'rf' => 'image/vnd.rn-realflash', + 'rgb' => 'image/x-rgb', + 'rm' => 'audio/x-pn-realaudio', + 'rmi' => ['audio/midi', 'audio/mid'], + 'rmm' => 'audio/x-pn-realaudio', + 'rmp' => 'audio/x-pn-realaudio-plugin', + 'rng' => 'application/vnd.nokia.ringing-tone', + 'rnx' => 'application/vnd.rn-realplayer', + 'roff' => ['text/troff', 'application/x-troff'], + 'rp' => 'image/vnd.rn-realpix', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'rt' => 'text/vnd.rn-realtext', + 'rtf' => 'text/richtext', + 'rtx' => 'text/richtext', + 'rv' => 'video/vnd.rn-realvideo', + 's' => 'text/x-asm', + 's3m' => 'audio/s3m', + 'saveme' => 'application/octet-stream', + 'sbk' => 'application/x-tbook', + 'scm' => 'video/x-scm', + 'sdkd' => 'application/vnd.solent.sdkm+xml', + 'sdkm' => 'application/vnd.solent.sdkm+xml', + 'sdml' => 'text/plain', + 'sdp' => 'application/x-sdp', + 'sdr' => 'application/sounder', + 'sdw' => 'application/vnd.stardivision.writer', + 'sea' => 'application/x-sea', + 'seed' => 'application/vnd.fdsn.seed', + 'set' => 'application/set', + 'sgm' => ['text/sgml', 'text/x-sgml'], + 'sgml' => ['text/sgml', 'text/x-sgml'], + 'sh' => 'text/x-script.sh', + 'shar' => 'application/x-shar', + 'shtml' => 'text/x-server-parsed-html', + 'sid' => 'audio/x-psid', + 'sig' => 'application/pgp-signature', + 'silo' => 'model/mesh', + 'sis' => 'application/vnd.symbian.install', + 'sisx' => 'application/vnd.symbian.install', + 'sit' => 'application/x-stuffit', + 'skd' => ['application/vnd.koan', 'application/x-koan'], + 'skm' => ['application/vnd.koan', 'application/x-koan'], + 'skp' => ['application/vnd.koan', 'application/x-koan'], + 'skt' => ['application/vnd.koan', 'application/x-koan'], + 'sl' => 'application/x-seelogo', + 'smi' => ['application/smil+xml', 'application/smil'], + 'smil' => ['application/smil+xml', 'application/smil'], + 'snd' => 'audio/basic', + 'so' => 'application/octet-stream', + 'sol' => 'application/solids', + 'spc' => ['application/x-pkcs7-certificates', 'text/x-speech'], + 'spl' => 'application/futuresplash', + 'spr' => 'application/x-sprite', + 'sprite' => 'application/x-sprite', + 'spx' => 'audio/ogg', + 'src' => 'application/x-wais-source', + 'ssi' => 'text/x-server-parsed-html', + 'ssm' => 'application/streamingmedia', + 'sst' => 'application/vnd.ms-pki.certstore', + 'step' => 'application/step', + 'stl' => 'application/x-navistyle', + 'stp' => 'application/step', + 'sus' => 'application/vnd.sus-calendar', + 'susp' => 'application/vnd.sus-calendar', + 'sv4cpio' => 'application/x-sv4cpio', + 'sv4crc' => 'application/x-sv4crc', + 'svf' => 'image/x-dwg', + 'svr' => 'x-world/x-svr', + 'swa' => 'application/x-director', + 'swf' => 'application/x-shockwave-flash', + 't' => ['text/troff', 'application/x-troff'], + 'talk' => 'text/x-speech', + 'tar' => 'application/x-tar', + 'tbk' => 'application/x-tbook', + 'tcl' => 'text/x-script.tcl', + 'tcsh' => 'text/x-script.tcsh', + 'tei' => 'application/tei+xml', + 'teicorpus' => 'application/tei+xml', + 'tex' => 'application/x-tex', + 'texi' => 'application/x-texinfo', + 'texinfo' => 'application/x-texinfo', + 'text' => 'text/plain', + 'tgz' => 'application/x-compressed', + 'tif' => ['image/tiff', 'image/x-tiff'], + 'tiff' => ['image/tiff', 'image/x-tiff'], + 'tr' => ['text/troff', 'application/x-troff'], + 'tsi' => 'audio/tsp-audio', + 'tsp' => 'audio/tsplayer', + 'tsv' => 'text/tab-separated-values', + 'turbot' => 'image/florian', + 'twd' => 'application/vnd.simtech-mindmapper', + 'twds' => 'application/vnd.simtech-mindmapper', + 'txt' => 'text/plain', + 'u32' => 'application/x-authorware-bin', + 'ufd' => 'application/vnd.ufdl', + 'ufdl' => 'application/vnd.ufdl', + 'uil' => 'text/x-uil', + 'uni' => 'text/uri-list', + 'unis' => 'text/uri-list', + 'unv' => 'application/i-deas', + 'uri' => 'text/uri-list', + 'uris' => 'text/uri-list', + 'urls' => 'text/uri-list', + 'ustar' => 'multipart/x-ustar', + 'uu' => 'text/x-uuencode', + 'uue' => 'text/x-uuencode', + 'uva' => 'audio/vnd.dece.audio', + 'uvd' => 'application/vnd.dece.data', + 'uvf' => 'application/vnd.dece.data', + 'uvg' => 'image/vnd.dece.graphic', + 'uvh' => 'video/vnd.dece.hd', + 'uvi' => 'image/vnd.dece.graphic', + 'uvm' => 'video/vnd.dece.mobile', + 'uvp' => 'video/vnd.dece.pd', + 'uvs' => 'video/vnd.dece.sd', + 'uvt' => 'application/vnd.dece.ttml+xml', + 'uvu' => 'video/vnd.uvvu.mp4', + 'uvv' => 'video/vnd.dece.video', + 'uvva' => 'audio/vnd.dece.audio', + 'uvvd' => 'application/vnd.dece.data', + 'uvvf' => 'application/vnd.dece.data', + 'uvvg' => 'image/vnd.dece.graphic', + 'uvvh' => 'video/vnd.dece.hd', + 'uvvi' => 'image/vnd.dece.graphic', + 'uvvm' => 'video/vnd.dece.mobile', + 'uvvp' => 'video/vnd.dece.pd', + 'uvvs' => 'video/vnd.dece.sd', + 'uvvt' => 'application/vnd.dece.ttml+xml', + 'uvvu' => 'video/vnd.uvvu.mp4', + 'uvvv' => 'video/vnd.dece.video', + 'uvvx' => 'application/vnd.dece.unspecified', + 'uvvz' => 'application/vnd.dece.zip', + 'uvx' => 'application/vnd.dece.unspecified', + 'uvz' => 'application/vnd.dece.zip', + 'vcd' => 'application/x-cdlink', + 'vcs' => 'text/x-vcalendar', + 'vda' => 'application/vda', + 'vdo' => 'video/vdo', + 'vew' => 'application/groupwise', + 'viv' => 'video/vnd.vivo', + 'vivo' => 'video/vnd.vivo', + 'vmd' => 'application/vocaltec-media-desc', + 'vmf' => 'application/vocaltec-media-file', + 'voc' => 'audio/x-voc', + 'vor' => 'application/vnd.stardivision.writer', + 'vos' => 'video/vosaic', + 'vox' => ['application/x-authorware-bin', 'audio/voxware'], + 'vqe' => 'audio/x-twinvq-plugin', + 'vqf' => 'audio/x-twinvqv', + 'vql' => 'audio/x-twinvq-plugin', + 'vrml' => ['model/vrml', 'x-world/x-vrml'], + 'vrt' => 'x-world/x-vrt', + 'vsd' => ['application/vnd.visio', 'application/x-visio'], + 'vss' => ['application/vnd.visio', 'application/x-visio'], + 'vst' => ['application/vnd.visio', 'application/x-visio'], + 'vsw' => ['application/vnd.visio', 'application/x-visio'], + 'w3d' => 'application/x-director', + 'w60' => 'application/wordperfect6.0', + 'w61' => 'application/wordperfect6.1', + 'w6w' => 'application/msword', + 'wav' => 'audio/x-wav', + 'wb1' => 'application/x-qpro', + 'wbmp' => 'image/vnd.wap.wbmp', + 'wcm' => 'application/vnd.ms-works', + 'wdb' => 'application/vnd.ms-works', + 'web' => 'application/vnd.xara', + 'wiz' => 'application/msword', + 'wk1' => 'application/x-123', + 'wks' => 'application/vnd.ms-works', + 'wmf' => ['application/x-msmetafile', 'windows/metafile'], + 'wml' => 'text/vnd.wap.wml', + 'wmlc' => 'application/vnd.wap.wmlc', + 'wmls' => 'text/vnd.wap.wmlscript', + 'wmlsc' => 'application/vnd.wap.wmlscriptc', + 'wmv' => ['video/x-ms-asf', 'video/x-ms-wmv'], + 'wmz' => 'application/x-msmetafile', + 'word' => 'application/msword', + 'wp' => 'application/wordperfect', + 'wp5' => 'application/wordperfect6.0', + 'wp6' => 'application/wordperfect', + 'wpd' => 'application/x-wpwin', + 'wps' => 'application/vnd.ms-works', + 'wq1' => 'application/x-lotus', + 'wri' => 'application/x-wri', + 'wrl' => ['model/vrml', 'x-world/x-vrml'], + 'wrz' => 'x-world/x-vrml', + 'wsc' => 'text/scriplet', + 'wsrc' => 'application/x-wais-source', + 'wtk' => 'application/x-wintalk', + 'x-png' => 'image/png', + 'x32' => 'application/x-authorware-bin', + 'x3d' => 'model/x3d+xml', + 'x3db' => 'model/x3d+binary', + 'x3dbz' => 'model/x3d+binary', + 'x3dv' => 'model/x3d+vrml', + 'x3dvz' => 'model/x3d+vrml', + 'x3dz' => 'model/x3d+xml', + 'xbm' => 'image/xbm', + 'xdr' => 'video/x-amt-demorun', + 'xgz' => 'xgl/drawing', + 'xht' => 'application/xhtml+xml', + 'xhtml' => 'application/xhtml+xml', + 'xhvml' => 'application/xv+xml', + 'xif' => 'image/vnd.xiff', + 'xl' => 'application/excel', + 'xla' => ['application/vnd.ms-excel', 'application/x-msexcel'], + 'xlb' => 'application/x-excel', + 'xlc' => ['application/vnd.ms-excel', 'application/x-excel'], + 'xld' => 'application/x-excel', + 'xlk' => 'application/x-excel', + 'xll' => 'application/x-excel', + 'xlm' => ['application/vnd.ms-excel', 'application/x-excel'], + 'xls' => ['application/x-msexcel', 'text/plain'], + 'xlsx' => 'application/octet-stream', + 'xlt' => ['application/vnd.ms-excel', 'application/x-excel'], + 'xlv' => 'application/x-excel', + 'xlw' => ['application/vnd.ms-excel', 'application/x-msexcel'], + 'xm' => 'audio/xm', + 'xml' => ['application/xml', 'text/xml'], + 'xmz' => 'xgl/movie', + 'xpix' => 'application/x-vnd.ls-xpix', + 'xpm' => 'image/xpm', + 'x-png' => 'image/png', + 'xpw' => 'application/vnd.intercon.formnet', + 'xpx' => 'application/vnd.intercon.formnet', + 'xsl' => 'application/xml', + 'xsr' => 'video/x-amt-showrun', + 'xvm' => 'application/xv+xml', + 'xvml' => 'application/xv+xml', + 'xwd' => 'image/x-xwindowdump', + 'xyz' => 'chemical/x-pdb', + 'z' => 'application/x-compressed', + 'z1' => 'application/x-zmachine', + 'z2' => 'application/x-zmachine', + 'z3' => 'application/x-zmachine', + 'z4' => 'application/x-zmachine', + 'z5' => 'application/x-zmachine', + 'z6' => 'application/x-zmachine', + 'z7' => 'application/x-zmachine', + 'z8' => 'application/x-zmachine', + 'zip' => 'multipart/x-zip', + 'zir' => 'application/vnd.zul', + 'zirz' => 'application/vnd.zul', + 'zoo' => 'application/octet-stream', + 'zsh' => 'text/x-script.zsh', + //The following are the custom application mime type + 'dat' => 'text/plain', + 'pm' => ['text/plain', 'application/octet-stream'], + 'pmp' => ['application/xml', 'text/xml', 'text/html'], + 'pmt' => 'text/plain', + 'pmx' => ['application/xml', 'text/xml', 'text/html'], + 'pmx2' => ['application/xml', 'text/xml', 'text/html'], + 'po' => 'text/x-po', +]; diff --git a/config/deprecatedFiles.lst b/config/deprecatedFiles.lst new file mode 100644 index 000000000..43cb64059 --- /dev/null +++ b/config/deprecatedFiles.lst @@ -0,0 +1,107 @@ +checksum.txt +features/backend/projects/database_connections/main_tests_database_connections_sqlserver.feature +features/backend/projects/project_export_import/main_tests_project_export_import.feature +gulliver/core/Session/PmSessionHandler.php +gulliver/js/codemirror/addon/hint/pig-hint.js +gulliver/js/codemirror/addon/hint/python-hint.js +gulliver/js/codemirror/addon/merge/dep/diff_match_patch.js +gulliver/js/codemirror/bower.json +gulliver/js/codemirror/keymap/extra.js +gulliver/js/codemirror/mode/less +gulliver/js/codemirror/mode/rpm/changes/changes.js +gulliver/js/codemirror/mode/rpm/spec +gulliver/js/codemirror/test/lint/acorn.js +gulliver/js/codemirror/test/lint/lint.js +gulliver/js/codemirror/test/lint/walk.js +gulliver/js/dveditor +gulliver/js/highlight +gulliver/js/json/core/json.js +gulliver/js/md5/core/md5.js +gulliver/system/class.database_mssql.php +gulliver/system/class.dvEditor.php +gulliver/system/class.functionTest.php +gulliver/system/class.testTools.php +gulliver/system/class.unitTest.php +gulliver/system/class.ymlDomain.php +gulliver/system/class.ymlTestCases.php +gulliver/thirdparty +rbac/engine/content +rbac/engine/db/dbmodule_processmaker.php +rbac/engine/includes +rbac/engine/menus +rbac/engine/methods +rbac/engine/pre_processor.php +rbac/engine/tables +rbac/engine/templates +rbac/engine/xmlform +rbac/public_html/skins/JSForms.js +virtualhost.conf.example +workflow/engine/classes/class.jrml.php +workflow/engine/classes/entities/AppSolrQueue.php +workflow/engine/classes/entities/Base.php +workflow/engine/classes/entities/FacetGroup.php +workflow/engine/classes/entities/FacetInterfaceRequest.php +workflow/engine/classes/entities/FacetInterfaceResult.php +workflow/engine/classes/entities/FacetItem.php +workflow/engine/classes/entities/FacetRequest.php +workflow/engine/classes/entities/FacetResult.php +workflow/engine/classes/entities/SelectedFacetGroupItem.php +workflow/engine/classes/entities/SolrQueryResult.php +workflow/engine/classes/entities/SolrRequestData.php +workflow/engine/classes/entities/SolrUpdateDocument.php +workflow/engine/classes/triggers/api/class.zimbraApi.php +workflow/engine/controllers/dashboard.php +workflow/engine/controllers/installer.php +workflow/engine/includes/inc.JSForms.php +workflow/engine/js/cases/core/cases_Step_Pmdynaform.js +workflow/engine/methods/cases/casesDemo.php +workflow/engine/methods/cases/cases_Scheduler_Save.php +workflow/engine/methods/cases/cases_Scheduler_Update.php +workflow/engine/methods/cases/proxyPMTablesSaveFields.php +workflow/engine/methods/cases/saveFormSupervisor.php +workflow/engine/methods/controls/buscador.php +workflow/engine/methods/dbConnections/genericDbConnections.php +workflow/engine/methods/login/dbInfo.php +workflow/engine/methods/services/processHeartBeat_Ajax.php +workflow/engine/methods/services/soap.php +workflow/engine/methods/services/wsdl.php +workflow/engine/methods/services/wso2.php +workflow/engine/methods/setup/jasper.php +workflow/engine/methods/setup/webServices.php +workflow/engine/methods/setup/webServicesAjax.php +workflow/engine/methods/setup/webServicesList.php +workflow/engine/plugins/openFlash.php +workflow/engine/plugins/openFlash/chart-data.php +workflow/engine/plugins/openFlash/chart.php +workflow/engine/plugins/openFlash/class.openFlash.php +workflow/engine/plugins/openFlash/open-flash-chart.php +workflow/engine/plugins/openFlash/open_flash_chart_object.php +workflow/engine/plugins/openFlash/public_html/open-flash-chart.swf +workflow/engine/plugins/openFlash/public_html/swfobject.js +workflow/engine/plugins/openFlash/setupPage.xml +workflow/engine/plugins/pmosCommunity.php +workflow/engine/plugins/pmosCommunity/chart-data.php +workflow/engine/plugins/pmosCommunity/chart.php +workflow/engine/plugins/pmosCommunity/class.pmosCommunity.php +workflow/engine/plugins/pmosCommunity/config/databases.php +workflow/engine/plugins/pmosCommunity/config/setup.conf +workflow/engine/plugins/pmosCommunity/drawChart.php +workflow/engine/plugins/pmosCommunity/open-flash-chart.php +workflow/engine/plugins/pmosCommunity/open_flash_chart_object.php +workflow/engine/plugins/pmosCommunity/public_html/open-flash-chart.swf +workflow/engine/plugins/pmosCommunity/public_html/swfobject.js +workflow/engine/plugins/pmosCommunity/setupPage.xml +workflow/engine/skinEngine/base/images/updating/page_background.png +workflow/engine/skinEngine/neoclassic/images/updating/page_background.png +workflow/engine/src/ProcessMaker/Services/Api/Test2.php +workflow/engine/src/ProcessMaker/Services/Api/Test3.php +workflow/engine/src/Tests +workflow/engine/templates/cases/casesDemo.html +workflow/engine/templates/cases/cases_Step_Pmdynaform.html +workflow/engine/templates/cases/cases_Step_Pmdynaform_Preview.html +workflow/engine/templates/cases/cases_Step_Pmdynaform_View.html +workflow/engine/templates/login/init.js +workflow/engine/templates/reportTables/mainLoad.php +workflow/engine/test +workflow/public_html/skins/JSForms.js +workflow/public_html/skins/ajax.js diff --git a/config/enviromentvariables.json b/config/enviromentvariables.json index 57d9fc8da..e97f1b876 100644 --- a/config/enviromentvariables.json +++ b/config/enviromentvariables.json @@ -8,5 +8,10 @@ "lastname": "Guest", "username": "guest" } + }, + "validation": { + "pmVariable": { + "regEx": "/^[a-zA-Z\\_]{1}\\w+$/" + } } } \ No newline at end of file diff --git a/framework/src/Maveriks/Extension/Restler/UploadFormat.php b/framework/src/Maveriks/Extension/Restler/UploadFormat.php index be0e01655..5f85d8ebd 100644 --- a/framework/src/Maveriks/Extension/Restler/UploadFormat.php +++ b/framework/src/Maveriks/Extension/Restler/UploadFormat.php @@ -2,6 +2,7 @@ namespace Luracast\Restler\Format; use Luracast\Restler\RestException; +use ProcessMaker\Validation\ValidationUploadedFiles; /** * Extending UploadFormat Support for Multi Part Form Data and File Uploads @@ -84,8 +85,21 @@ public function encode($data, $humanReadable = false) throw new RestException(500, 'UploadFormat is read only'); } + /** + * Decode request. + * + * @param mixed $data + * @return array + * @throws RestException + * + * @see Luracast\Restler\CommentParser->parseEmbeddedData() + */ public function decode($data) { + $runRulesForFileEmpty = ValidationUploadedFiles::getValidationUploadedFiles()->runRulesForFileEmpty(); + if ($runRulesForFileEmpty->fails()) { + throw new RestException($runRulesForFileEmpty->getStatus(), $runRulesForFileEmpty->getMessage()); + } $doMimeCheck = !empty(self::$allowedMimeTypes); $doSizeCheck = self::$maximumFileSize ? TRUE : FALSE; //validate diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 40053a73a..d619ecb8d 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -3,14 +3,17 @@ namespace Maveriks; use Bootstrap; +use Exception; +use G; +use Illuminate\Foundation\Http\Kernel; +use Luracast\Restler\Format\UploadFormat; +use Luracast\Restler\RestException; use Maveriks\Util; use ProcessMaker\Core\System; use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Services; use ProcessMaker\Services\Api; -use Luracast\Restler\RestException; -use Illuminate\Foundation\Http\Kernel; -use G; +use ProcessMaker\Validation\ValidationUploadedFiles; /** * Web application bootstrap @@ -252,8 +255,6 @@ public function dispatchApiRequest($uri, $version = "1.0", $multipart = false, $ */ protected function initRest($uri, $version, $multipart = false) { - require_once $this->rootDir . "/framework/src/Maveriks/Extension/Restler/UploadFormat.php"; - // $servicesDir contains directory where Services Classes are allocated $servicesDir = $this->workflowDir . 'engine' . DS . 'src' . DS . 'ProcessMaker' . DS . 'Services' . DS; // $apiDir - contains directory to scan classes and add them to Restler @@ -331,6 +332,17 @@ protected function initRest($uri, $version, $multipart = false) $this->rest->setOverridingFormats('JsonFormat', 'UploadFormat'); + UploadFormat::$customValidationFunction = function($target) { + $validator = ValidationUploadedFiles::getValidationUploadedFiles()->runRules([ + 'filename' => $target['name'], + 'path' => $target['tmp_name'] + ]); + if ($validator->fails()) { + throw new RestException($validator->getStatus(), $validator->getMessage()); + } + return true; + }; + // scan all api directory to find api classes $classesList = Util\Common::rglob($apiDir . "/*"); @@ -415,6 +427,16 @@ public function parseApiRequestUri() ); } + /** + * Define constants, setup configuration and initialize Laravel + * + * @param string $workspace + * @return bool + * @throws Exception + * + * @see run() + * @see workflow/engine/bin/cli.php + */ public function loadEnvironment($workspace = "") { define("PATH_SEP", DIRECTORY_SEPARATOR); @@ -456,24 +478,11 @@ public function loadEnvironment($workspace = "") define("PATH_CONTROLLERS", PATH_CORE . "controllers" . PATH_SEP); define("PATH_SERVICES_REST", PATH_CORE . "services" . PATH_SEP . "rest" . PATH_SEP); - G::defineConstants(); - $arraySystemConfiguration = System::getSystemConfiguration(); - - ini_set('date.timezone', $arraySystemConfiguration['time_zone']); //Set Time Zone - // set include path - set_include_path( - PATH_CORE . PATH_SEPARATOR . - PATH_THIRDPARTY . PATH_SEPARATOR . - PATH_THIRDPARTY . "pear" . PATH_SEPARATOR . - PATH_RBAC_CORE . PATH_SEPARATOR . - get_include_path() - ); - /* * Setting Up Workspace */ if (!file_exists(FILE_PATHS_INSTALLED)) { - throw new \Exception("Can't locate system file: " . FILE_PATHS_INSTALLED); + throw new Exception("Can't locate system file: " . FILE_PATHS_INSTALLED); } // include the server installed configuration @@ -485,17 +494,58 @@ public function loadEnvironment($workspace = "") define("PATH_TEMPORAL", PATH_C . "dynEditor/"); define("PATH_DB", PATH_DATA . "sites" . PATH_SEP); + // set include path + set_include_path( + PATH_CORE . PATH_SEPARATOR . + PATH_THIRDPARTY . PATH_SEPARATOR . + PATH_THIRDPARTY . "pear" . PATH_SEPARATOR . + PATH_RBAC_CORE . PATH_SEPARATOR . + get_include_path() + ); + + G::defineConstants(); + + $arraySystemConfiguration = System::getSystemConfiguration('', '', $workspace); + + //In community version the default value is 0 + $_SESSION['__SYSTEM_UTC_TIME_ZONE__'] = (int)($arraySystemConfiguration['system_utc_time_zone']) == 1; + + define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']); + define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']); + define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']); + define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']); + define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']); + define('SYS_SKIN', $arraySystemConfiguration['default_skin']); + define('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION', $arraySystemConfiguration['disable_download_documents_session_validation']); + define('TIME_ZONE', + (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $arraySystemConfiguration['time_zone']); + // Change storage path app()->useStoragePath(realpath(PATH_DATA)); app()->make(Kernel::class)->bootstrap(); restore_error_handler(); error_reporting(error_reporting() & ~E_STRICT & ~E_DEPRECATED); + //Overwrite with the Processmaker env.ini configuration used in production environments + //@todo: move env.ini configuration to .env + ini_set('display_errors', $arraySystemConfiguration['display_errors']); + ini_set('error_reporting', $arraySystemConfiguration['error_reporting']); + ini_set('short_open_tag', 'On'); //?? + ini_set('default_charset', 'UTF-8'); //?? + ini_set('memory_limit', $arraySystemConfiguration['memory_limit']); + ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']); + ini_set('date.timezone', TIME_ZONE); //Set Time Zone + + date_default_timezone_set(TIME_ZONE); + + config(['app.timezone' => TIME_ZONE]); + Bootstrap::setLanguage(); Bootstrap::LoadTranslationObject((defined("SYS_LANG")) ? SYS_LANG : "en"); if (empty($workspace)) { + // If the workspace is empty the function should be return the control to the previous file return true; } @@ -509,24 +559,6 @@ public function loadEnvironment($workspace = "") exit(0); } - $arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace")); - - //Do not change any of these settings directly, use env.ini instead - ini_set('display_errors', $arraySystemConfiguration['display_errors']); - ini_set('error_reporting', $arraySystemConfiguration['error_reporting']); - ini_set('short_open_tag', 'On'); //?? - ini_set('default_charset', 'UTF-8'); //?? - ini_set('memory_limit', $arraySystemConfiguration['memory_limit']); - ini_set('soap.wsdl_cache_enabled', $arraySystemConfiguration['wsdl_cache']); - - define('DEBUG_SQL_LOG', $arraySystemConfiguration['debug_sql']); - define('DEBUG_TIME_LOG', $arraySystemConfiguration['debug_time']); - define('DEBUG_CALENDAR_LOG', $arraySystemConfiguration['debug_calendar']); - define('MEMCACHED_ENABLED', $arraySystemConfiguration['memcached']); - define('MEMCACHED_SERVER', $arraySystemConfiguration['memcached_server']); - define('SYS_SKIN', $arraySystemConfiguration['default_skin']); - define('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION', $arraySystemConfiguration['disable_download_documents_session_validation']); - require_once(PATH_DB . config("system.workspace") . "/db.php"); // defining constant for workspace shared directory @@ -580,13 +612,6 @@ public function loadEnvironment($workspace = "") \Propel::init(PATH_CONFIG . "databases.php"); - //Set Time Zone - /*----------------------------------********---------------------------------*/ - - ini_set('date.timezone', (isset($_SESSION['__SYSTEM_UTC_TIME_ZONE__']) && $_SESSION['__SYSTEM_UTC_TIME_ZONE__']) ? 'UTC' : $arraySystemConfiguration['time_zone']); //Set Time Zone - - define('TIME_ZONE', ini_get('date.timezone')); - $oPluginRegistry = PluginRegistry::loadSingleton(); $attributes = $oPluginRegistry->getAttributes(); Bootstrap::LoadTranslationPlugins(defined('SYS_LANG') ? SYS_LANG : "en", $attributes); @@ -611,7 +636,7 @@ public function getApiVersion() } return (isset($arrayConfig["api"]["version"]))? $arrayConfig["api"]["version"] : "1.0"; - } catch (\Exception $e) { + } catch (Exception $e) { throw $e; } } diff --git a/gulliver/js/ext/min/ext-all.js b/gulliver/js/ext/min/ext-all.js index fc8d2523c..157fc1e90 100644 --- a/gulliver/js/ext/min/ext-all.js +++ b/gulliver/js/ext/min/ext-all.js @@ -13,12 +13,12 @@ this.warning=function(title,msg,fn){Ext.MessageBox.show({id:'warningMessageBox', this.error=function(title,msg,fn){Ext.MessageBox.show({id:'errorMessageBox',title:title,msg:msg,buttons:Ext.MessageBox.OK,animEl:'mb9',fn:fn!=undefined?fn:function(){},icon:Ext.MessageBox.ERROR});} this.notify=function(title,msg,type,time) {Ext.msgBoxSlider.msg(title,msg,type,time);} -this.getBrowser=function() -{var browsersList=new Array("opera","msie","firefox","chrome","safari");var browserMeta=navigator.userAgent.toLowerCase();var name='Unknown';var version='';var screen={width:Ext.getBody().getViewSize().width,height:Ext.getBody().getViewSize().height};var so=Ext.isLinux?'Linux':(Ext.isWindows?'Windows':(Ext.isMac?'Mac OS':'Unknown'));for(var i=0;i"+v+"";},align:"right"},{width:valueColumnWidth,dataIndex:"value",renderer:function(v){return""+v+"";}},{hidden:true,dataIndex:"section"}],autoHeight:true,columnLines:true,trackMouseOver:false,disableSelection:true,view:new Ext.grid.GroupingView({forceFit:true,headersDisabled:true,groupTextTpl:'{group}'}),loadMask:true});};this.cookie={create:function(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires="; expires="+date.toGMTString();}else var expires="";document.cookie=name+"="+value+expires+"; path=/";},read:function(name){var nameEQ=name+"=";var ca=document.cookie.split(';');for(var i=0;i','
','

',t,'

',s,'
','
',''].join('');} return{msg:function(title,format,type,time){if(!msgCt){msgCt=Ext.DomHelper.insertFirst(document.body,{id:'msg-div',style:'position:absolute'},true);} var s=String.format.apply(String,Array.prototype.slice.call(arguments,1));var m=Ext.DomHelper.append(msgCt,{html:createBox(title,s)},true);m.setWidth(400);m.position(null,5000);m.alignTo(document,'br-br');type=typeof type!='undefined'?type:'';time=typeof time!='undefined'?time:PMExt.notify_time_out;switch(type){case'alert':case'warning':case'tmp-warning':image='/images/alert.gif';break;case'error':case'tmp-error':image='/images/error.png';break;case'tmp-info':case'info':image='/images/info.png';break;case'success':case'ok':image='/images/select-icon.png';break;default:image='';} @@ -69,8 +69,8 @@ function getBrowserTimeZoneOffset() {return-1*((new Date()).getTimezoneOffset()*60);} function setExtStateManagerSetProvider(cache,additionalPrefix){var workspace='ws-undefined';var pathname=location.pathname.split('/');var cookieProvider=new Ext.state.CookieProvider();var i;if(additionalPrefix===undefined){additionalPrefix='';} if(pathname.length>1){workspace=pathname[1].replace('sys','');} -workspace=workspace+additionalPrefix;cookieProvider.on('statechange',function(provider,key,value){if(value!==null&&JSON.stringify(Ext.state.Manager.get(workspace+cache))!==JSON.stringify(value)){Ext.state.Manager.set(workspace+cache,value);}});Ext.state.Manager.setProvider(cookieProvider);Ext.state.Manager.clear(cache);try{if(window.extJsViewState!==undefined){for(i in extJsViewState){Ext.state.Manager.clear(i);} -Ext.state.Manager.set(cache,Ext.state.Manager.getProvider().decodeValue(extJsViewState[workspace+cache]));}}catch(e){}} +workspace=workspace+additionalPrefix;cookieProvider.on('statechange',function(provider,key,value){if(value!==null&&JSON.stringify(Ext.state.Manager.get(workspace+window.userUid+cache))!==JSON.stringify(value)){Ext.state.Manager.set(workspace+window.userUid+cache,value);}});Ext.state.Manager.setProvider(cookieProvider);Ext.state.Manager.clear(cache);try{if(window.extJsViewState!==undefined){for(i in extJsViewState){Ext.state.Manager.clear(i);} +Ext.state.Manager.set(cache,Ext.state.Manager.getProvider().decodeValue(extJsViewState[workspace+window.userUid+cache]));}}catch(e){}} function downloadFile(method,url,headers,formData,callBack){var xhr,win=window,value='blob',loadingFile=new Ext.LoadMask(Ext.getBody(),{msg:_('ID_LOADING')});method=method||'POST';loadingFile.show();if(win.XMLHttpRequest){xhr=new XMLHttpRequest();}else if(win.ActiveXObject){xhr=new ActiveXObject('Microsoft.XMLHTTP');} win.URL=win.URL||win.webkitURL;xhr.open(method,url,true);xhr.responseType=value;Object.keys(headers).forEach(function(key){xhr.setRequestHeader(key,headers[key]);});xhr.onload=function(e){loadingFile.hide();if(xhr.status===200){if(xhr.getResponseHeader("Content-Disposition")!==null){var fileName=xhr.getResponseHeader("Content-Disposition").match(/\sfilename="([^"]+)"(\s|$)/)[1];var blob=xhr.response;if((navigator.userAgent.indexOf("MSIE")!==-1)||(navigator.userAgent.indexOf("Trident")!==-1)||(navigator.userAgent.indexOf("Edge")!==-1)){win.navigator.msSaveBlob(blob,fileName);}else{var doc=win.document,a=doc.createElementNS('http://www.w3.org/1999/xhtml','a'),event=doc.createEvent('MouseEvents');event.initMouseEvent('click',true,false,win,0,0,0,0,0,false,false,false,false,0,null);a.href=win.URL.createObjectURL(blob);a.download=fileName;a.dispatchEvent(event);} if(typeof(callBack)!=='undefined'){callBack(xhr);}}else{PMExt.error(_('ID_ERROR'),_('ID_UNEXPECTED_ERROR_OCCURRED_PLEASE'));}}else{PMExt.error(_('ID_ERROR'),xhr.statusText);}};xhr.send(formData);} diff --git a/gulliver/js/ext/pmos-common.js b/gulliver/js/ext/pmos-common.js index 8dd02d56e..d75b8b77c 100644 --- a/gulliver/js/ext/pmos-common.js +++ b/gulliver/js/ext/pmos-common.js @@ -68,31 +68,34 @@ PMExtJSCommon = function() { { Ext.msgBoxSlider.msg(title, msg, type, time); } + //TODO we need to review how many places using this kind of validation + this.escapeHtml = function (v) { + var pre = document.createElement('pre'); + var text = document.createTextNode( v ); + pre.appendChild(text); - this.getBrowser = function() - { - var browsersList = new Array("opera", "msie", "firefox", "chrome", "safari"); - var browserMeta = navigator.userAgent.toLowerCase(); - var name = 'Unknown'; - var version = ''; - var screen = { - width : Ext.getBody().getViewSize().width, - height : Ext.getBody().getViewSize().height - }; - - var so = Ext.isLinux ? 'Linux' : ( Ext.isWindows ? 'Windows' : (Ext.isMac ? 'Mac OS' : 'Unknown') ); - - for (var i = 0; i < browsersList.length; i++){ - if ((name == "") && (browserMeta.indexOf(browsersList[i]) != -1)){ - name = browsersList[i]; - version = String(parseFloat(browserMeta.substr(browserMeta.indexOf(browsersList[i]) + browsersList[i].length + 1))); - break; - } - } - - return {name:name, version:version, screen: screen} + return pre.innerHTML; } + this.getBrowser = function () { + var browsersList = ["opera", "msie", "firefox", "chrome", "safari", "trident"], + browserMeta = navigator.userAgent.toLowerCase(), + name = 'Unknown', + version = '', + screen = { + width: Ext.getBody().getViewSize().width, + height: Ext.getBody().getViewSize().height + }; + for (var i = 0; i < browsersList.length; i++) { + if ((name === "") && (browserMeta.indexOf(browsersList[i]) !== -1)) { + name = browsersList[i]; + version = String(parseFloat(browserMeta.substr(browserMeta.indexOf(browsersList[i]) + browsersList[i].length + 1))); + break; + } + } + return {name: name, version: version, screen: screen} + }; + this.createInfoPanel = function (url, params, columnsSize) { var labelColumnWidth = 170; var valueColumnWidth = 350; @@ -175,7 +178,29 @@ PMExtJSCommon = function() { Tools.createCookie(name,"",-1); } } - + this.emailConst = { + appMsgTypeWithoutTask:['EXTERNAL_REGISTRATION','TEST','CASE_NOTE','SOAP','RETRIEVE_PASSWORD'], + appMsgTypeWithConditionalTask:['PM_FUNCTION'], + appMsgTypeWithoutCase:['EXTERNAL_REGISTRATION','TEST','RETRIEVE_PASSWORD'], + appMsgTypeWithoutProcess:['EXTERNAL_REGISTRATION','TEST','RETRIEVE_PASSWORD'], + appMsgTypeWithoutNumber:['EXTERNAL_REGISTRATION','TEST','RETRIEVE_PASSWORD'], + numberColumn:{ + name:'APP_NUMBER', + defaultValue:'N/A' + }, + taskColumn:{ + name:'TAS_TITLE', + defaultValue:'N/A' + }, + caseColumn:{ + name:'APP_TITLE', + defaultValue:'N/A' + }, + processColumn:{ + name:'PRO_TITLE', + defaultValue:'N/A' + } + } } var PMExt = new PMExtJSCommon(); @@ -562,11 +587,11 @@ function getBrowserTimeZoneOffset() } /** - * This is the global state manager. By default all components that are - * "state aware" check this class for state information if you don't pass them a - * custom state provider. In order for this class to be useful, it must be + * This is the global state manager. By default all components that are + * "state aware" check this class for state information if you don't pass them a + * custom state provider. In order for this class to be useful, it must be * initialized with a provider when your application initializes. - * + * * @param {string} cache * @param {string} additionalPrefix * @returns {undefined} @@ -584,8 +609,8 @@ function setExtStateManagerSetProvider(cache, additionalPrefix) { } workspace = workspace + additionalPrefix; cookieProvider.on('statechange', function (provider, key, value) { - if (value !== null && JSON.stringify(Ext.state.Manager.get(workspace + cache)) !== JSON.stringify(value)) { - Ext.state.Manager.set(workspace + cache, value); + if (value !== null && JSON.stringify(Ext.state.Manager.get(workspace + window.userUid + cache)) !== JSON.stringify(value)) { + Ext.state.Manager.set(workspace + window.userUid + cache, value); } }); Ext.state.Manager.setProvider(cookieProvider); @@ -595,7 +620,7 @@ function setExtStateManagerSetProvider(cache, additionalPrefix) { for (i in extJsViewState) { Ext.state.Manager.clear(i); } - Ext.state.Manager.set(cache, Ext.state.Manager.getProvider().decodeValue(extJsViewState[workspace + cache])); + Ext.state.Manager.set(cache, Ext.state.Manager.getProvider().decodeValue(extJsViewState[workspace + window.userUid + cache])); } } catch (e) { } diff --git a/gulliver/js/form/core/form.js b/gulliver/js/form/core/form.js index 3c5d1e24f..30878c613 100644 --- a/gulliver/js/form/core/form.js +++ b/gulliver/js/form/core/form.js @@ -346,71 +346,70 @@ function G_Text(form, element, name) this.parent = G_Field; this.browser = {}; this.comma_separator = "."; - - this.checkBrowser = function(){ - var nVer = navigator.appVersion; - var nAgt = navigator.userAgent; - //alert(navigator.userAgent); - var browserName = navigator.appName; - var fullVersion = ''+parseFloat(navigator.appVersion); - var majorVersion = parseInt(navigator.appVersion,10); - var nameOffset,verOffset,ix; + /** + * Gets the user client browser and its version + */ + this.checkBrowser = function () { + var nAgt = navigator.userAgent.toLowerCase(), + browserName = navigator.appName, + fullVersion = '' + parseFloat(navigator.appVersion), + majorVersion, + nameOffset, + verOffset, + ix; // In Opera, the true version is after "Opera" or after "Version" - if ((verOffset=nAgt.indexOf("Opera"))!=-1) { - browserName = "Opera"; - fullVersion = nAgt.substring(verOffset+6); - if ((verOffset=nAgt.indexOf("Version"))!=-1) - fullVersion = nAgt.substring(verOffset+8); - } - // In MSIE, the true version is after "MSIE" in userAgent - else if ((verOffset=nAgt.indexOf("MSIE"))!=-1) { - browserName = "Microsoft Internet Explorer"; - fullVersion = nAgt.substring(verOffset+5); - } - // In Chrome, the true version is after "Chrome" - else if ((verOffset=nAgt.indexOf("Chrome"))!=-1) { - browserName = "Chrome"; - fullVersion = nAgt.substring(verOffset+7); - } - // In Safari, the true version is after "Safari" or after "Version" - else if ((verOffset=nAgt.indexOf("Safari"))!=-1) { - browserName = "Safari"; - fullVersion = nAgt.substring(verOffset+7); - if ((verOffset=nAgt.indexOf("Version"))!=-1) - fullVersion = nAgt.substring(verOffset+8); - } - // In Firefox, the true version is after "Firefox" - else if ((verOffset=nAgt.indexOf("Firefox"))!=-1) { - browserName = "Firefox"; - fullVersion = nAgt.substring(verOffset+8); - } - // In most other browsers, "name/version" is at the end of userAgent - else if ( (nameOffset=nAgt.lastIndexOf(' ')+1) < - (verOffset=nAgt.lastIndexOf('/')) ) - { - browserName = nAgt.substring(nameOffset,verOffset); - fullVersion = nAgt.substring(verOffset+1); - if (browserName.toLowerCase()==browserName.toUpperCase()) { - browserName = navigator.appName; - } + if ((verOffset = nAgt.indexOf("opera")) !== -1) { + browserName = "Opera"; + fullVersion = nAgt.substring(verOffset + 6); + if ((verOffset = nAgt.indexOf("version")) !== -1) { + fullVersion = nAgt.substring(verOffset + 8); + } + // In MSIE, the true version is after "MSIE" or "Trident" in userAgent + } else if ((verOffset = nAgt.indexOf("msie")) !== -1 || (verOffset = nAgt.indexOf("trident")) !== -1) { + browserName = "Microsoft Internet Explorer"; + fullVersion = nAgt.substring(verOffset + 5); + // In Chrome, the true version is after "Chrome" + } else if ((verOffset = nAgt.indexOf("chrome")) !== -1) { + browserName = "Chrome"; + fullVersion = nAgt.substring(verOffset + 7); + // In Safari, the true version is after "Safari" or after "Version" + } else if ((verOffset = nAgt.indexOf("safari")) !== -1) { + browserName = "Safari"; + fullVersion = nAgt.substring(verOffset + 7); + if ((verOffset = nAgt.indexOf("version")) !== -1) + fullVersion = nAgt.substring(verOffset + 8); + // In Firefox, the true version is after "Firefox" + } else if ((verOffset = nAgt.indexOf("firefox")) !== -1) { + browserName = "Firefox"; + fullVersion = nAgt.substring(verOffset + 8); + // In most other browsers, "name/version" is at the end of userAgent + } else if ((nameOffset = nAgt.lastIndexOf(' ') + 1) < + (verOffset = nAgt.lastIndexOf('/'))) { + browserName = nAgt.substring(nameOffset, verOffset); + fullVersion = nAgt.substring(verOffset + 1); + if (browserName.toLowerCase() === browserName.toUpperCase()) { + browserName = navigator.appName; + } } // trim the fullVersion string at semicolon/space if present - if ((ix=fullVersion.indexOf(";"))!=-1) - fullVersion=fullVersion.substring(0,ix); - if ((ix=fullVersion.indexOf(" "))!=-1) - fullVersion=fullVersion.substring(0,ix); + if ((ix = fullVersion.indexOf(";")) !== -1) { + fullVersion = fullVersion.substring(0, ix); + } + if ((ix = fullVersion.indexOf(" ")) !== -1) { + fullVersion = fullVersion.substring(0, ix); + } - majorVersion = parseInt(''+fullVersion,10); + majorVersion = parseInt('' + fullVersion, 10); if (isNaN(majorVersion)) { - fullVersion = ''+parseFloat(navigator.appVersion); - majorVersion = parseInt(navigator.appVersion,10); + fullVersion = '' + parseFloat(navigator.appVersion); + majorVersion = parseInt(navigator.appVersion, 10); } this.browser = { - name: browserName, - fullVersion: fullVersion, - majorVersion: majorVersion, - userAgent: navigator.userAgent + name: browserName, + fullVersion: fullVersion, + majorVersion: majorVersion, + userAgent: navigator.userAgent }; }; @@ -3227,7 +3226,7 @@ var validateForm = function(sRequiredFields) { var systemMessaggeInvalid = ""; if(invalid_fields.length > 0) { - systemMessaggeInvalid += "\n \n" + _('ID_REQUIRED_FIELDS_GRID'); + systemMessaggeInvalid += "\n \n" + _('ID_REQUIRED_FIELDS_GRID'); } if(fielEmailInvalid.length > 0) { diff --git a/gulliver/js/i18next/i18next.min.js b/gulliver/js/i18next/i18next.min.js new file mode 100644 index 000000000..e3c3fc389 --- /dev/null +++ b/gulliver/js/i18next/i18next.min.js @@ -0,0 +1,2 @@ +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.i18next=e()}(this,function(){"use strict";function t(t){return null==t?"":""+t}function e(t,e,n){t.forEach(function(t){e[t]&&(n[t]=e[t])})}function n(t,e,n){function o(t){return t&&t.indexOf("###")>-1?t.replace(/###/g,"."):t}function r(){return!t||"string"==typeof t}for(var i="string"!=typeof e?[].concat(e):e.split(".");i.length>1;){if(r())return{};var s=o(i.shift());!t[s]&&n&&(t[s]=new n),t=t[s]}return r()?{}:{obj:t,k:o(i.shift())}}function o(t,e,o){var r=n(t,e,Object);r.obj[r.k]=o}function r(t,e,o,r){var i=n(t,e,Object),s=i.obj,a=i.k;s[a]=s[a]||[],r&&(s[a]=s[a].concat(o)),r||s[a].push(o)}function i(t,e){var o=n(t,e),r=o.obj,i=o.k;if(r)return r[i]}function s(t,e,n){for(var o in e)o in t?"string"==typeof t[o]||t[o]instanceof String||"string"==typeof e[o]||e[o]instanceof String?n&&(t[o]=e[o]):s(t[o],e[o],n):t[o]=e[o];return t}function a(t){return t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")}function u(t){return"string"==typeof t?t.replace(/[&<>"'\/]/g,function(t){return L[t]}):t}function l(t){return t.charAt(0).toUpperCase()+t.slice(1)}function p(){var t={};return P.forEach(function(e){e.lngs.forEach(function(n){t[n]={numbers:e.nr,plurals:F[e.fc]}})}),t}function c(t,e){for(var n=t.indexOf(e);-1!==n;)t.splice(n,1),n=t.indexOf(e)}function f(){return{debug:!1,initImmediate:!0,ns:["translation"],defaultNS:["translation"],fallbackLng:["dev"],fallbackNS:!1,whitelist:!1,nonExplicitWhitelist:!1,load:"all",preload:!1,simplifyPluralSuffix:!0,keySeparator:".",nsSeparator:":",pluralSeparator:"_",contextSeparator:"_",saveMissing:!1,updateMissing:!1,saveMissingTo:"fallback",saveMissingPlurals:!0,missingKeyHandler:!1,missingInterpolationHandler:!1,postProcess:!1,returnNull:!0,returnEmptyString:!0,returnObjects:!1,joinArrays:!1,returnedObjectHandler:function(){},parseMissingKeyHandler:!1,appendNamespaceToMissingKey:!1,appendNamespaceToCIMode:!1,overloadTranslationOptionHandler:function(t){var e={};return t[1]&&(e.defaultValue=t[1]),t[2]&&(e.tDescription=t[2]),e},interpolation:{escapeValue:!0,format:function(t,e,n){return t},prefix:"{{",suffix:"}}",formatSeparator:",",unescapePrefix:"-",nestingPrefix:"$t(",nestingSuffix:")",maxReplaces:1e3}}}function h(t){return"string"==typeof t.ns&&(t.ns=[t.ns]),"string"==typeof t.fallbackLng&&(t.fallbackLng=[t.fallbackLng]),"string"==typeof t.fallbackNS&&(t.fallbackNS=[t.fallbackNS]),t.whitelist&&t.whitelist.indexOf("cimode")<0&&(t.whitelist=t.whitelist.concat(["cimode"])),t}function g(){}var d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},y=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},v=Object.assign||function(t){for(var e=1;e1&&void 0!==arguments[1]?arguments[1]:{};y(this,t),this.init(e,n)}return t.prototype.init=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.prefix=e.prefix||"i18next:",this.logger=t||k,this.options=e,this.debug=e.debug},t.prototype.setDebug=function(t){this.debug=t},t.prototype.log=function(){for(var t=arguments.length,e=Array(t),n=0;n-1&&n.observers[t].splice(o,1)}else delete n.observers[t]})},t.prototype.emit=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),o=1;o":">",'"':""","'":"'","/":"/"},N=function(t){function e(n){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{ns:["translation"],defaultNS:"translation"};y(this,e);var r=b(this,t.call(this));return r.data=n||{},r.options=o,void 0===r.options.keySeparator&&(r.options.keySeparator="."),r}return m(e,t),e.prototype.addNamespaces=function(t){this.options.ns.indexOf(t)<0&&this.options.ns.push(t)},e.prototype.removeNamespaces=function(t){var e=this.options.ns.indexOf(t);e>-1&&this.options.ns.splice(e,1)},e.prototype.getResource=function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=void 0!==o.keySeparator?o.keySeparator:this.options.keySeparator,s=[t,e];return n&&"string"!=typeof n&&(s=s.concat(n)),n&&"string"==typeof n&&(s=s.concat(r?n.split(r):n)),t.indexOf(".")>-1&&(s=t.split(".")),i(this.data,s)},e.prototype.addResource=function(t,e,n,r){var i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{silent:!1},s=this.options.keySeparator;void 0===s&&(s=".");var a=[t,e];n&&(a=a.concat(s?n.split(s):n)),t.indexOf(".")>-1&&(a=t.split("."),r=e,e=a[1]),this.addNamespaces(e),o(this.data,a,r),i.silent||this.emit("added",t,e,n,r)},e.prototype.addResources=function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{silent:!1};for(var r in n)"string"==typeof n[r]&&this.addResource(t,e,r,n[r],{silent:!0});o.silent||this.emit("added",t,e,n)},e.prototype.addResourceBundle=function(t,e,n,r,a){var u=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{silent:!1},l=[t,e];t.indexOf(".")>-1&&(l=t.split("."),r=n,n=e,e=l[1]),this.addNamespaces(e);var p=i(this.data,l)||{};r?s(p,n,a):p=v({},p,n),o(this.data,l,p),u.silent||this.emit("added",t,e,n)},e.prototype.removeResourceBundle=function(t,e){this.hasResourceBundle(t,e)&&delete this.data[t][e],this.removeNamespaces(e),this.emit("removed",t,e)},e.prototype.hasResourceBundle=function(t,e){return void 0!==this.getResource(t,e)},e.prototype.getResourceBundle=function(t,e){return e||(e=this.options.defaultNS),"v1"===this.options.compatibilityAPI?v({},this.getResource(t,e)):this.getResource(t,e)},e.prototype.getDataByLanguage=function(t){return this.data[t]},e.prototype.toJSON=function(){return this.data},e}(R),C={processors:{},addPostProcessor:function(t){this.processors[t.name]=t},handle:function(t,e,n,o,r){var i=this;return t.forEach(function(t){i.processors[t]&&(e=i.processors[t].process(e,n,o,r))}),e}},j=function(t){function n(o){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};y(this,n);var i=b(this,t.call(this));return e(["resourceStore","languageUtils","pluralResolver","interpolator","backendConnector","i18nFormat"],o,i),i.options=r,void 0===i.options.keySeparator&&(i.options.keySeparator="."),i.logger=O.create("translator"),i}return m(n,t),n.prototype.changeLanguage=function(t){t&&(this.language=t)},n.prototype.exists=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{interpolation:{}},n=this.resolve(t,e);return n&&void 0!==n.res},n.prototype.extractFromKey=function(t,e){var n=e.nsSeparator||this.options.nsSeparator;void 0===n&&(n=":");var o=void 0!==e.keySeparator?e.keySeparator:this.options.keySeparator,r=e.ns||this.options.defaultNS;if(n&&t.indexOf(n)>-1){var i=t.split(n);(n!==o||n===o&&this.options.ns.indexOf(i[0])>-1)&&(r=i.shift()),t=i.join(o)}return"string"==typeof r&&(r=[r]),{key:t,namespaces:r}},n.prototype.translate=function(t,e){var n=this;if("object"!==(void 0===e?"undefined":d(e))&&this.options.overloadTranslationOptionHandler&&(e=this.options.overloadTranslationOptionHandler(arguments)),e||(e={}),void 0===t||null===t||""===t)return"";"number"==typeof t&&(t=String(t)),"string"==typeof t&&(t=[t]);var o=void 0!==e.keySeparator?e.keySeparator:this.options.keySeparator,r=this.extractFromKey(t[t.length-1],e),i=r.key,s=r.namespaces,a=s[s.length-1],u=e.lng||this.language,l=e.appendNamespaceToCIMode||this.options.appendNamespaceToCIMode;if(u&&"cimode"===u.toLowerCase()){if(l){var p=e.nsSeparator||this.options.nsSeparator;return a+p+i}return i}var c=this.resolve(t,e),f=c&&c.res,h=c&&c.usedKey||i,g=Object.prototype.toString.apply(f),y=["[object Number]","[object Function]","[object RegExp]"],m=void 0!==e.joinArrays?e.joinArrays:this.options.joinArrays,b=!this.i18nFormat||this.i18nFormat.handleAsObject,x="string"!=typeof f&&"boolean"!=typeof f&&"number"!=typeof f;if(b&&f&&x&&y.indexOf(g)<0&&(!m||"[object Array]"!==g)){if(!e.returnObjects&&!this.options.returnObjects)return this.logger.warn("accessing an object - but returnObjects options is not enabled!"),this.options.returnedObjectHandler?this.options.returnedObjectHandler(h,f,e):"key '"+i+" ("+this.language+")' returned an object instead of string.";if(o){var S="[object Array]"===g?[]:{};for(var k in f)if(Object.prototype.hasOwnProperty.call(f,k)){var w=""+h+o+k;S[k]=this.translate(w,v({},e,{joinArrays:!1,ns:s})),S[k]===w&&(S[k]=f[k])}f=S}}else if(b&&m&&"[object Array]"===g)(f=f.join(m))&&(f=this.extendTranslation(f,t,e));else{var O=!1,R=!1;if(!this.isValidLookup(f)&&void 0!==e.defaultValue){if(O=!0,void 0!==e.count){var L=this.pluralResolver.getSuffix(u,e.count);f=e["defaultValue"+L]}f||(f=e.defaultValue)}this.isValidLookup(f)||(R=!0,f=i);var N=e.defaultValue&&e.defaultValue!==f&&this.options.updateMissing;if(R||O||N){this.logger.log(N?"updateKey":"missingKey",u,a,i,N?e.defaultValue:f);var C=[],j=this.languageUtils.getFallbackCodes(this.options.fallbackLng,e.lng||this.language);if("fallback"===this.options.saveMissingTo&&j&&j[0])for(var E=0;E1&&void 0!==arguments[1]?arguments[1]:{},o=void 0,r=void 0,i=void 0,s=void 0;return"string"==typeof t&&(t=[t]),t.forEach(function(t){if(!e.isValidLookup(o)){var a=e.extractFromKey(t,n),u=a.key;r=u;var l=a.namespaces;e.options.fallbackNS&&(l=l.concat(e.options.fallbackNS));var p=void 0!==n.count&&"string"!=typeof n.count,c=void 0!==n.context&&"string"==typeof n.context&&""!==n.context,f=n.lngs?n.lngs:e.languageUtils.toResolveHierarchy(n.lng||e.language);l.forEach(function(t){e.isValidLookup(o)||(s=t,f.forEach(function(r){if(!e.isValidLookup(o)){i=r;var s=u,a=[s];if(e.i18nFormat&&e.i18nFormat.addLookupKeys)e.i18nFormat.addLookupKeys(a,u,r,t,n);else{var l=void 0;p&&(l=e.pluralResolver.getSuffix(r,n.count)),p&&c&&a.push(s+l),c&&a.push(s+=""+e.options.contextSeparator+n.context),p&&a.push(s+=l)}for(var f=void 0;f=a.pop();)e.isValidLookup(o)||(o=e.getResource(r,t,f,n))}}))})}}),{res:o,usedKey:r,usedLng:i,usedNS:s}},n.prototype.isValidLookup=function(t){return!(void 0===t||!this.options.returnNull&&null===t||!this.options.returnEmptyString&&""===t)},n.prototype.getResource=function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return this.i18nFormat&&this.i18nFormat.getResource?this.i18nFormat.getResource(t,e,n,o):this.resourceStore.getResource(t,e,n,o)},n}(R),E=function(){function t(e){y(this,t),this.options=e,this.whitelist=this.options.whitelist||!1,this.logger=O.create("languageUtils")}return t.prototype.getScriptPartFromCode=function(t){if(!t||t.indexOf("-")<0)return null;var e=t.split("-");return 2===e.length?null:(e.pop(),this.formatLanguageCode(e.join("-")))},t.prototype.getLanguagePartFromCode=function(t){if(!t||t.indexOf("-")<0)return t;var e=t.split("-");return this.formatLanguageCode(e[0])},t.prototype.formatLanguageCode=function(t){if("string"==typeof t&&t.indexOf("-")>-1){var e=["hans","hant","latn","cyrl","cans","mong","arab"],n=t.split("-");return this.options.lowerCaseLng?n=n.map(function(t){return t.toLowerCase()}):2===n.length?(n[0]=n[0].toLowerCase(),n[1]=n[1].toUpperCase(),e.indexOf(n[1].toLowerCase())>-1&&(n[1]=l(n[1].toLowerCase()))):3===n.length&&(n[0]=n[0].toLowerCase(),2===n[1].length&&(n[1]=n[1].toUpperCase()),"sgn"!==n[0]&&2===n[2].length&&(n[2]=n[2].toUpperCase()),e.indexOf(n[1].toLowerCase())>-1&&(n[1]=l(n[1].toLowerCase())),e.indexOf(n[2].toLowerCase())>-1&&(n[2]=l(n[2].toLowerCase()))),n.join("-")}return this.options.cleanCode||this.options.lowerCaseLng?t.toLowerCase():t},t.prototype.isWhitelisted=function(t){return("languageOnly"===this.options.load||this.options.nonExplicitWhitelist)&&(t=this.getLanguagePartFromCode(t)),!this.whitelist||!this.whitelist.length||this.whitelist.indexOf(t)>-1},t.prototype.getFallbackCodes=function(t,e){if(!t)return[];if("string"==typeof t&&(t=[t]),"[object Array]"===Object.prototype.toString.apply(t))return t;if(!e)return t.default||[];var n=t[e];return n||(n=t[this.getScriptPartFromCode(e)]),n||(n=t[this.formatLanguageCode(e)]),n||(n=t.default),n||[]},t.prototype.toResolveHierarchy=function(t,e){var n=this,o=this.getFallbackCodes(e||this.options.fallbackLng||[],t),r=[],i=function(t){t&&(n.isWhitelisted(t)?r.push(t):n.logger.warn("rejecting non-whitelisted language code: "+t))};return"string"==typeof t&&t.indexOf("-")>-1?("languageOnly"!==this.options.load&&i(this.formatLanguageCode(t)),"languageOnly"!==this.options.load&&"currentOnly"!==this.options.load&&i(this.getScriptPartFromCode(t)),"currentOnly"!==this.options.load&&i(this.getLanguagePartFromCode(t))):"string"==typeof t&&i(this.formatLanguageCode(t)),o.forEach(function(t){r.indexOf(t)<0&&i(n.formatLanguageCode(t))}),r},t}(),P=[{lngs:["ach","ak","am","arn","br","fil","gun","ln","mfe","mg","mi","oc","pt","pt-BR","tg","ti","tr","uz","wa"],nr:[1,2],fc:1},{lngs:["af","an","ast","az","bg","bn","ca","da","de","dev","el","en","eo","es","et","eu","fi","fo","fur","fy","gl","gu","ha","he","hi","hu","hy","ia","it","kn","ku","lb","mai","ml","mn","mr","nah","nap","nb","ne","nl","nn","no","nso","pa","pap","pms","ps","pt-PT","rm","sco","se","si","so","son","sq","sv","sw","ta","te","tk","ur","yo"],nr:[1,2],fc:2},{lngs:["ay","bo","cgg","fa","id","ja","jbo","ka","kk","km","ko","ky","lo","ms","sah","su","th","tt","ug","vi","wo","zh"],nr:[1],fc:3},{lngs:["be","bs","dz","hr","ru","sr","uk"],nr:[1,2,5],fc:4},{lngs:["ar"],nr:[0,1,2,3,11,100],fc:5},{lngs:["cs","sk"],nr:[1,2,5],fc:6},{lngs:["csb","pl"],nr:[1,2,5],fc:7},{lngs:["cy"],nr:[1,2,3,8],fc:8},{lngs:["fr"],nr:[1,2],fc:9},{lngs:["ga"],nr:[1,2,3,7,11],fc:10},{lngs:["gd"],nr:[1,2,3,20],fc:11},{lngs:["is"],nr:[1,2],fc:12},{lngs:["jv"],nr:[0,1],fc:13},{lngs:["kw"],nr:[1,2,3,4],fc:14},{lngs:["lt"],nr:[1,2,10],fc:15},{lngs:["lv"],nr:[1,2,0],fc:16},{lngs:["mk"],nr:[1,2],fc:17},{lngs:["mnk"],nr:[0,1,2],fc:18},{lngs:["mt"],nr:[1,2,11,20],fc:19},{lngs:["or"],nr:[2,1],fc:2},{lngs:["ro"],nr:[1,2,20],fc:20},{lngs:["sl"],nr:[5,1,2,3],fc:21}],F={1:function(t){return Number(t>1)},2:function(t){return Number(1!=t)},3:function(t){return 0},4:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},5:function(t){return Number(0===t?0:1==t?1:2==t?2:t%100>=3&&t%100<=10?3:t%100>=11?4:5)},6:function(t){return Number(1==t?0:t>=2&&t<=4?1:2)},7:function(t){return Number(1==t?0:t%10>=2&&t%10<=4&&(t%100<10||t%100>=20)?1:2)},8:function(t){return Number(1==t?0:2==t?1:8!=t&&11!=t?2:3)},9:function(t){return Number(t>=2)},10:function(t){return Number(1==t?0:2==t?1:t<7?2:t<11?3:4)},11:function(t){return Number(1==t||11==t?0:2==t||12==t?1:t>2&&t<20?2:3)},12:function(t){return Number(t%10!=1||t%100==11)},13:function(t){return Number(0!==t)},14:function(t){return Number(1==t?0:2==t?1:3==t?2:3)},15:function(t){return Number(t%10==1&&t%100!=11?0:t%10>=2&&(t%100<10||t%100>=20)?1:2)},16:function(t){return Number(t%10==1&&t%100!=11?0:0!==t?1:2)},17:function(t){return Number(1==t||t%10==1?0:1)},18:function(t){return Number(0==t?0:1==t?1:2)},19:function(t){return Number(1==t?0:0===t||t%100>1&&t%100<11?1:t%100>10&&t%100<20?2:3)},20:function(t){return Number(1==t?0:0===t||t%100>0&&t%100<20?1:2)},21:function(t){return Number(t%100==1?1:t%100==2?2:t%100==3||t%100==4?3:0)}},A=function(){function t(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};y(this,t),this.languageUtils=e,this.options=n,this.logger=O.create("pluralResolver"),this.rules=p()}return t.prototype.addRule=function(t,e){this.rules[t]=e},t.prototype.getRule=function(t){return this.rules[t]||this.rules[this.languageUtils.getLanguagePartFromCode(t)]},t.prototype.needsPlural=function(t){var e=this.getRule(t);return e&&e.numbers.length>1},t.prototype.getPluralFormsOfKey=function(t,e){var n=this,o=[],r=this.getRule(t);return r?(r.numbers.forEach(function(r){var i=n.getSuffix(t,r);o.push(""+e+i)}),o):o},t.prototype.getSuffix=function(t,e){var n=this,o=this.getRule(t);if(o){var r=o.noAbs?o.plurals(e):o.plurals(Math.abs(e)),i=o.numbers[r];this.options.simplifyPluralSuffix&&2===o.numbers.length&&1===o.numbers[0]&&(2===i?i="plural":1===i&&(i=""));var s=function(){return n.options.prepend&&i.toString()?n.options.prepend+i.toString():i.toString()};return"v1"===this.options.compatibilityJSON?1===i?"":"number"==typeof i?"_plural_"+i.toString():s():"v2"===this.options.compatibilityJSON&&2===o.numbers.length&&1===o.numbers[0]?s():this.options.simplifyPluralSuffix&&2===o.numbers.length&&1===o.numbers[0]?s():this.options.prepend&&r.toString()?this.options.prepend+r.toString():r.toString()}return this.logger.warn("no plural rule found for: "+t),""},t}(),T=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};y(this,e),this.logger=O.create("interpolator"),this.init(t,!0)}return e.prototype.init=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};arguments[1]&&(this.options=t,this.format=t.interpolation&&t.interpolation.format||function(t){return t}),t.interpolation||(t.interpolation={escapeValue:!0});var e=t.interpolation;this.escape=void 0!==e.escape?e.escape:u,this.escapeValue=void 0===e.escapeValue||e.escapeValue,this.useRawValueToEscape=void 0!==e.useRawValueToEscape&&e.useRawValueToEscape,this.prefix=e.prefix?a(e.prefix):e.prefixEscaped||"{{",this.suffix=e.suffix?a(e.suffix):e.suffixEscaped||"}}",this.formatSeparator=e.formatSeparator?e.formatSeparator:e.formatSeparator||",",this.unescapePrefix=e.unescapeSuffix?"":e.unescapePrefix||"-",this.unescapeSuffix=this.unescapePrefix?"":e.unescapeSuffix||"",this.nestingPrefix=e.nestingPrefix?a(e.nestingPrefix):e.nestingPrefixEscaped||a("$t("),this.nestingSuffix=e.nestingSuffix?a(e.nestingSuffix):e.nestingSuffixEscaped||a(")"),this.maxReplaces=e.maxReplaces?e.maxReplaces:1e3,this.resetRegExp()},e.prototype.reset=function(){this.options&&this.init(this.options)},e.prototype.resetRegExp=function(){var t=this.prefix+"(.+?)"+this.suffix;this.regexp=new RegExp(t,"g");var e=""+this.prefix+this.unescapePrefix+"(.+?)"+this.unescapeSuffix+this.suffix;this.regexpUnescape=new RegExp(e,"g");var n=this.nestingPrefix+"(.+?)"+this.nestingSuffix;this.nestingRegexp=new RegExp(n,"g")},e.prototype.interpolate=function(e,n,o){function r(t){return t.replace(/\$/g,"$$$$")}var s=this,a=void 0,u=void 0,l=void 0,p=function(t){if(t.indexOf(s.formatSeparator)<0)return i(n,t);var e=t.split(s.formatSeparator),r=e.shift().trim(),a=e.join(s.formatSeparator).trim();return s.format(i(n,r),a,o)};for(this.resetRegExp(),l=0;(a=this.regexpUnescape.exec(e))&&(u=p(a[1].trim()),e=e.replace(a[0],u),this.regexpUnescape.lastIndex=0,!(++l>=this.maxReplaces)););for(l=0;a=this.regexp.exec(e);){if(void 0===(u=p(a[1].trim())))if("function"==typeof this.options.missingInterpolationHandler){var c=this.options.missingInterpolationHandler(e,a);u="string"==typeof c?c:""}else this.logger.warn("missed to pass in variable "+a[1]+" for interpolating "+e),u="";else"string"==typeof u||this.useRawValueToEscape||(u=t(u));if(u=r(this.escapeValue?this.escape(u):u),e=e.replace(a[0],u),this.regexp.lastIndex=0,++l>=this.maxReplaces)break}return e},e.prototype.nest=function(e,n){function o(t,e){if(t.indexOf(",")<0)return t;var n=t.split(",");t=n.shift();var o=n.join(",");o=this.interpolate(o,a),o=o.replace(/'/g,'"');try{a=JSON.parse(o),e&&(a=v({},e,a))}catch(e){this.logger.error("failed parsing options string in nesting for key "+t,e)}return t}var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=void 0,s=void 0,a=v({},r);for(a.applyPostProcessor=!1;i=this.nestingRegexp.exec(e);){if((s=n(o.call(this,i[1].trim(),a),a))&&i[0]===e&&"string"!=typeof s)return s;"string"!=typeof s&&(s=t(s)),s||(this.logger.warn("missed to resolve "+i[1]+" for nesting "+e),s=""),e=e.replace(i[0],s),this.regexp.lastIndex=0}return e},e}(),V=function(t){function e(n,o,r){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};y(this,e);var s=b(this,t.call(this));return s.backend=n,s.store=o,s.languageUtils=r.languageUtils,s.options=i,s.logger=O.create("backendConnector"),s.state={},s.queue=[],s.backend&&s.backend.init&&s.backend.init(r,i.backend,i),s}return m(e,t),e.prototype.queueLoad=function(t,e,n,o){var r=this,i=[],s=[],a=[],u=[];return t.forEach(function(t){var o=!0;e.forEach(function(e){var a=t+"|"+e;!n.reload&&r.store.hasResourceBundle(t,e)?r.state[a]=2:r.state[a]<0||(1===r.state[a]?s.indexOf(a)<0&&s.push(a):(r.state[a]=1,o=!1,s.indexOf(a)<0&&s.push(a),i.indexOf(a)<0&&i.push(a),u.indexOf(e)<0&&u.push(e)))}),o||a.push(t)}),(i.length||s.length)&&this.queue.push({pending:s,loaded:{},errors:[],callback:o}),{toLoad:i,pending:s,toLoadLanguages:a,toLoadNamespaces:u}},e.prototype.loaded=function(t,e,n){var o=t.split("|"),i=x(o,2),s=i[0],a=i[1];e&&this.emit("failedLoading",s,a,e),n&&this.store.addResourceBundle(s,a,n),this.state[t]=e?-1:2;var u={};this.queue.forEach(function(n){r(n.loaded,[s],a),c(n.pending,t),e&&n.errors.push(e),0!==n.pending.length||n.done||(Object.keys(n.loaded).forEach(function(t){u[t]||(u[t]=[]),n.loaded[t].length&&n.loaded[t].forEach(function(e){u[t].indexOf(e)<0&&u[t].push(e)})}),n.done=!0,n.errors.length?n.callback(n.errors):n.callback())}),this.emit("loaded",u),this.queue=this.queue.filter(function(t){return!t.done})},e.prototype.read=function(t,e,n){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,r=this,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:250,s=arguments[5];return t.length?this.backend[n](t,e,function(a,u){if(a&&u&&o<5)return void setTimeout(function(){r.read.call(r,t,e,n,o+1,2*i,s)},i);s(a,u)}):s(null,{})},e.prototype.prepareLoading=function(t,e){var n=this,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments[3];if(!this.backend)return this.logger.warn("No backend was added via i18next.use. Will not load resources."),r&&r();"string"==typeof t&&(t=this.languageUtils.toResolveHierarchy(t)),"string"==typeof e&&(e=[e]);var i=this.queueLoad(t,e,o,r);if(!i.toLoad.length)return i.pending.length||r(),null;i.toLoad.forEach(function(t){n.loadOne(t)})},e.prototype.load=function(t,e,n){this.prepareLoading(t,e,{},n)},e.prototype.reload=function(t,e,n){this.prepareLoading(t,e,{reload:!0},n)},e.prototype.loadOne=function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",o=t.split("|"),r=x(o,2),i=r[0],s=r[1];this.read(i,s,"read",null,null,function(o,r){o&&e.logger.warn(n+"loading namespace "+s+" for language "+i+" failed",o),!o&&r&&e.logger.log(n+"loaded namespace "+s+" for language "+i,r),e.loaded(t,o,r)})},e.prototype.saveMissing=function(t,e,n,o,r){var i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.backend&&this.backend.create&&this.backend.create(t,e,n,o,null,v({},i,{isUpdate:r})),t&&t[0]&&this.store.addResource(t[0],e,n,o)},e}(R);return new(function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments[1];y(this,e);var r=b(this,t.call(this));if(r.options=h(n),r.services={},r.logger=O,r.modules={external:[]},o&&!r.isInitialized&&!n.isClone){var i;if(!r.options.initImmediate)return i=r.init(n,o),b(r,i);setTimeout(function(){r.init(n,o)},0)}return r}return m(e,t),e.prototype.init=function(){function t(t){return t?"function"==typeof t?new t:t:null}var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments[1];if("function"==typeof n&&(o=n,n={}),this.options=v({},f(),this.options,h(n)),this.format=this.options.interpolation.format,o||(o=g),!this.options.isClone){this.modules.logger?O.init(t(this.modules.logger),this.options):O.init(null,this.options);var r=new E(this.options);this.store=new N(this.options.resources,this.options);var i=this.services;i.logger=O,i.resourceStore=this.store,i.languageUtils=r,i.pluralResolver=new A(r,{prepend:this.options.pluralSeparator,compatibilityJSON:this.options.compatibilityJSON,simplifyPluralSuffix:this.options.simplifyPluralSuffix}),i.interpolator=new T(this.options),i.backendConnector=new V(t(this.modules.backend),i.resourceStore,i,this.options),i.backendConnector.on("*",function(t){for(var n=arguments.length,o=Array(n>1?n-1:0),r=1;r1?n-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:g;if(this.options.resources)e(null);else{if(this.language&&"cimode"===this.language.toLowerCase())return e();var n=[],o=function(e){if(e){t.services.languageUtils.toResolveHierarchy(e).forEach(function(t){n.indexOf(t)<0&&n.push(t)})}};if(this.language)o(this.language);else{this.services.languageUtils.getFallbackCodes(this.options.fallbackLng).forEach(function(t){return o(t)})}this.options.preload&&this.options.preload.forEach(function(t){return o(t)}),this.services.backendConnector.load(n,this.options.ns,e)}},e.prototype.reloadResources=function(t,e,n){t||(t=this.languages),e||(e=this.options.ns),n||(n=function(){}),this.services.backendConnector.reload(t,e,n)},e.prototype.use=function(t){return"backend"===t.type&&(this.modules.backend=t),("logger"===t.type||t.log&&t.warn&&t.error)&&(this.modules.logger=t),"languageDetector"===t.type&&(this.modules.languageDetector=t),"i18nFormat"===t.type&&(this.modules.i18nFormat=t),"postProcessor"===t.type&&C.addPostProcessor(t),"3rdParty"===t.type&&this.modules.external.push(t),this},e.prototype.changeLanguage=function(t,e){var n=this,o=function(t,o){n.translator.changeLanguage(o),o&&(n.emit("languageChanged",o),n.logger.log("languageChanged",o)),e&&e(t,function(){return n.t.apply(n,arguments)})},r=function(t){t&&(n.language=t,n.languages=n.services.languageUtils.toResolveHierarchy(t),n.translator.language||n.translator.changeLanguage(t),n.services.languageDetector&&n.services.languageDetector.cacheUserLanguage(t)),n.loadResources(function(e){o(e,t)})};t||!this.services.languageDetector||this.services.languageDetector.async?!t&&this.services.languageDetector&&this.services.languageDetector.async?this.services.languageDetector.detect(r):r(t):r(this.services.languageDetector.detect())},e.prototype.getFixedT=function(t,e){var n=this,o=function t(e,o){for(var r=arguments.length,i=Array(r>2?r-2:0),s=2;s0?this.languages[0]:this.language),t?["ar","shu","sqr","ssh","xaa","yhd","yud","aao","abh","abv","acm","acq","acw","acx","acy","adf","ads","aeb","aec","afb","ajp","apc","apd","arb","arq","ars","ary","arz","auz","avl","ayh","ayl","ayn","ayp","bbz","pga","he","iw","ps","pbt","pbu","pst","prp","prd","ur","ydd","yds","yih","ji","yi","hbo","men","xmn","fa","jpr","peo","pes","prs","dv","sam"].indexOf(this.services.languageUtils.getLanguagePartFromCode(t))>=0?"rtl":"ltr":"rtl"},e.prototype.createInstance=function(){return new e(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},arguments[1])},e.prototype.cloneInstance=function(){var t=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:g,r=v({},this.options,n,{isClone:!0}),i=new e(r);return["store","services","language"].forEach(function(e){i[e]=t[e]}),i.translator=new j(i.services,i.options),i.translator.on("*",function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),o=1;o $localPath) { // $urlPattern = addcslashes( $urlPattern , '/'); @@ -239,7 +240,7 @@ public function virtualURI($url, $convertionTable, &$realPath) * @param string $downloadFileName * @return string */ - public function streamFile($file, $download = false, $downloadFileName = '', $forceLoad = false) + public static function streamFile($file, $download = false, $downloadFileName = '', $forceLoad = false) { $filter = new InputFilter(); $file = $filter->xssFilterHard($file); @@ -398,7 +399,7 @@ public static function parseURI($uri, array $arrayFriendlyUri = null) * nameWorkspace to specific workspace * return true if the file exists, otherwise false. */ - public function isPMUnderUpdating($setFlag = 2, $content="true") + public static function isPMUnderUpdating($setFlag = 2, $content="true") { if (!defined('PATH_DATA')) { return false; @@ -437,7 +438,7 @@ public function isPMUnderUpdating($setFlag = 2, $content="true") * array containig the template data * @return $content string containing the parsed template content */ - public function parseTemplate($template, $data = array()) + public static function parseTemplate($template, $data = array()) { $content = ''; @@ -555,7 +556,7 @@ public static function LoadTranslationPlugins($lang = SYS_LANG, $listPluginsActi * @param string $strSkin * @return void */ - public function RenderPage($strTemplate = "default", $strSkin = SYS_SKIN, $objContent = null, $layout = '') + public static function RenderPage($strTemplate = "default", $strSkin = SYS_SKIN, $objContent = null, $layout = '') { global $G_CONTENT; global $G_TEMPLATE; @@ -616,7 +617,7 @@ public function RenderPage($strTemplate = "default", $strSkin = SYS_SKIN, $objCo * * @return void */ - public function SendTemporalMessage($msgID, $strType, $sType = 'LABEL', $time = null, $width = null, $customLabels = null) + public static function SendTemporalMessage($msgID, $strType, $sType = 'LABEL', $time = null, $width = null, $customLabels = null) { if (isset($width)) { $_SESSION ['G_MESSAGE_WIDTH'] = $width; @@ -652,7 +653,7 @@ public function SendTemporalMessage($msgID, $strType, $sType = 'LABEL', $time = * @param string $parameter * @return string */ - public function header($parameter) + public static function header($parameter) { if (defined('ENABLE_ENCRYPT') && (ENABLE_ENCRYPT == 'yes') && (substr($parameter, 0, 9) == 'location:')) { $url = Bootstrap::encrypt(substr($parameter, 10), URL_KEY); @@ -672,7 +673,7 @@ public function header($parameter) * @access public * @return void */ - public function LoadAllPluginModelClasses() + public static function LoadAllPluginModelClasses() { // Get the current Include path, where the plugins directories should be if (!defined('PATH_SEPARATOR')) { @@ -722,7 +723,7 @@ public static function expandPath($strPath = '') /** * function to calculate the time used to render a page */ - public function logTimeByPage() + public static function logTimeByPage() { if (!defined(PATH_DATA)) { return false; @@ -747,7 +748,7 @@ public function logTimeByPage() * @param string $downloadFileName * @return string */ - public function streamJSTranslationFile($filename, $locale = 'en') + public static function streamJSTranslationFile($filename, $locale = 'en') { $typearray = explode('.', basename($filename)); $typeCount = count($typearray); @@ -807,7 +808,7 @@ public function streamJSTranslationFile($filename, $locale = 'en') * @param string $file * @return string */ - public function streamCSSBigFile($filename) + public static function streamCSSBigFile($filename) { header('Content-Type: text/css'); @@ -963,7 +964,7 @@ public function streamCSSBigFile($filename) * * @return void */ - public function sendHeaders($filename, $contentType = '', $download = false, $downloadFileName = '') + public static function sendHeaders($filename, $contentType = '', $download = false, $downloadFileName = '') { if ($download) { if ($downloadFileName == '') { @@ -977,7 +978,7 @@ public function sendHeaders($filename, $contentType = '', $download = false, $do // if userAgent (BROWSER) is MSIE we need special headers to avoid MSIE // behaivor. $userAgent = strtolower($_SERVER ['HTTP_USER_AGENT']); - if (preg_match("/msie/i", $userAgent)) { + if (preg_match("/msie|trident/i", $userAgent)) { // if ( ereg("msie", $userAgent)) { header('Pragma: cache'); @@ -1114,7 +1115,7 @@ public function trimSourceCodeFile($filename) * strip_slashes * @param vVar */ - public function strip_slashes($vVar) + public static function strip_slashes($vVar) { if (is_array($vVar)) { foreach ($vVar as $sKey => $vValue) { @@ -1141,7 +1142,7 @@ public function strip_slashes($vVar) * @param eter array data // erik: associative array within data input to replace for formatted string i.e "any messsage {replaced_label} that contains a replace label" * @return string */ - public function LoadTranslation($msgID, $lang = SYS_LANG, $data = null) + public static function LoadTranslation($msgID, $lang = SYS_LANG, $data = null) { global $translation; @@ -1181,7 +1182,7 @@ public function LoadTranslation($msgID, $lang = SYS_LANG, $data = null) * @param $pattern pattern to filter some specified files * @return array containing the recursive glob results */ - public function rglob($pattern = '*', $flags = 0, $path = '') + public static function rglob($pattern = '*', $flags = 0, $path = '') { $paths = glob($path . '*', GLOB_MARK | GLOB_ONLYDIR | GLOB_NOSORT); $files = glob($path . $pattern, $flags); @@ -1196,7 +1197,7 @@ public function rglob($pattern = '*', $flags = 0, $path = '') * * @author Erik A.O. */ - public function json_encode($Json) + public static function json_encode($Json) { if (function_exists('json_encode')) { return json_encode($Json); @@ -1228,7 +1229,7 @@ public static function json_decode($Json) * * @author Erik Amaru Ortiz */ - public function xmlParser(&$string) + public static function xmlParser(&$string) { $parser = xml_parser_create(); xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); @@ -1303,7 +1304,7 @@ public function xmlParser(&$string) * @param unknown_type $maxmtime * @return Ambigous */ - public function getDirectorySize($path, $maxmtime = 0) + public static function getDirectorySize($path, $maxmtime = 0) { $totalsize = 0; $totalcount = 0; @@ -1364,7 +1365,7 @@ public function _del_p(&$ary) * @author Ralph A. * @return multitype:array containing browser name and type */ - public function get_current_browser() + public static function get_current_browser() { static $a_full_assoc_data, $a_mobile_data, $browser_user_agent; static $browser_working, $moz_type, $webkit_type; @@ -1562,7 +1563,7 @@ public function script_time() * @param unknown_type $pv_extra_search * @return string */ - public function get_item_version($pv_browser_user_agent, $pv_search_string, $pv_b_break_last = '', $pv_extra_search = '') + public static function get_item_version($pv_browser_user_agent, $pv_search_string, $pv_b_break_last = '', $pv_extra_search = '') { $substring_length = 15; $start_pos = 0; // set $start_pos to 0 for first iteration @@ -1593,7 +1594,7 @@ public function get_item_version($pv_browser_user_agent, $pv_search_string, $pv_ * @param unknown_type $pv_type * @param unknown_type $pv_value */ - public function get_set_count($pv_type, $pv_value = '') + public static function get_set_count($pv_type, $pv_value = '') { static $slice_increment; $return_value = ''; @@ -1742,7 +1743,7 @@ public function get_os_data($pv_browser_string, $pv_browser_name, $pv_version_nu * @param unknown_type $pv_browser_user_agent * @return string */ - public function check_is_mobile($pv_browser_user_agent) + public static function check_is_mobile($pv_browser_user_agent) { $mobile_working_test = ''; $a_mobile_search = array( @@ -1770,7 +1771,7 @@ public function check_is_mobile($pv_browser_user_agent) * * @param unknown_type $pv_browser_user_agent */ - public function get_mobile_data($pv_browser_user_agent) + public static function get_mobile_data($pv_browser_user_agent) { $mobile_browser = ''; $mobile_browser_number = ''; @@ -1942,7 +1943,7 @@ public function parseNormalUri($aRequestUri, array $arrayFriendlyUri = null) * @param string $key * @return string */ - public function encrypt($string, $key) + public static function encrypt($string, $key) { //print $string; // if ( defined ( 'ENABLE_ENCRYPT' ) && ENABLE_ENCRYPT == 'yes' ) { @@ -1972,7 +1973,7 @@ public function encrypt($string, $key) * @param string $key * @return string */ - public function decrypt($string, $key) + public static function decrypt($string, $key) { // if ( defined ( 'ENABLE_ENCRYPT' ) && ENABLE_ENCRYPT == 'yes' ) { //if (strpos($string, '|', 0) !== false) return $string; @@ -2065,7 +2066,7 @@ public function array_merges() * @param string $array_i * @return array */ - public function array_merge_2(&$array, &$array_i) + public static function array_merge_2(&$array, &$array_i) { foreach ($array_i as $k => $v) { if (is_array($v)) { @@ -2094,7 +2095,7 @@ public function array_merge_2(&$array, &$array_i) * @return array_sum(explode(' ',microtime())) */ /* public static */ - public function microtime_float() + public static function microtime_float() { return array_sum(explode(' ', microtime())); } @@ -2343,7 +2344,7 @@ public function getformatedDate($date, $format = 'yyyy-mm-dd', $lang = '') * @author Erik Amaru Ortiz * @name complete_field($string, $lenght, $type={1:number/2:string/3:float}) */ - public function complete_field($campo, $long, $tipo) + public static function complete_field($campo, $long, $tipo) { $campo = trim($campo); switch ($tipo) { @@ -2579,7 +2580,7 @@ public static function hashPassword($pass, $hashType = '', $includeHashType = fa * @param string $userPass hash of password * @return bool true or false */ - public function verifyHashPassword($pass, $userPass) + public static function verifyHashPassword($pass, $userPass) { global $RBAC; $passwordHashConfig = Bootstrap::getPasswordHashConfig(); @@ -2609,7 +2610,7 @@ public function verifyHashPassword($pass, $userPass) * @param $string * @return mixed */ - public function encryptOld($string) + public static function encryptOld($string) { $consthashFx = self::hashFx; return $consthashFx($string); @@ -2637,14 +2638,14 @@ public static function setLanguage() } /** - * Set Language + * Verify if the browser is Internet Explorer */ public static function isIE() { $isIE = false; if (isset($_SERVER['HTTP_USER_AGENT'])) { - $ua = htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8'); - if (preg_match('~MSIE|Internet Explorer~i', $ua) || (strpos($ua, 'Trident/7.0; rv:11.0') !== false)) { + $userAgent = htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8'); + if (preg_match("/(Trident\/(\d{2,}|7|8|9)(.*)rv:(\d{2,}))|(MSIE\ (\d{2,}|8|9)(.*)Tablet\ PC)|(Trident\/(\d{2,}|7|8|9))/", $userAgent)) { $isIE = true; } } @@ -2658,7 +2659,7 @@ public static function isIE() * @param int $level The logging level * @param string $message The log message * @param array $context The log context - * @param string $workspace name workspace + * @param string $workspace @todo we need to remove this parameter this is not necessary * @param string $file name file * @param boolean $readLoggingLevel * @@ -2669,8 +2670,8 @@ public static function registerMonolog( $level, $message, $context, - $workspace, - $file = 'cron.log', + $workspace = '', + $file = 'processmaker.log', $readLoggingLevel = true ) { @@ -2681,17 +2682,58 @@ public static function registerMonolog( /** * Get the default information from the context * - * @return array $aContext void - */ - public static function getDefaultContextLog(){ - $sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined"; - $date = \ProcessMaker\Util\DateTime::convertUtcToTimeZone(date('Y-m-d H:m:s')); - $aContext = array( - 'ip' => \G::getIpAddress() - ,'timeZone' => $date - ,'workspace' => $sysSys - ); - return $aContext; + * @return array + * + * @see AdditionalTables->populateReportTable + * @see AppAssignSelfServiceValueGroup->createRow + * @see Bootstrap->registerMonologPhpUploadExecution() + * @see Cases->loadDataSendEmail() + * @see Cases->removeCase() + * @see Cases->reportTableDeleteRecord() + * @see Derivation->derivate + * @see G->logTriggerExecution() + * @see LdapAdvanced->VerifyLogin + * @see ldapadvancedClassCron->executeCron + * @see PmDynaform->__construct + * @see pmTablesProxy->genDataReport + * @see Processes->createFiles + * @see ProcessMaker\AuditLog\AuditLog->register + * @see ProcessMaker\Util\ParseSoapVariableName->buildVariableName + * @see RBAC->checkAutomaticRegister() + * @see workflow/engine/classes/class.pmFunctions.php::executeQuery + + * @link https://wiki.processmaker.com/3.3/Actions_by_Email + * @link https://wiki.processmaker.com/3.2/ProcessMaker_Functions + * @link https://wiki.processmaker.com/3.1/Report_Tables + * @link https://wiki.processmaker.com/3.2/Cases/Running_Cases + * @link https://wiki.processmaker.com/3.3/login + * @link https://wiki.processmaker.com/3.2/Executing_cron.php + * @link https://wiki.processmaker.com/3.2/HTML5_Responsive_DynaForm_Designer + * @link https://wiki.processmaker.com/3.2/Audit_Log + * @link https://wiki.processmaker.com/3.0/ProcessMaker_WSDL_Web_Services + */ + public static function getDefaultContextLog() + { + $info = [ + 'ip' => G::getIpAddress(), + 'workspace' => !empty(config('system.workspace')) ? config('system.workspace') : 'Undefined Workspace', + 'timeZone' => DateTime::convertUtcToTimeZone(date('Y-m-d H:m:s')), + 'usrUid' => G::LoadTranslation('UID_UNDEFINED_USER') + ]; + + global $RBAC; + if (!empty($RBAC) && !empty($RBAC->aUserInfo['USER_INFO']) && !empty($RBAC->aUserInfo['USER_INFO']['USR_UID'])) { + $info['usrUid'] = $RBAC->aUserInfo['USER_INFO']['USR_UID']; + return $info; + } + + //if default session exists + if (!empty($_SESSION['USER_LOGGED'])) { + $info['usrUid'] = $_SESSION['USER_LOGGED']; + return $info; + } + + return $info; } /** diff --git a/gulliver/system/class.form.php b/gulliver/system/class.form.php index 9814d8e5f..96cfb7cbb 100644 --- a/gulliver/system/class.form.php +++ b/gulliver/system/class.form.php @@ -105,6 +105,10 @@ public function __construct ($filename, $home = '', $language = '', $forceParse $filename = $filename . '.xml'; } $this->home = $home; + + //to do: This must be removed, the post validation should only be done for the classic version. + self::createXMLFileIfNotExists($this->home . $filename); + $res = parent::parseFile( $filename, $language, $forceParse ); if ($res == 1) { trigger_error( 'Faild to parse file ' . $filename . '.', E_USER_ERROR ); @@ -751,5 +755,53 @@ public function validateFields ($data) } return $data; } + + /** + * Create XML file if not exists. + * + * @param string $filepath + * + * @see Form->__construct() + * @@link https://wiki.processmaker.com/3.1/Cases + * @link https://wiki.processmaker.com/index.php/2.5.X/DynaForms#XML_tab + */ + public static function createXMLFileIfNotExists($filepath) + { + if (file_exists($filepath)) { + return; + } + $pathParts = pathinfo($filepath); + if (empty($pathParts)) { + return; + } + $dynUid = $pathParts["filename"]; + $proUid = basename($pathParts["dirname"]); + $pathHome = dirname($pathParts["dirname"]) . PATH_SEP; + self::createXMLFile($proUid, $dynUid, 'xmlform', $pathHome); + } + + /** + * Create XML file. + * + * @param string $proUid + * @param string $dynUid + * @param string $dynType + * @param string $pathHome + * + * @see Dynaform->create() + * @see Form::createXMLFileIfNotExists() + * @link https://wiki.processmaker.com/3.1/Cases + * @link https://wiki.processmaker.com/index.php/2.5.X/DynaForms#XML_tab + */ + public static function createXMLFile($proUid, $dynUid, $dynType = 'xmlform', $pathHome = PATH_XMLFORM) + { + $xml = '' . "\n"; + $xml .= '' . "\n"; + $xml .= ''; + G::verifyPath($pathHome . $proUid, true); + $file = fopen($pathHome . $proUid . '/' . $dynUid . '.xml', 'w'); + fwrite($file, $xml); + fclose($file); + } } diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index 006f9cdb1..5d2a97e9e 100644 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -4,6 +4,7 @@ use ProcessMaker\AuditLog\AuditLog; use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Services\OAuth2\Server; +use ProcessMaker\Validation\ValidationUploadedFiles; class G { @@ -1183,7 +1184,7 @@ public static function streamFile($file, $download = false, $downloadFileName = \Bootstrap::registerMonologPhpUploadExecution('phpExecution', 200, 'Php Execution', $filename); require_once($filename); } else { - $message = G::LoadTranslation('THE_PHP_FILES_EXECUTION_WAS_DISABLED'); + $message = G::LoadTranslation('ID_THE_PHP_FILES_EXECUTION_WAS_DISABLED'); \Bootstrap::registerMonologPhpUploadExecution('phpExecution', 550, $message, $filename); echo $message; } @@ -1359,7 +1360,7 @@ public static function getUIDName($uid, $scope = '') return $e; } - /** + /** * formatNumber * * @author David Callizaya @@ -1375,7 +1376,7 @@ public static function formatNumber($num, $language = 'latin') return $snum; } - /** + /** * Returns a date formatted according to the given format string * @author David Callizaya * @param string $format The format of the outputted date string @@ -1633,7 +1634,7 @@ public static function complete_field($campo, $long, $tipo) return $campo; } - /** + /** * Escapes special characters in a string for use in a SQL statement * @param string $sqlString The string to be escaped * @param string $DBEngine Target DBMS @@ -1677,7 +1678,7 @@ public static function MySQLSintaxis() } } - /** + /** * Returns a sql string with @@parameters replaced with its values defined * in array $result using the next notation: * NOTATION: @@ -1855,7 +1856,7 @@ public static function replaceDataGridField($sContent, $aFields, $nl2brRecursive return $sContent; } - /** + /** * Load strings from a XMLFile. * @author David Callizaya * @parameter $languageFile An xml language file. @@ -1894,7 +1895,7 @@ public static function loadLanguageFile($filename, $languageId = '', $forceParse } } - /** + /** * Funcion auxiliar Temporal: * Registra en la base de datos los labels xml usados en el sistema * @author David Callizaya @@ -2766,7 +2767,7 @@ public static function resizeImage($path, $resWidth, $resHeight, $saveTo = null) $image = $inputFn($path); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $resWidth, $resHeight, $width, $height); $outputFn($image_p, $saveTo); - + if (!is_null($saveTo)) { $filter = new InputFilter(); $saveTo = $filter->validateInput($saveTo, "path"); @@ -3196,10 +3197,11 @@ public static function evalJScript($c) * Inflects a string with accented characters and other characteres not suitable for file names, by defaul replace with undescore * * @author Erik Amaru Ortiz - * @param (string) string to convert - * @param (string) character for replace - * @param (array) additional characteres map - * + * @param string $string to convert + * @param string $replacement character for replace + * @param array $map additional characteres map + * @return string|string[]|null + * @see PMXPublisher::truncateName, Processes::saveSerializedProcess, XmlExporter::truncateName */ public static function inflect($string, $replacement = '_', $map = array()) { @@ -3208,8 +3210,6 @@ public static function inflect($string, $replacement = '_', $map = array()) $replacement = '_'; } - $quotedReplacement = preg_quote($replacement, '/'); - $default = array('/à|á|å|â/' => 'a', '/è|é|ê|ẽ|ë/' => 'e', '/ì|í|î/' => 'i', @@ -5429,7 +5429,7 @@ public static function buildFrom($configuration, $from = '') } elseif ($configuration['MESS_ENGINE'] == 'PHPMAILER' && preg_match('/(.+)@(.+)\.(.+)/', $configuration['MESS_ACCOUNT'], $match)) { $from .= ' <' . $configuration['MESS_ACCOUNT'] . '>'; } else { - $from .= ' '; + $from .= ' '; } } } else { @@ -5438,15 +5438,15 @@ public static function buildFrom($configuration, $from = '') } elseif ($configuration['MESS_FROM_NAME'] != '' && $configuration['MESS_ENGINE'] == 'PHPMAILER' && preg_match('/(.+)@(.+)\.(.+)/', $configuration['MESS_ACCOUNT'], $match)) { $from = $configuration['MESS_FROM_NAME'] . ' <' . $configuration['MESS_ACCOUNT'] . '>'; } elseif ($configuration['MESS_FROM_NAME'] != '') { - $from = $configuration['MESS_FROM_NAME'] . ' '; + $from = $configuration['MESS_FROM_NAME'] . ' '; } elseif ($configuration['MESS_FROM_MAIL'] != '') { $from = $configuration['MESS_FROM_MAIL']; } elseif ($configuration['MESS_ENGINE'] == 'PHPMAILER' && preg_match('/(.+)@(.+)\.(.+)/', $configuration['MESS_ACCOUNT'], $match)) { $from = $configuration['MESS_ACCOUNT']; } elseif ($configuration['MESS_ENGINE'] == 'PHPMAILER' && $configuration['MESS_ACCOUNT'] != '' && !preg_match('/(.+)@(.+)\.(.+)/', $configuration['MESS_ACCOUNT'], $match)) { - $from = $configuration['MESS_ACCOUNT'] . ' '; + $from = $configuration['MESS_ACCOUNT'] . ' '; } else { - $from = 'info@' . ((isset($_SERVER['HTTP_HOST']) && $_SERVER['HTTP_HOST'] != '') ? $_SERVER['HTTP_HOST'] : 'processmaker.com'); + $from = 'info@' . System::getDefaultMailDomain(); } } return $from; @@ -5466,6 +5466,16 @@ public function getRealExtension($extensionInpDoc) */ public static function verifyInputDocExtension($InpDocAllowedFiles, $fileName, $filesTmpName) { + $error = null; + ValidationUploadedFiles::getValidationUploadedFiles()->dispatch(function($validator) use(&$error) { + $error = new stdclass(); + $error->status = false; + $error->message = $validator->getMessage(); + }); + if (!is_null($error)) { + return $error; + } + // Initialize variables $res = new stdclass(); $res->status = false; @@ -5475,14 +5485,6 @@ public static function verifyInputDocExtension($InpDocAllowedFiles, $fileName, $ $aux = pathinfo($fileName); $fileExtension = isset($aux['extension']) ? strtolower($aux['extension']) : ''; - if (\Bootstrap::getDisablePhpUploadExecution() === 1 && $fileExtension === 'php') { - $message = \G::LoadTranslation('THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED'); - \Bootstrap::registerMonologPhpUploadExecution('phpUpload', 550, $message, $fileName); - $res->status = false; - $res->message = $message; - return $res; - } - // If required extension is *.* don't validate if (in_array('*', $allowedTypes)) { $res->status = true; @@ -5799,7 +5801,7 @@ public static function defineConstants() include(PATH_METHODS . "login/version-pmos.php"); } //Removed default version from code. - + /** * The constants defined comes from the file: * processmaker/workflow/engine/classes/class.plugin.php, the loading of this @@ -5868,4 +5870,25 @@ public static function classExists($name) $class = isset(self::$adapters[$key]) ? self::$adapters[$key] : $name; return class_exists($class); } + + /** + * Fix string corrupted related to PMC-336. + * To do, this method should be removed. Related to PMC-336. + * + * @param string $string + * @return string + */ + public static function fixStringCorrupted($string) + { + $string = preg_replace_callback("/iconv\\(\\'UCS\\-4LE\\',\\'UTF\\-8\\',pack\\(\\'V\\', hexdec\\(\\'U[a-f0-9]{4}\\'\\)\\)\\)/", function($result) { + //This looks for the following pattern: + //iconv('UCS-4LE','UTF-8',pack('V', hexdec('U062f')))iconv('UCS-4LE','UTF-8',pack('V', hexdec('U0631'))) + //So making this replacement is safe. + $portion = $result[0]; + $portion = str_replace("iconv('UCS-4LE','UTF-8',pack('V', hexdec('U", "\u", $portion); + $portion = str_replace("')))", "", $portion); + return $portion; + }, $string); + return $string; + } } diff --git a/gulliver/system/class.headPublisher.php b/gulliver/system/class.headPublisher.php index 8204a05e0..b153f05a7 100644 --- a/gulliver/system/class.headPublisher.php +++ b/gulliver/system/class.headPublisher.php @@ -746,11 +746,11 @@ public function disableHeaderScripts() * * @return array $views */ - public function getExtJsViewState() + public function getExtJsViewState($userUid = '') { $json = new stdClass(); $views = array(); - $keyState = "extJsViewState"; + $keyState = "extJsViewState" . $userUid; $prefixExtJs = "ys-"; $oServerConf = ServerConf::getSingleton(); $deleteCache = true; diff --git a/gulliver/system/class.i18n_po.php b/gulliver/system/class.i18n_po.php index 5e04ec6fe..2e97727ac 100644 --- a/gulliver/system/class.i18n_po.php +++ b/gulliver/system/class.i18n_po.php @@ -1,43 +1,12 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ - /** * i18n_PO - * This class build biggers PO files without size limit and this not use much memory that the allowed - * - * @package gulliver.system - * @author Erik Amaru Ortiz - * date Aug 31th, 2010 - * @copyright (C) 2002 by Colosa Development Team. + * This class build biggers PO files without size limit and this not use much + * memory that the allowed. */ class i18n_PO { - private $_file = null; private $_string = ''; private $_meta; @@ -55,11 +24,22 @@ class i18n_PO public $flags; public $previousUntranslatedStrings; + /** + * Constructor. + * + * @param string $file + */ public function __construct($file) { $this->file = $file; } + /** + * Prepares the construction of the .po file. + * + * @return boolean|undefined + * @throws Exception + */ public function buildInit() { $this->_fp = fopen($this->file, 'w'); @@ -82,6 +62,11 @@ public function buildInit() $this->_editingHeader = true; } + /** + * Start reading the .po file. + * + * @throws Exception + */ public function readInit() { $this->_fp = fopen($this->file, 'r'); @@ -90,17 +75,23 @@ public function readInit() throw new Exception('Could\'t open ' . $this->file . ' file'); } //skipping comments - $this->skipCommets(); + $this->skipComments(); //deaing headers $this->readHeaders(); - $this->translatorComments = Array(); - $this->extractedComments = Array(); - $this->references = Array(); - $this->flags = Array(); - $this->previousUntranslatedStrings = Array(); + $this->translatorComments = []; + $this->extractedComments = []; + $this->references = []; + $this->flags = []; + $this->previousUntranslatedStrings = []; } + /** + * Add header information. + * + * @param string $id + * @param string $value + */ public function addHeader($id, $value) { if ($this->_editingHeader) { @@ -109,6 +100,11 @@ public function addHeader($id, $value) } } + /** + * Add a translator comment. + * + * @param string $str + */ public function addTranslatorComment($str) { $this->headerStroke(); @@ -116,6 +112,11 @@ public function addTranslatorComment($str) $this->_writeLine($comment); } + /** + * Add a extracted comment. + * + * @param string $str + */ public function addExtractedComment($str) { $this->headerStroke(); @@ -123,6 +124,11 @@ public function addExtractedComment($str) $this->_writeLine($comment); } + /** + * Add a reference comment. + * + * @param string $str + */ public function addReference($str) { $this->headerStroke(); @@ -130,6 +136,11 @@ public function addReference($str) $this->_writeLine($reference); } + /** + * Add a flag comment. + * + * @param string $str + */ public function addFlag($str) { $this->headerStroke(); @@ -137,6 +148,11 @@ public function addFlag($str) $this->_writeLine($flag); } + /** + * Add previous untranslated string. + * + * @param string $str + */ public function addPreviousUntranslatedString($str) { $this->headerStroke(); @@ -144,6 +160,12 @@ public function addPreviousUntranslatedString($str) $this->_writeLine($str); } + /** + * Add a translation. + * + * @param string $msgid + * @param string $msgstr + */ public function addTranslation($msgid, $msgstr) { $this->headerStroke(); @@ -152,22 +174,35 @@ public function addTranslation($msgid, $msgstr) $this->_writeLine(''); } + /** + * Write line into file. + * + * @param string $str + */ public function _writeLine($str) { $this->_write($str . "\n"); } + /** + * Write into file. + * + * @param string $str + */ public function _write($str) { fwrite($this->_fp, $str); } + /** + * Prepare string for add to file. + * + * @param string $string + * @param boolean $reverse + * @return string + */ public function prepare($string, $reverse = false) { - //$string = str_replace('\"', '"', $string); - //$string = stripslashes($string); - - if ($reverse) { $smap = array('"', "\n", "\t", "\r"); $rmap = array('\"', '\\n"' . "\n" . '"', '\\t', '\\r'); @@ -180,19 +215,24 @@ public function prepare($string, $reverse = false) } } + /** + * Add a header stroke. + */ public function headerStroke() { if ($this->_editingHeader) { $this->_editingHeader = false; $this->_writeLine(''); - } } - /** * read funtions * */ - private function skipCommets() + + /** + * Skip comments + */ + private function skipComments() { $this->_fileComments = ''; do { @@ -200,10 +240,14 @@ private function skipCommets() $line = fgets($this->_fp); $this->_fileComments .= $line; } while ((substr($line, 0, 1) == '#' || trim($line) == '') && !feof($this->_fp)); - fseek($this->_fp, $lastPos); } + /** + * Read headers information from .po file. + * + * @throws Exception + */ private function readHeaders() { $this->flagEndHeaders = false; @@ -283,19 +327,30 @@ private function readHeaders() } } + /** + * Get headers information. + * + * @return array + */ public function getHeaders() { return $this->_meta; } + /** + * Get translations. + * + * @return array|boolean + * @throws Exception + */ public function getTranslation() { $flagReadingComments = true; - $this->translatorComments = Array(); - $this->extractedComments = Array(); - $this->references = Array(); - $this->flags = Array(); + $this->translatorComments = []; + $this->extractedComments = []; + $this->references = []; + $this->flags = []; //getting the new line while ($flagReadingComments && !$this->flagError) { @@ -388,15 +443,15 @@ public function getTranslation() preg_match('/^"(.*)"\s*/s', $this->_fileLine, $match); } while (sizeof($match) == 2); - /* g::pr($this->translatorComments); - g::pr($this->references); - g::pr($match); - die; */ - - return Array('msgid' => trim($msgid), 'msgstr' => trim($msgstr)); + return [ + 'msgid' => trim($msgid), + 'msgstr' => trim($msgstr) + ]; } - //garbage + /** + * Destructor. + */ public function __destruct() { if ($this->_fp) { @@ -404,4 +459,3 @@ public function __destruct() } } } - diff --git a/gulliver/system/class.monologProvider.php b/gulliver/system/class.monologProvider.php index ad15960e8..03a84e6b9 100644 --- a/gulliver/system/class.monologProvider.php +++ b/gulliver/system/class.monologProvider.php @@ -26,7 +26,7 @@ class MonologProvider private $registerLogger; //the default format "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"; - private $output = "<%level%> %datetime% %channel% %level_name%: %message% %context% %extra%\n"; + private $output = "<%level%> %datetime% %channel% %level_name%: %message% %context%\n"; private $dateFormat = 'M d H:i:s'; /** * The maximal amount of files to keep (0 means unlimited) diff --git a/gulliver/system/class.rbac.php b/gulliver/system/class.rbac.php index 12d0200ad..78463ee1c 100644 --- a/gulliver/system/class.rbac.php +++ b/gulliver/system/class.rbac.php @@ -55,7 +55,7 @@ class RBAC /** * * @access private - * @var $userObj + * @var RbacUsers $userObj */ public $userObj; public $usersPermissionsObj; @@ -803,6 +803,80 @@ public function loadUserRolePermission($sSystem, $sUser) $this->aUserInfo[$sSystem]['PERMISSIONS'] = $fieldsPermissions; } + /** + * Verification of a user through the class RBAC_user + * verify if the user has permissions to stay in the application + * -4: expired user + * @access public + * @throws Exception + */ + public function verifyDueDateUserLogged() + { + if (empty($this->userObj)) { + return; + } + $uid = !empty($this->userObj) ? $this->userObj->getUsrUid() : null; + //if the expired user + if ($this->userObj->getUsrDueDate() < date('Y-m-d')) { + $uid = -4; + $errLabel = 'ID_USER_INACTIVE_BY_DATE'; + } + + if (!isset($uid) || $uid < 0) { + if (!defined('PPP_FAILED_LOGINS')) { + define('PPP_FAILED_LOGINS', 0); + } + //start new session + @session_destroy(); + session_start(); + session_regenerate_id(); + + throw new RBACException($errLabel); + } + } + + /** + * Destroy all active sessions of a user (browser, soap, oauth) + * @param string $usrUid User uid + */ + public static function destroySessionUser($usrUid) + { + //remove all register of tables related to the token + (new OauthAccessTokens())->removeByUser($usrUid); + (new OauthRefreshTokens())->removeByUser($usrUid); + (new PmoauthUserAccessTokens())->removeByUser($usrUid); + (new OauthAuthorizationCodes())->removeByUser($usrUid); + + $loginLog = new LoginLog(); + $sessionId = $loginLog->getSessionsIdByUser($usrUid); + if ($sessionId) { + //remove all login log row's of LOGIN_LOG table + $loginLog->removeByUser($usrUid); + //remove all register of tables + (new Session())->removeByUser($usrUid); + + // 1. commit session if it's started. + if (session_id()) { + session_commit(); + } + // 2. store current session id + session_start(); + $currentSessionId = session_id(); + session_commit(); + // 3. then destroy session specified. + foreach ($sessionId as $sid) { + session_id($sid['LOG_SID']); + session_start(); + session_destroy(); + session_commit(); + } + // 4. restore current session id. If don't restore it, your current session will refer to the session you just destroyed! + session_id($currentSessionId); + session_start(); + session_commit(); + } + } + /** * verification the register automatic * diff --git a/gulliver/system/class.table.php b/gulliver/system/class.table.php index de33b99ce..1ab2c2def 100644 --- a/gulliver/system/class.table.php +++ b/gulliver/system/class.table.php @@ -1,45 +1,6 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * - */ -/** - * - * - * - * - * - * - * Table class definition - * Render table - * - * @package gulliver.system - * @author Fernando Ontiveros Lira - * @copyright (C) 2002 by Colosa Development Team. - * - */ +use ProcessMaker\Core\System; class Table { @@ -125,8 +86,8 @@ public function SetTo ($objConnection = null) public function SetSource ($stQry = "", $stDefaultOrder = "UID", $stDefaultOrderDir = 'ASC') { //to fix missing value for variable orderDir, when between pages changes. - $url1 = $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . '?'; - $url2 = strstr( $_SERVER['HTTP_REFERER'] . '?', $_SERVER['HTTP_HOST'] ); + $url1 = System::getServerHost() . $_SERVER['REQUEST_URI'] . '?'; + $url2 = strstr($_SERVER['HTTP_REFERER'] . '?', System::getServerHost()); $url1 = substr( $url1, 0, strpos( $url1, '?' ) ); $url2 = substr( $url2, 0, strpos( $url2, '?' ) ); if ($url1 != $url2) { diff --git a/gulliver/system/class.xmlform.php b/gulliver/system/class.xmlform.php index 23a0b7059..159d47479 100644 --- a/gulliver/system/class.xmlform.php +++ b/gulliver/system/class.xmlform.php @@ -1,5 +1,6 @@ input) { $permission = true; - $url = ((G::is_https()) ? "https://" : "http://") . $_SERVER["HTTP_HOST"] . dirname($_SERVER["REQUEST_URI"]) . "/cases_ShowDocument?a=" . $row["APP_DOC_UID"] . "&v=" . $row["DOC_VERSION"]; + $url = System::getServerProtocolHost() . dirname($_SERVER["REQUEST_URI"]) . "/cases_ShowDocument?a=" . $row["APP_DOC_UID"] . "&v=" . $row["DOC_VERSION"]; $sw = 1; } } diff --git a/gulpfile.js b/gulpfile.js index 2ecbb281b..5e9b4c5cc 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -471,6 +471,37 @@ gulp.task('clean', function () { cleanDirectory('workflow/public_html/lib'); }); +/** + * Exports from the config/constants.php the configuration constants to the + * enviromentvariables.json file + */ +gulp.task('exportBackendConstants', function () { + var runner = require('child_process'); + gutil.log(gutil.colors.green('Export ProcessMaker constants...')); + + var envVarsJsonFile = 'config/enviromentvariables.json'; + + var code = 'require_once "gulliver/system/class.g.php";' + + 'require_once "bootstrap/autoload.php";' + + 'require_once "bootstrap/app.php";' + + 'app()->make(Illuminate\\Foundation\\Http\\Kernel::class)->bootstrap();' + + 'print(json_encode(config("constants", JSON_UNESCAPED_SLASHES)));'; + + runner.exec( + 'php -r \'' + code + '\'', + function (err, stdout, stderr) { + var pmConstants = JSON.parse(stdout); + var envVar = JSON.parse(fs.readFileSync(envVarsJsonFile)); + + for (var attr in pmConstants) { + envVar[attr] = pmConstants[attr]; + } + + fs.writeFileSync(envVarsJsonFile, JSON.stringify(envVar, null, 2)); + return pmConstants; + }); +}); + /** * This scheduled task is to be able to create the guest user constants */ @@ -490,7 +521,7 @@ gulp.task('__env', function (cb) { ); }); -gulp.task('default', ['clean', '__env'], function (cb) { +gulp.task('default', ['clean', 'exportBackendConstants', '__env'], function (cb) { var i, tasks = []; gutil.log(gutil.colors.green('Initializing ProcessMaker building...')); @@ -499,4 +530,5 @@ gulp.task('default', ['clean', '__env'], function (cb) { tasks.push(_.bind(processTask, config[i])); } executeSequence(tasks, cb); -}); \ No newline at end of file +}); + diff --git a/thirdparty/creole/contrib/DBArrayConnection.php b/thirdparty/creole/contrib/DBArrayConnection.php index a7cbcff75..9b8edef71 100644 --- a/thirdparty/creole/contrib/DBArrayConnection.php +++ b/thirdparty/creole/contrib/DBArrayConnection.php @@ -523,19 +523,15 @@ public function executeQuery($sql, $fetchmode = null) } } - //prepend the headers in the resultRow - array_unshift($resultRow, $this->_DBArray[$tableName][0]); - //$resultRow[0] = $this->_DBArray[ $tableName ][0]; - - /* algorith to order a multiarray - // Obtain a list of columns - foreach ($data as $key => $row) { - $volume[$key] = $row['volume']; - $edition[$key] = $row['edition']; - } - // Sort the data with volume descending, edition ascending - // Add $data as the last parameter, to sort by the common key - array_multisort($volume, SORT_DESC, $edition, SORT_ASC, $data); */ + /** + * Prepend the headers in the resultRow. + * If the null value is not taken, $resultRow will lose an element. + */ + $header = null; + if (isset($this->_DBArray[$tableName][0])) { + $header = $this->_DBArray[$tableName][0]; + } + array_unshift($resultRow, $header); /* * Apply Limit and Offset diff --git a/thirdparty/creole/drivers/mssql/MSSQLConnection.php b/thirdparty/creole/drivers/mssql/MSSQLConnection.php index b9097ee4f..cfcf30722 100644 --- a/thirdparty/creole/drivers/mssql/MSSQLConnection.php +++ b/thirdparty/creole/drivers/mssql/MSSQLConnection.php @@ -191,16 +191,18 @@ function executeQuery($sql, $fetchmode = null) { $this->lastQuery = $sql; if (extension_loaded('sqlsrv')) { - $result = sqlsrv_query($this->dblink, $sql); + $result = @sqlsrv_query($this->dblink, $sql); + if (!$result) { + throw new SQLException('Could not execute query', print_r(sqlsrv_errors(), true)); + } } else { if (!@mssql_select_db($this->database, $this->dblink)) { throw new SQLException('No database selected'); } - $result = @mssql_query($sql, $this->dblink); - } - if (!$result) { - throw new SQLException('Could not execute query', mssql_get_last_message()); + if (!$result) { + throw new SQLException('Could not execute query', mssql_get_last_message()); + } } return new MSSQLResultSet($this, $result, $fetchmode); } @@ -210,23 +212,23 @@ function executeQuery($sql, $fetchmode = null) */ function executeUpdate($sql) { + $this->lastQuery = $sql; if (extension_loaded('sqlsrv')) { - $result = sqlsrv_query($this->dblink, $sql); + $result = @sqlsrv_query($this->dblink, $sql); + if (!$result) { + throw new SQLException('Could not execute update', print_r(sqlsrv_errors(), true), $sql); + } + return (int) sqlsrv_rows_affected($result); } else { - $this->lastQuery = $sql; if (!mssql_select_db($this->database, $this->dblink)) { throw new SQLException('No database selected'); } - $result = @mssql_query($sql, $this->dblink); + if (!$result) { + throw new SQLException('Could not execute update', mssql_get_last_message(), $sql); + } + return (int) mssql_rows_affected($this->dblink); } - - if (!$result) { - throw new SQLException('Could not execute update', mssql_get_last_message(), $sql); - } - - return (int) mssql_rows_affected($this->dblink); - // return $this->getUpdateCount(); } /** @@ -237,15 +239,18 @@ function executeUpdate($sql) protected function beginTrans() { if (extension_loaded('sqlsrv')) { - $result = sqlsrv_begin_transaction($this->dblink); + $result = @sqlsrv_begin_transaction($this->dblink); + if (!$result) { + throw new SQLException('Could not begin transaction', print_r(sqlsrv_errors(), true)); + } } else { $result = @mssql_query('BEGIN TRAN', $this->dblink); - } - if (!$result) { - throw new SQLException('Could not begin transaction', mssql_get_last_message()); + if (!$result) { + throw new SQLException('Could not begin transaction', mssql_get_last_message()); + } } } - + /** * Commit the current transaction. * @throws SQLException @@ -254,15 +259,18 @@ protected function beginTrans() protected function commitTrans() { if (extension_loaded('sqlsrv')) { - $result = sqlsrv_commit($this->dblink); + $result = @sqlsrv_commit($this->dblink); + if (!$result) { + throw new SQLException('Could not commit transaction', print_r(sqlsrv_errors(), true)); + } } else { if (!@mssql_select_db($this->database, $this->dblink)) { throw new SQLException('No database selected'); } $result = @mssql_query('COMMIT TRAN', $this->dblink); - } - if (!$result) { - throw new SQLException('Could not commit transaction', mssql_get_last_message()); + if (!$result) { + throw new SQLException('Could not commit transaction', mssql_get_last_message()); + } } } @@ -274,15 +282,18 @@ protected function commitTrans() protected function rollbackTrans() { if (extension_loaded('sqlsrv')) { - $result = sqlsrv_rollback($this->dblink); + $result = @sqlsrv_rollback($this->dblink); + if (!$result) { + throw new SQLException('Could not rollback transaction', print_r(sqlsrv_errors(), true)); + } } else { if (!@mssql_select_db($this->database, $this->dblink)) { throw new SQLException('no database selected'); } $result = @mssql_query('ROLLBACK TRAN', $this->dblink); - } - if (!$result) { - throw new SQLException('Could not rollback transaction', mssql_get_last_message()); + if (!$result) { + throw new SQLException('Could not rollback transaction', mssql_get_last_message()); + } } } diff --git a/thirdparty/creole/drivers/mssql/MSSQLResultSet.php b/thirdparty/creole/drivers/mssql/MSSQLResultSet.php index b75c740e5..b66008179 100644 --- a/thirdparty/creole/drivers/mssql/MSSQLResultSet.php +++ b/thirdparty/creole/drivers/mssql/MSSQLResultSet.php @@ -154,12 +154,14 @@ function getRecordCount() { if (extension_loaded('sqlsrv')) { $rows = @sqlsrv_num_rows($this->result); + if ($rows === null) { + throw new SQLException('Error getting record count', print_r(sqlsrv_errors(), true)); + } } else { $rows = @mssql_num_rows($this->result); - } - - if ($rows === null) { - throw new SQLException('Error getting record count', mssql_get_last_message()); + if ($rows === null) { + throw new SQLException('Error getting record count', mssql_get_last_message()); + } } // adjust count based on emulated LIMIT/OFFSET $rows -= $this->offset; diff --git a/thirdparty/creole/drivers/mssql/metadata/MSSQLDatabaseInfo.php b/thirdparty/creole/drivers/mssql/metadata/MSSQLDatabaseInfo.php index 959c1e321..3e557eabc 100644 --- a/thirdparty/creole/drivers/mssql/metadata/MSSQLDatabaseInfo.php +++ b/thirdparty/creole/drivers/mssql/metadata/MSSQLDatabaseInfo.php @@ -38,31 +38,30 @@ class MSSQLDatabaseInfo extends DatabaseInfo protected function initTables() { include_once 'creole/drivers/mssql/metadata/MSSQLTableInfo.php'; - $dsn = $this->conn->getDSN(); - - + $sql = "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME <> 'dtproperties'"; if (extension_loaded('sqlsrv')) { - $result = sqlsrv_query( - "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME <> 'dtproperties'", - $this->conn->getResource() - ); + $result = sqlsrv_query($sql, $this->conn->getResource()); + if (!$result) { + throw new SQLException("Could not list tables", print_r(sqlsrv_errors(), true)); + } + while ($row = sqlsrv_fetch_array($result)) { + $this->tables[strtoupper($row[0])] = new MSSQLTableInfo($this, $row[0]); + } } else { if (!@mssql_select_db($this->dbname, $this->conn->getResource())) { throw new SQLException('No database selected'); } - $result = mssql_query("SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_NAME <> 'dtproperties'", $this->conn->getResource()); - } - - if (!$result) { - throw new SQLException("Could not list tables", mssql_get_last_message()); - } - - while ($row = mssql_fetch_row($result)) { - $this->tables[strtoupper($row[0])] = new MSSQLTableInfo($this, $row[0]); + $result = mssql_query($sql, $this->conn->getResource()); + if (!$result) { + throw new SQLException("Could not list tables", mssql_get_last_message()); + } + while ($row = mssql_fetch_row($result)) { + $this->tables[strtoupper($row[0])] = new MSSQLTableInfo($this, $row[0]); + } } } - + /** * * @return void diff --git a/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php b/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php index fecfd6361..32a9ddaac 100644 --- a/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php +++ b/thirdparty/creole/drivers/mysqli/MySQLiResultSet.php @@ -98,7 +98,9 @@ public function getRecordCount() */ public function close() { - @mysqli_free_result($this->result); + if (is_resource($this->result)) { + @mysqli_free_result($this->result); + } $this->fields = array(); } diff --git a/thirdparty/htmlarea/images/Thumbs.db b/thirdparty/htmlarea/images/Thumbs.db new file mode 100644 index 000000000..5e7f17f4c Binary files /dev/null and b/thirdparty/htmlarea/images/Thumbs.db differ diff --git a/thirdparty/pear/DB/mysqli.php b/thirdparty/pear/DB/mysqli.php index 3c0fd1db4..7bd138855 100644 --- a/thirdparty/pear/DB/mysqli.php +++ b/thirdparty/pear/DB/mysqli.php @@ -379,7 +379,13 @@ function freeResult($result) # need to come up with different means for next line # since $result is object (int)$result won't fly... // unset($this->num_rows[(int)$result]); - return @mysqli_free_result($result); + + //for compatibility the method must return a boolean. + if (is_resource($result)) { + @mysqli_free_result($result); + return true; + } + return false; } // }}} @@ -902,7 +908,9 @@ function tableInfo($result, $mode = null) { // free the result only if we were called on a table if ($got_string) { - @mysqli_free_result($id); + if (is_resource($id)) { + @mysqli_free_result($id); + } } return $res; } diff --git a/vendor/autoload.php b/vendor/autoload.php index cd2cb6065..4c281c3c0 100644 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -11,4 +11,4 @@ require_once __DIR__ . '/composer/autoload_alias_loader_real.php'; -return ClassAliasLoaderInit3b31a4ba6de6371fab2d7a48d066dc80::initializeClassAliasLoader(ComposerAutoloaderInit3b31a4ba6de6371fab2d7a48d066dc80::getLoader()); +return ClassAliasLoaderInit66bc30249e5d6d2d0fc249853688d926::initializeClassAliasLoader(ComposerAutoloaderInit66bc30249e5d6d2d0fc249853688d926::getLoader()); diff --git a/vendor/colosa/MichelangeloFE/build/js/designer.js b/vendor/colosa/MichelangeloFE/build/js/designer.js index 6fb646a7c..e4cb8bf33 100644 --- a/vendor/colosa/MichelangeloFE/build/js/designer.js +++ b/vendor/colosa/MichelangeloFE/build/js/designer.js @@ -458,8 +458,21 @@ PMDesigner.hideAllTinyEditorControls = function () { jQuery(document).ready(function ($) { - var setSaveButtonDisabled, s, sidebarCanvas, project, d, downloadLink, handlerExportNormal, handlerExportGranular, - handler, validatosr, help, option, menu, elem; + var setSaveButtonDisabled, + s, + sidebarCanvas, + project, + d, + downloadLink, + handlerExportNormal, + handlerExportGranular, + handler, + validatosr, + help, + option, + menu, + elem, + validatorLabel = "Validator".translate(); /*************************************************** * Defines the Process ***************************************************/ @@ -708,7 +721,7 @@ jQuery(document).ready(function ($) { * Add data tables */ $('body').append('
') - $('.validator_header').append('

Validator

'); + $('.validator_header').append('

' + validatorLabel + '

'); $('.validator_header').append(''); $('.validator_body').html('
'); PMDesigner.validTable = $('#validator-table').DataTable({ @@ -1467,6 +1480,27 @@ PMDesigner.reloadDataTable = function () { $('.bpmn_validator').css('visibility', 'visible'); }; +/** + * Escape XML characters method. + * There are only five: + * " " + * ' ' + * < < + * > > + * & & + * + * @param {string} label + * @returns {string} + */ +PMDesigner.escapeXMLCharacters = function (label) { + return label + .replace(/&/g, "&") + .replace(/"/g, """) + .replace(/'/g, "'") + .replace(//g, ">"); +}; + DataDictionary = function () { }; DataDictionary.prototype.getColor = function (value) { @@ -1630,16 +1664,16 @@ ViewTaskInformation.prototype.clearRows = function () { ViewTaskInformation.prototype.showInformation = function () { var that = this; that.clearRows(); - that.addRow('Title', that.shapeData.tas_title); - that.addRow('Description', that.shapeData.tas_description); - that.addRow('Status', that.dataDictionary.getStatus(that.shapeData.status)); - that.addRow('Type', that.dataDictionary.getTasType(that.shapeData.tas_type)); - that.addRow('Assign type', that.dataDictionary.getTasAssignType(that.shapeData.tas_assign_type)); - that.addRow('Derivation', that.dataDictionary.getTasDerivation(that.shapeData.tas_derivation)); - that.addRow('Start', that.shapeData.tas_start); + that.addRow('Title'.translate(), that.shapeData.tas_title); + that.addRow('Description'.translate(), that.shapeData.tas_description); + that.addRow('Status'.translate(), that.dataDictionary.getStatus(that.shapeData.status)); + that.addRow('Type'.translate(), that.dataDictionary.getTasType(that.shapeData.tas_type)); + that.addRow('Assign type'.translate(), that.dataDictionary.getTasAssignType(that.shapeData.tas_assign_type)); + that.addRow('Routing'.translate(), that.dataDictionary.getTasDerivation(that.shapeData.tas_derivation)); + that.addRow('Start'.translate(), that.shapeData.tas_start); that.addRowNewLine(); - that.addRow('User Name', that.shapeData.usr_username); - that.addRow('User', that.shapeData.usr_firstname + ' ' + that.shapeData.usr_lastname); + that.addRow('Last User Name'.translate(), that.shapeData.usr_username); + that.addRow('Last User'.translate(), that.shapeData.usr_firstname + ' ' + that.shapeData.usr_lastname); that.windowAbstract.setTitle('Information'.translate() + ' ' + that.shapeData.tas_title); that.windowAbstract.open(); @@ -14430,7 +14464,10 @@ stepsTask.prototype.notItemConfig = function () { cboOutputDocument, cboPermission, cboParticipationRequired, - processPermissionsDataIni = {}; + processPermissionsDataIni = {}, + notification, + notificationText = "Fields marked with an asterisk (%%ASTERISK%%) are required.".translate() + .replace(/%%ASTERISK%%/g, '*'); loadDataFromServerToFields = function () { var restClient = new PMRestClient({ @@ -14886,9 +14923,10 @@ stepsTask.prototype.notItemConfig = function () { }; processPermissionsSetForm = function (option, data) { - processPermissionsData = data + cboGroupOrUser.hideMessageRequired(); + processPermissionsData = data; PROCESS_PERMISSIONS_OPTION = option; - PROCESS_PERMISSIONS_UID = (typeof(processPermissionsData.op_uid) != "undefined") ? processPermissionsData.op_uid : ""; + PROCESS_PERMISSIONS_UID = (typeof(processPermissionsData.op_uid) !== "undefined") ? processPermissionsData.op_uid : ""; disableAllItems(); winGrdpnlProcessPermissions.showFooter(); @@ -15015,6 +15053,7 @@ stepsTask.prototype.notItemConfig = function () { cboGroupOrUser = new SuggestField({ label: "Group or User".translate(), id: "cboGroupOrUser", + name: "cboGroupOrUser", placeholder: "suggest users and groups", width: 500, required: true, @@ -15071,6 +15110,13 @@ stepsTask.prototype.notItemConfig = function () { } ] }); + notification = new PMUI.field.TextAnnotationField({ + id: "requiredMessage", + name: "Message", + textType: PMUI.field.TextAnnotationField.TEXT_TYPES.HTML, + text: notificationText, + text_Align: "center" + }); optionsType = [ { value: "ANY", @@ -15109,7 +15155,7 @@ stepsTask.prototype.notItemConfig = function () { if (enterprise == "1") { optionsType.push({value: "SUMMARY_FORM", label: "Summary Form".translate()}); } - // sorting the optionsType + // sorting the optionsType optionsType.sort(function(a, b) { return (a.label > b.label) ? 1 : ((b.label > a.label) ? -1 : 0); }); @@ -15439,6 +15485,7 @@ stepsTask.prototype.notItemConfig = function () { } } else { cboGroupOrUser.showMessageRequired(); + frmProcessPermissions.addItem(notification) } cboGroupOrUser.html.find("input").val(""); @@ -19028,7 +19075,7 @@ PMDesigner.ProcessFilesManager = function (processFileManagerOptionPath, optionC prf_content: null }, functionSuccess: function (xhr, response) { - var win = window, fd = new FormData(), xhr, val = 'prf_file'; + var win = window, fd = new FormData(), xhr, val = 'prf_file', resp = null; fd.append(val, fileSelector.files[0]); if (win.XMLHttpRequest) xhr = new XMLHttpRequest(); @@ -19037,7 +19084,8 @@ PMDesigner.ProcessFilesManager = function (processFileManagerOptionPath, optionC xhr.open('POST', '/api/1.0/' + WORKSPACE + '/project/' + PMDesigner.project.id + '/file-manager/' + response.prf_uid + '/upload', true); xhr.setRequestHeader('Authorization', 'Bearer ' + PMDesigner.project.keys.access_token); xhr.onload = function () { - if (this.status === 200) { + switch (this.status) { + case 200: formUploadField.reset(); windowUpload.close(); if (processFileManagerOptionPath == "templates") { @@ -19048,6 +19096,15 @@ PMDesigner.ProcessFilesManager = function (processFileManagerOptionPath, optionC PMDesigner.msgFlash('File uploaded successfully'.translate(), gridPublic); loadPublic(); } + break; + case 403: + case 415: + case 429: + if (this.response) { + resp = JSON.parse(this.response); + PMDesigner.msgWinError(resp.message ? resp.message : resp.error.message); + } + break; } }; xhr.send(fd); @@ -24557,10 +24614,9 @@ PMDesigner.RoutingRule = function (shape) { * @param connection */ function removeConnection(connection) { - PMUI.getActiveCanvas().emptyCurrentSelection(); PMUI.getActiveCanvas().setCurrentConnection(connection); - PMUI.getActiveCanvas().removeElements(); + PMUI.getActiveCanvas().executeCommandDelete(); connection.saveAndDestroy(); PMUI.getActiveCanvas().removeConnection(connection); } @@ -31765,13 +31821,11 @@ PMMessageType.prototype.init = function () { var that = this; that.buttonCreate.defineEvents(); - - that.winMessageType.open(); that.winMessageType.addItem(that.gridMessages); that.winMessageType.addItem(that.frmMessageType); - that.winMessageType.addItem(that.gridAcceptedValues); that.winMessageType.hideFooter(); + that.winMessageType.open(); that.requiredMessage = $(document.getElementById("requiredMessage")); this.buttonFieldAdd.controls[0].button.setStyle({cssProperties: {padding: "6px 15px"}}); @@ -32019,7 +32073,7 @@ PMMessageType.prototype.addAcceptedValue = function () { var that = this, value = $.trim(that.frmAcceptedValues.getField('txtMessageTypeVariableName').getValue()), message; - + // if the form (form field's RegEx) is invalid, add a Message Field will not be allowed. if (!that.frmAcceptedValues.isValid()) { return; @@ -34674,6 +34728,7 @@ IntroHelper.prototype.startIntro = function () { skin_variant: 'silver', relative_urls : false, remove_script_host : false, + convert_urls: false, plugins: 'advhr,advimage,advlink,advlist,autolink,autoresize,contextmenu,directionality,emotions,example,example_dependency,fullpage,fullscreen,iespell,inlinepopups,insertdatetime,layer,legacyoutput,lists,media,nonbreaking,noneditable,pagebreak,paste,preview,print,save,searchreplace,style,tabfocus,table,template,visualblocks,visualchars,wordcount,xhtmlxtras,pmSimpleUploader,pmVariablePicker,style', theme_advanced_buttons1: 'pmSimpleUploader,|,pmVariablePicker,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,cut,copy,paste', theme_advanced_buttons2: 'bullist,numlist,|,outdent,indent,blockquote,|,tablecontrols,|,undo,redo,|,link,unlink,image,|,forecolor,backcolor,styleprops', diff --git a/vendor/colosa/MichelangeloFE/build/js/mafe.js b/vendor/colosa/MichelangeloFE/build/js/mafe.js index 065bfc654..926c83b25 100644 --- a/vendor/colosa/MichelangeloFE/build/js/mafe.js +++ b/vendor/colosa/MichelangeloFE/build/js/mafe.js @@ -16754,7 +16754,10 @@ PMShape.prototype.getBpmnElementType = function () { PMShape.prototype.createWithBpmn = function (bpmnElementType, name) { var businessObject = {}; - businessObject.elem = PMDesigner.bpmnFactory.create(bpmnElementType, {id: 'el_' + this.id, name: this.getName()}); + businessObject.elem = PMDesigner.bpmnFactory.create(bpmnElementType, { + id: 'el_' + this.id, + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "" + }); if (!businessObject.di) { if (this.type === 'PMParticipant' || this.type === 'PMPool' || this.type === 'PMLane') { businessObject.di = PMDesigner.bpmnFactory.createDiShape(businessObject.elem, {}, { @@ -18174,7 +18177,7 @@ PMFlow.prototype.getBpmnElementType = function () { PMFlow.prototype.createWithBpmn = function (bpmnElementType) { var businessObject = PMDesigner.bpmnFactory.create(bpmnElementType, { id: 'flo_' + this.id, - name: this.getName() ? this.getName() : "" + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "" }); businessObject.di = PMDesigner.bpmnFactory.createDiEdge(businessObject, [], { id: businessObject.id + '_di' @@ -22120,14 +22123,31 @@ PMCanvas.prototype.hideFlowRecursively = function (shape) { * @chainable */ PMCanvas.prototype.removeElements = function () { - // destroy the shapes (also destroy all the references to them) - var shape, - command; - if (!this.canCreateShape && !this.isDragging) { - command = new PMCommandDelete(this); - this.commandStack.add(command); - command.execute(); + var that = this, + dialogConfirm; + if (!that.canCreateShape && !that.isDragging) { + // Delete shape with a modal Dialog Confirm. + dialogConfirm = new FormDesigner.main.DialogConfirm(null, "warning", "Are you sure you want to delete this element?".translate()); + dialogConfirm.onAccept = function () { + that.executeCommandDelete(); + }; + dialogConfirm.onClose = function () { + PMUI.isDelete = false; + return that; + }; } + return that; +}; + +/** + * Calls to Delete command and executes the action + * @param {PMCanvas} canvas + */ +PMCanvas.prototype.executeCommandDelete = function () { + // destroy the shapes (also destroy all the references to them) + var command = new PMCommandDelete(this); + this.commandStack.add(command); + command.execute(); return this; }; @@ -24997,15 +25017,17 @@ PMGateway.prototype.setGatewayType = function (type) { * @return {*} */ PMGateway.prototype.setDirection = function (direction) { - direction = direction.toLowerCase(); - var defaultDir = { - unspecified: 'UNSPECIFIED', - diverging: 'DIVERGING', - converging: 'CONVERGING', - mixed: 'MIXED' - }; - if (defaultDir[direction]) { - this.gat_direction = defaultDir[direction]; + if (typeof direction !== 'undefined') { + direction = direction.toLowerCase(); + var defaultDir = { + unspecified: 'UNSPECIFIED', + diverging: 'DIVERGING', + converging: 'CONVERGING', + mixed: 'MIXED' + }; + if (defaultDir[direction]) { + this.gat_direction = defaultDir[direction]; + } } return this; }; @@ -25159,8 +25181,16 @@ PMGateway.prototype.manualCreateMenu = function (e) { }; PMGateway.prototype.beforeContextMenu = function () { - var i, port, connection, shape, defaultflowItems = [], items, item, name, - target, menuItem, hasMarker; + var i, + port, + connection, + shape, + defaultflowItems = [], + items, + name, + target, + menuItem, + hasMarker; this.canvas.hideAllCoronas(); if (this.canvas.readOnly) { return; @@ -25177,7 +25207,6 @@ PMGateway.prototype.beforeContextMenu = function () { } } - defaultflowItems.push({ text: 'None'.translate(), id: 'emptyFlow', @@ -25213,8 +25242,7 @@ PMGateway.prototype.beforeContextMenu = function () { { text: name, id: connection.getID(), - disabled: (connection.getID() === this.gat_default_flow) - ? true : false, + disabled: (connection.getID() === this.gat_default_flow), onClick: function (menuOption) { target = menuOption.getMenuTargetElement(); //target.setDefaultFlow(menuOption.id); @@ -25228,7 +25256,7 @@ PMGateway.prototype.beforeContextMenu = function () { if (this.defaltFlowMenuItem) { this.menu.removeItem('defaultflowMenu'); } - if ((defaultflowItems.length > 0) && (this.gat_type != "PARALLEL")) { + if ((defaultflowItems.length > 0) && (this.gat_type !== "PARALLEL")) { this.defaltFlowMenuItem = { id: 'defaultflowMenu', text: "Default Flow".translate(), @@ -25264,19 +25292,20 @@ PMGateway.prototype.isSupported = function () { return isSupported; }; /** - * evaluates the gateway address, according to the amount of input and output connections + * Evaluates the gateway address, according to the amount of input and output connections, by default use Diverging. + * Converging multiples inputs and only an output. + * Diverging an input and an output. + * Diverging multiples inputs output and multiples outputs. * @returns {PMGateway} */ -PMGateway.prototype.evaluateGatewayDirection = function(){ +PMGateway.prototype.evaluateGatewayDirection = function () { var incomings = this.getIncomingConnections('SEQUENCE', 'DEFAULT') || [], outgoings = this.getOutgoingConnections('SEQUENCE', 'DEFAULT') || [], + direction; + if (incomings.length > 1 && outgoings.length === 1) { + direction = "CONVERGING"; + } else { direction = "DIVERGING"; - if (outgoings.length < incomings.length) { - if (incomings.length === 1 && outgoings.length === 0){ - direction = "DIVERGING"; - }else{ - direction = "CONVERGING"; - } } this.setDirection(direction); return this; @@ -25324,6 +25353,7 @@ PMGateway.prototype.removeOutgoingConnection = function() { PMShape.prototype.removeOutgoingConnection.apply(this, arguments); return this.evaluateGatewayDirection(); }; + var PMLine = function (options) { PMUI.draw.RegularShape.call(this, options); /** @@ -25752,7 +25782,10 @@ PMArtifact.prototype.createWithBpmn = function () { var businessObject = {}; var bpmnElementType = this.getBpmnElementType(); - businessObject.elem = PMDesigner.bpmnFactory.create(bpmnElementType, {id: this.id, text: this.getName()}); + businessObject.elem = PMDesigner.bpmnFactory.create(bpmnElementType, { + id: this.id, + text: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "" + }); if (!businessObject.di) { if (this.type === 'Connection') { @@ -30377,21 +30410,27 @@ PMData.prototype.updateBpmnDataType = function (newBpmnType, dataType) { PMData.prototype.createWithBpmn = function (bpmnElementType, name) { var businessObject = {}; if (this.extendedType === 'DATASTORE') { - var ds = PMDesigner.bpmnFactory.create('bpmn:DataStore', {id: this.id, name: this.getName()}); + var ds = PMDesigner.bpmnFactory.create('bpmn:DataStore', { + id: this.id, + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "", + }); PMDesigner.businessObject.get('rootElements').push(ds); businessObject.elem = PMDesigner.bpmnFactory.create('bpmn:DataStoreReference', { id: this.id + '_ref', - name: this.getName(), + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "", dataStoreRef: ds }); businessObject.elem.dsRef = ds; } else { if (bpmnElementType == 'bpmn:DataObject' || bpmnElementType === undefined) { - var dObj = PMDesigner.bpmnFactory.create('bpmn:DataObject', {id: this.id, name: this.getName()}); + var dObj = PMDesigner.bpmnFactory.create('bpmn:DataObject', { + id: this.id, + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "", + }); businessObject.elem = PMDesigner.bpmnFactory.create('bpmn:DataObjectReference', { id: this.id + '_ref', - name: this.getName(), + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "", dataObjectRef: dObj }); // validate if container is a lane because data store is always into process tag @@ -30443,7 +30482,7 @@ PMData.prototype.getDataType = function () { PMData.prototype.createDataIOEspecification = function (element) { var ioEspecification = PMDesigner.bpmnFactory.create('bpmn:InputOutputSpecification', { id: this.id + '_ioEspecification', - name: this.getName() + '_ioEspecification' + name: (this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "") + '_ioEspecification' }); ioEspecification['dataInputs'] = []; this.parent.businessObject.elem['ioSpecification'] = ioEspecification; @@ -30460,7 +30499,10 @@ PMData.prototype.createDataBusinessObject = function () { }; PMData.prototype.createDataIOBusinessObject = function (bpmnElementType) { - var dObj = PMDesigner.bpmnFactory.create(bpmnElementType, {id: this.id, name: this.getName()}); + var dObj = PMDesigner.bpmnFactory.create(bpmnElementType, { + id: this.id, + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "" + }); this.parent.businessObject.elem['ioSpecification'].dataInputs.push(dObj); return {elem: dObj}; }; @@ -33637,7 +33679,8 @@ PMCommandDelete.prototype.undo = function () { PMCommandDelete.prototype.redo = function () { this.execute(); return this; -}; +}; + var PMCommandResize = function (receiver) { PMCommandResize.superclass.call(this, receiver); this._boundExceed = null; @@ -35831,7 +35874,7 @@ importBpmnDiagram.prototype.completeImportFlows = function () { flo_element_dest: dest, flo_element_origin: origin, flo_is_inmediate: "1", - flo_name: null, + flo_name: element.name || null, flo_state: state, flo_type: conectionMap[element.$type], flo_x1: state[0].x, @@ -37642,8 +37685,8 @@ FormDesigner.leftPad = function (string, length, fill) { value: "", type: "text", on: "change", - regExp: /^[a-zA-Z0-9-_]+$/, - regExpInv: /[^a-zA-Z0-9-_]/gi, + regExp: new RegExp(__env.pmVariable.regEx.substr(1, __env.pmVariable.regEx.length - 2)), + regExpInv: new RegExp(__env.pmVariable.regEx.substr(1, __env.pmVariable.regEx.length - 2), "gi"), required: true }; this.name = {label: "name".translate(), value: "", type: "hidden", labelButton: "...", required: true}; @@ -38653,6 +38696,9 @@ FormDesigner.leftPad = function (string, length, fill) { that.form1.setDirty(); that.onSave(); }, + functionFailure: function (xhr, response) { + PMDesigner.msgWinError(response.error.message); + }, messageError: 'There are problems creating the DynaForm, please try again.'.translate(), messageSuccess: 'DynaForm saved successfully'.translate(), flashContainer: '' @@ -38661,7 +38707,14 @@ FormDesigner.leftPad = function (string, length, fill) { return false; }; this.areaButtons.export_[0].onclick = function () { - var jsondata = that.getData(); + var jsondata = that.getData(), + i, + variables, + size= (typeof jsondata['items'] !== 'undefined') ? jsondata['items'].length : 0; // validation for undefined issues + for (i = 0; i < size; i += 1) { + variables = jsondata['items'][i]['variables']; + variables.forEach(function(v){ delete v.create }); + }; var name = (that.form1.properties.name.value ? that.form1.properties.name.value : 'untitle') + '.json'; if (window.navigator.msSaveBlob) { window.navigator.msSaveBlob(new Blob([JSON.stringify(jsondata)], {'type': 'application/octet-stream'}), name); @@ -38804,7 +38857,8 @@ FormDesigner.leftPad = function (string, length, fill) { duplicated, regExp, type, - existRegExp; + existRegExp, + dateLimit; switch (prop) { case "name": if (target.properties[prop].node && target instanceof FormDesigner.main.Form) { @@ -38997,39 +39051,70 @@ FormDesigner.leftPad = function (string, length, fill) { break; case "defaultDate": if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { - if (value === "today") { - target.properties.defaultDate.disabledTodayOption = true; - listProperties.clear(); - listProperties.load(target.properties); - } - if (value === "") { - target.properties.defaultDate.disabledTodayOption = false; - listProperties.clear(); - listProperties.load(target.properties); + if (target.properties[prop].node) { + if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { + if (value === "today") { + target.properties.defaultDate.disabledTodayOption = true; + listProperties.clear(); + listProperties.load(target.properties); + } else if (value === "") { + target.properties.defaultDate.disabledTodayOption = false; + listProperties.clear(); + listProperties.load(target.properties); + } else { + dateLimit = that.thereIsDefaultDateLimit( + target.properties.minDate.value, + target.properties.maxDate.value, + target.properties.defaultDate.value + ); + if (dateLimit) { + dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Default date is out of range.".translate()); + dialogMessage.onClose = function () { + target.properties.set("defaultDate", dateLimit); + target.properties.defaultDate.node.value = dateLimit; + }; + } + } + } } + } break; case "maxDate": - if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { - if (target.properties.maxDate.value < target.properties.defaultDate.value && - target.properties.defaultDate.value !== "" && target.properties.maxDate.value !== "") { - dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Default date is out of range.".translate()); - dialogMessage.onClose = function () { - target.properties.set("defaultDate", target.properties.maxDate.value); - target.properties.defaultDate.node.value = target.properties.maxDate.value; - }; + if (target.properties[prop].node) { + if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { + if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { + dateLimit = that.thereIsMaxDateLimit( + target.properties.minDate.value, + target.properties.maxDate.value, + target.properties.defaultDate.value + ); + if (dateLimit) { + dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Max date must be greater than the min and default date".translate()); + dialogMessage.onClose = function () { + target.properties.set("maxDate", dateLimit); + target.properties.maxDate.node.value = dateLimit; + }; + } + } } } break; case "minDate": - if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { - if (target.properties.minDate.value > target.properties.defaultDate.value && - target.properties.defaultDate.value !== "" && target.properties.minDate.value !== "") { - dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Default date is out of range.".translate()); - dialogMessage.onClose = function () { - target.properties.set("defaultDate", target.properties.minDate.value); - target.properties.defaultDate.node.value = target.properties.minDate.value; - }; + if (target.properties[prop].node) { + if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { + dateLimit = that.thereIsMinDateLimit( + target.properties.minDate.value, + target.properties.maxDate.value, + target.properties.defaultDate.value + ); + if (dateLimit) { + dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Min date must be lesser than the max and default date.".translate()); + dialogMessage.onClose = function () { + target.properties.set("minDate", dateLimit); + target.properties.minDate.node.value = dateLimit; + }; + } } } break; @@ -39038,6 +39123,27 @@ FormDesigner.leftPad = function (string, length, fill) { target.properties.requiredFieldErrorMessage.node.disabled = !value; } break; + case "size": + case "sizeUnity": + //the "maxFileSizeInformation" variable, comes from backend. + that.validateMaxFileSize( + target, + maxFileSizeInformation, + function (target, message) { + var dialogMessage, + value, + oldValue; + value = target.properties[prop].value; + oldValue = target.properties[prop].oldValue; + if (target.properties[prop].node && value !== oldValue) { + dialogMessage = new FormDesigner.main.DialogMessage(null, "alert", message); + dialogMessage.onClose = function () { + that.setMinimalFileSize(target, maxFileSizeInformation); + }; + } + } + ); + break; } }; this.form1.onSynchronizeVariables = function (variables) { @@ -39081,11 +39187,6 @@ FormDesigner.leftPad = function (string, length, fill) { this.form1.properties.protectedValue.type = "hidden"; this.form1.setData(this.dynaform); this.form1.setDirty(); - //this.form2.onSelect = function (properties) { - // listProperties.clear(); - // listProperties.load(properties); - //}; - //methods that.title.text(this.dynaform.dyn_title).attr("title", this.dynaform.dyn_title).tooltip({ tooltipClass: "fd-tooltip", position: {my: "left top+1"} @@ -39147,6 +39248,186 @@ FormDesigner.leftPad = function (string, length, fill) { } }); }; + /** + * Validate the date + * @param date + * + */ + Designer.prototype.parseDate = function (stringDate) { + var parts; + if (typeof stringDate !== "undefined" && stringDate !== null) { + parts = stringDate.split("-"); + // new Date(year, month [, day [, hours[, minutes[, seconds[, ms]]]]]) + return new Date(parts[0], parts[1] - 1, parts[2]); // Note: months are 0-based + } + return null; + }; + /** + * Verifies if a date is valid + * @param date + * @returns {boolean} + */ + Designer.prototype.isValidDate = function (date) { + return date instanceof Date && !isNaN(date); + }; + /** + * Search if there is a limit lower than minDate property. + * @param minDateString + * @param maxDateString + * @param defaultDateString + * @returns {Object} + */ + Designer.prototype.thereIsMinDateLimit = function (minDateString, maxDateString, defaultDateString) { + var minDate = this.parseDate(minDateString), + maxDate = this.parseDate(maxDateString), + defaultDate = this.parseDate(defaultDateString), + result = null; + if (this.isValidDate(minDate)) { + if (this.isValidDate(defaultDate)) { + if (minDate > defaultDate) { + result = defaultDateString; + } + } + if (!result && this.isValidDate(maxDate)) { + if (minDate > maxDate) { + result = maxDateString; + } + } + } + return result; + }; + /** + * Search if there is a limit highest than maxDate property. + * @param minDateString + * @param maxDateString + * @param defaultDateString + * @returns {Object} + */ + Designer.prototype.thereIsMaxDateLimit = function (minDateString, maxDateString, defaultDateString) { + var minDate = this.parseDate(minDateString), + maxDate = this.parseDate(maxDateString), + defaultDate = this.parseDate(defaultDateString), + result = null; + if (this.isValidDate(maxDate)) { + if (this.isValidDate(defaultDate)) { + if (maxDate < defaultDate) { + result = defaultDateString; + } + } + if (!result && this.isValidDate(minDate)) { + if (maxDate < minDate) { + result = minDateString; + } + } + } + return result; + }; + /** + * Search if defaultDate property is in range of min date and max date. + * @param minDateString + * @param maxDateString + * @param defaultDateString + * @returns {Object} + */ + Designer.prototype.thereIsDefaultDateLimit = function (minDateString, maxDateString, defaultDateString) { + var minDate = this.parseDate(minDateString), + maxDate = this.parseDate(maxDateString), + defaultDate = this.parseDate(defaultDateString), + result = null; + if (this.isValidDate(defaultDate)) { + if (this.isValidDate(minDate)) { + if (defaultDate < minDate) { + result = minDateString; + } + } + if (!result && this.isValidDate(maxDate)) { + if (defaultDate > maxDate) { + result = maxDateString; + } + } + } + return result; + }; + /** + * Validate Max File Size, if the value exceeds the allowed limit, an alert message + * is displayed. + * + * @param object target + * @param object maxFileSizeInformation + * @param function callback + */ + Designer.prototype.validateMaxFileSize = function (target, maxFileSizeInformation, callback) { + var isTypeValid, + message; + + if (target.properties === null) { + return; + } + + isTypeValid = target.properties.type.value === FormDesigner.main.TypesControl.file || + target.properties.type.value === FormDesigner.main.TypesControl.multipleFile; + if (!isTypeValid) { + return; + } + if (this.isValidMaxFileSizeFromProperties(maxFileSizeInformation, target.properties) === false) { + message = "The maximum value of this field is ".translate() + maxFileSizeInformation.uploadMaxFileSize; + callback(target, message); + } + }; + /** + * Returns true if the value of Max files Size, satisfies the configuration of + * the php ini directives, false otherwise. + * + * @param {object} maxFileSizeInformation + * @param {object} properties + * @returns {Boolean} + */ + Designer.prototype.isValidMaxFileSizeFromProperties = function (maxFileSizeInformation, properties) { + var value, + unit, + items, + i; + value = parseInt(properties.size.value, 10); + unit = properties.sizeUnity.value; + items = properties.sizeUnity.items; + + if (Array.isArray(items)) { + for (i = 0; i < items.length; i += 1) { + if (unit === items[i].value) { + value = value * Math.pow(1024, i + 1); + } + } + } + + if (maxFileSizeInformation.uploadMaxFileSizeBytes < value) { + return false; + } + return true; + }; + /** + * Set Minimal File Size. + * + * @param object target + * @param object maxFileSizeInformation + */ + Designer.prototype.setMinimalFileSize = function (target, maxFileSizeInformation) { + var size, + sizeValue, + sizeUnity, + sizeUnityValue; + + sizeValue = maxFileSizeInformation.uploadMaxFileSizeMBytes; + size = target.properties.set("size", sizeValue); + if (size && size.node) { + size.node.value = sizeValue; + } + + sizeUnityValue = maxFileSizeInformation.uploadMaxFileSizeUnit; + sizeUnity = target.properties.set("sizeUnity", sizeUnityValue); + if (sizeUnity.node) { + sizeUnity.node.value = sizeUnityValue; + } + }; FormDesigner.extendNamespace('FormDesigner.main.Designer', Designer); }()); @@ -40485,7 +40766,8 @@ FormDesigner.leftPad = function (string, length, fill) { defaultDate = '', dialogMessage = '', width = "width:100%;border:1px solid gray;box-sizing:border-box;", - id = FormDesigner.generateUniqueId(); + id = FormDesigner.generateUniqueId(), + that = this; switch (propertiesGot[property].type) { case "label": //improvement changes in value @@ -40578,7 +40860,7 @@ FormDesigner.leftPad = function (string, length, fill) { break; case "datepicker": input = $("").val(propertiesGot[property].value); - input.on(propertiesGot[property].on ? propertiesGot[property].on : "keyup", function () { + input.on(propertiesGot[property].on ? propertiesGot[property].on : "change", function () { properties.set(property, this.value); }); input.attr("placeholder", propertiesGot[property].placeholder ? propertiesGot[property].placeholder : ""); @@ -40657,56 +40939,30 @@ FormDesigner.leftPad = function (string, length, fill) { return; switch (property) { case "defaultDate": - minDate = $(cellValue.parent().parent()[0].rows["minDate"]).find("input").val(); - maxDate = $(cellValue.parent().parent()[0].rows["maxDate"]).find("input").val(); + minDate = that.getDateByParam(cellValue, "minDate"); + maxDate = that.getDateByParam(cellValue, "maxDate"); break; case "minDate": - maxDate = $(cellValue.parent().parent()[0].rows["maxDate"]).find("input").val(); + maxDate = that.getDateByParam(cellValue, "maxDate"); break; case "maxDate": - minDate = $(cellValue.parent().parent()[0].rows["minDate"]).find("input").val(); + minDate = that.getDateByParam(cellValue, "minDate"); break; } - var dp = cellValue.find("input[type='text']").datepicker({ - showOtherMonths: true, - selectOtherMonths: true, - dateFormat: "yy-mm-dd", - showOn: "button", - changeMonth: true, - changeYear: true, - yearRange: "-100:+100", + + that.datepicker = that.dateComponentFactory(cellValue, { minDate: minDate, maxDate: maxDate, onSelect: function (dateText, inst) { properties.set(property, dateText, cellValue.find("input[type='text']")[0]); }, onClose: function (dateText, inst) { - dp.datepicker("destroy"); + that.datepicker.datepicker("destroy"); $("#ui-datepicker-div").remove(); } }); - dp.datepicker("show"); cellValue.find(".ui-datepicker-trigger").hide(); }); - if (property === "defaultDate") { - minDate = $(cellValue.parent().parent()[0].rows["minDate"]).find("input").val(); - maxDate = $(cellValue.parent().parent()[0].rows["maxDate"]).find("input").val(); - defaultDate = $(cellValue.parent().parent()[0].rows["defaultDate"]).find("input").val(); - if (minDate > defaultDate && minDate !== "") { - dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Default date is out of range.".translate()); - dialogMessage.onClose = function () { - properties.set(property, minDate); - properties[property].node.value = minDate; - }; - } - if (maxDate < defaultDate && maxDate !== "") { - dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Default date is out of range.".translate()); - dialogMessage.onClose = function () { - properties.set(property, maxDate); - properties[property].node.value = maxDate; - }; - } - } cellValue.append(button); n = n + 16; cellValue[0].style.paddingRight = n + "px"; @@ -40757,8 +41013,68 @@ FormDesigner.leftPad = function (string, length, fill) { ListProperties.prototype.clear = function () { this.tbody.find("tr").remove(); }; + /** + * Creates the date picker component. + * @param control the form control to set de datepicker. + * @param options dynamic params to set the properties. + * @returns {*} + */ + ListProperties.prototype.dateComponentFactory = function (control, options) { + var defaults = { + showOtherMonths: true, + selectOtherMonths: true, + dateFormat: "yy-mm-dd", + changeMonth: true, + changeYear: true, + yearRange: "-100:+100", + minDate: '', + maxDate: '', + onSelect: function() {}, + onClose: function() {} + }, + datePicker; + $.extend(true, defaults, options); + // append the date picker to the control component + datePicker = control + .find("input[type='text']") + .datepicker({ + showOtherMonths: defaults.showOtherMonths, + selectOtherMonths: defaults.selectOtherMonths, + dateFormat: defaults.dateFormat, + showOn: defaults.showOn, + changeMonth: defaults.changeMonth, + changeYear: defaults.changeYear, + yearRange: defaults.yearRange, + minDate: defaults.minDate, + maxDate: defaults.maxDate, + onSelect: defaults.onSelect, + onClose: defaults.onClose + }); + datePicker.datepicker("show"); + return datePicker; + }; + /** + * Gets the date according to the passed param + */ + ListProperties.prototype.getDateByParam = function(control, param) { + var varRegex = /\@(?:([\@\%\#\?\$\=\&Qq\!])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[['"]?\w+['"]?\])+|\-\>([a-zA-Z\_]\w*))?/, + value = ''; + if (control && param) { + value = $(control.parent().parent()[0].rows[param]) + .find("input") + .val(); + if (!varRegex.test(value)) { + return value; + } else { + return ''; + } + } else { + return ''; + } + }; FormDesigner.extendNamespace('FormDesigner.main.ListProperties', ListProperties); }()); + (function () { var TabsForm = function () { TabsForm.prototype.init.call(this); @@ -44744,4 +45060,4 @@ ModelCrown.prototype.removeItemFromCrown = function (idItem) { } return this; }; -var __env = __env || {};__env.USER_GUEST = {"uid":"00000000000000000000000000000002","firstname":"Guest","lastname":"Guest","username":"guest"}; +var __env = __env || {};__env.USER_GUEST = {"uid":"00000000000000000000000000000002","firstname":"Guest","lastname":"Guest","username":"guest"}; __env.pmVariable = {"regEx":"/^[a-zA-Z\\_]{1}\\w+$/"}; diff --git a/vendor/colosa/MichelangeloFE/src/applications/designer.js b/vendor/colosa/MichelangeloFE/src/applications/designer.js index 8776f115e..e40624a31 100644 --- a/vendor/colosa/MichelangeloFE/src/applications/designer.js +++ b/vendor/colosa/MichelangeloFE/src/applications/designer.js @@ -182,8 +182,21 @@ PMDesigner.hideAllTinyEditorControls = function () { jQuery(document).ready(function ($) { - var setSaveButtonDisabled, s, sidebarCanvas, project, d, downloadLink, handlerExportNormal, handlerExportGranular, - handler, validatosr, help, option, menu, elem; + var setSaveButtonDisabled, + s, + sidebarCanvas, + project, + d, + downloadLink, + handlerExportNormal, + handlerExportGranular, + handler, + validatosr, + help, + option, + menu, + elem, + validatorLabel = "Validator".translate(); /*************************************************** * Defines the Process ***************************************************/ @@ -432,7 +445,7 @@ jQuery(document).ready(function ($) { * Add data tables */ $('body').append('
') - $('.validator_header').append('

Validator

'); + $('.validator_header').append('

' + validatorLabel + '

'); $('.validator_header').append(''); $('.validator_body').html('
'); PMDesigner.validTable = $('#validator-table').DataTable({ @@ -1191,6 +1204,27 @@ PMDesigner.reloadDataTable = function () { $('.bpmn_validator').css('visibility', 'visible'); }; +/** + * Escape XML characters method. + * There are only five: + * " " + * ' ' + * < < + * > > + * & & + * + * @param {string} label + * @returns {string} + */ +PMDesigner.escapeXMLCharacters = function (label) { + return label + .replace(/&/g, "&") + .replace(/"/g, """) + .replace(/'/g, "'") + .replace(//g, ">"); +}; + DataDictionary = function () { }; DataDictionary.prototype.getColor = function (value) { @@ -1354,16 +1388,16 @@ ViewTaskInformation.prototype.clearRows = function () { ViewTaskInformation.prototype.showInformation = function () { var that = this; that.clearRows(); - that.addRow('Title', that.shapeData.tas_title); - that.addRow('Description', that.shapeData.tas_description); - that.addRow('Status', that.dataDictionary.getStatus(that.shapeData.status)); - that.addRow('Type', that.dataDictionary.getTasType(that.shapeData.tas_type)); - that.addRow('Assign type', that.dataDictionary.getTasAssignType(that.shapeData.tas_assign_type)); - that.addRow('Derivation', that.dataDictionary.getTasDerivation(that.shapeData.tas_derivation)); - that.addRow('Start', that.shapeData.tas_start); + that.addRow('Title'.translate(), that.shapeData.tas_title); + that.addRow('Description'.translate(), that.shapeData.tas_description); + that.addRow('Status'.translate(), that.dataDictionary.getStatus(that.shapeData.status)); + that.addRow('Type'.translate(), that.dataDictionary.getTasType(that.shapeData.tas_type)); + that.addRow('Assign type'.translate(), that.dataDictionary.getTasAssignType(that.shapeData.tas_assign_type)); + that.addRow('Routing'.translate(), that.dataDictionary.getTasDerivation(that.shapeData.tas_derivation)); + that.addRow('Start'.translate(), that.shapeData.tas_start); that.addRowNewLine(); - that.addRow('User Name', that.shapeData.usr_username); - that.addRow('User', that.shapeData.usr_firstname + ' ' + that.shapeData.usr_lastname); + that.addRow('Last User Name'.translate(), that.shapeData.usr_username); + that.addRow('Last User'.translate(), that.shapeData.usr_firstname + ' ' + that.shapeData.usr_lastname); that.windowAbstract.setTitle('Information'.translate() + ' ' + that.shapeData.tas_title); that.windowAbstract.open(); diff --git a/vendor/colosa/MichelangeloFE/src/applications/emailEventProperties.js b/vendor/colosa/MichelangeloFE/src/applications/emailEventProperties.js index 558938e24..4ecea38c7 100644 --- a/vendor/colosa/MichelangeloFE/src/applications/emailEventProperties.js +++ b/vendor/colosa/MichelangeloFE/src/applications/emailEventProperties.js @@ -357,6 +357,7 @@ skin_variant: 'silver', relative_urls : false, remove_script_host : false, + convert_urls: false, plugins: 'advhr,advimage,advlink,advlist,autolink,autoresize,contextmenu,directionality,emotions,example,example_dependency,fullpage,fullscreen,iespell,inlinepopups,insertdatetime,layer,legacyoutput,lists,media,nonbreaking,noneditable,pagebreak,paste,preview,print,save,searchreplace,style,tabfocus,table,template,visualblocks,visualchars,wordcount,xhtmlxtras,pmSimpleUploader,pmVariablePicker,style', theme_advanced_buttons1: 'pmSimpleUploader,|,pmVariablePicker,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,justifyfull,|,fontselect,fontsizeselect,|,cut,copy,paste', theme_advanced_buttons2: 'bullist,numlist,|,outdent,indent,blockquote,|,tablecontrols,|,undo,redo,|,link,unlink,image,|,forecolor,backcolor,styleprops', diff --git a/vendor/colosa/MichelangeloFE/src/applications/messageType.js b/vendor/colosa/MichelangeloFE/src/applications/messageType.js index f49e017eb..d5422b97d 100644 --- a/vendor/colosa/MichelangeloFE/src/applications/messageType.js +++ b/vendor/colosa/MichelangeloFE/src/applications/messageType.js @@ -336,13 +336,11 @@ PMMessageType.prototype.init = function () { var that = this; that.buttonCreate.defineEvents(); - - that.winMessageType.open(); that.winMessageType.addItem(that.gridMessages); that.winMessageType.addItem(that.frmMessageType); - that.winMessageType.addItem(that.gridAcceptedValues); that.winMessageType.hideFooter(); + that.winMessageType.open(); that.requiredMessage = $(document.getElementById("requiredMessage")); this.buttonFieldAdd.controls[0].button.setStyle({cssProperties: {padding: "6px 15px"}}); @@ -590,7 +588,7 @@ PMMessageType.prototype.addAcceptedValue = function () { var that = this, value = $.trim(that.frmAcceptedValues.getField('txtMessageTypeVariableName').getValue()), message; - + // if the form (form field's RegEx) is invalid, add a Message Field will not be allowed. if (!that.frmAcceptedValues.isValid()) { return; diff --git a/vendor/colosa/MichelangeloFE/src/applications/processFilesManager.js b/vendor/colosa/MichelangeloFE/src/applications/processFilesManager.js index 96b6530ac..1d3d0abbb 100644 --- a/vendor/colosa/MichelangeloFE/src/applications/processFilesManager.js +++ b/vendor/colosa/MichelangeloFE/src/applications/processFilesManager.js @@ -940,7 +940,7 @@ PMDesigner.ProcessFilesManager = function (processFileManagerOptionPath, optionC prf_content: null }, functionSuccess: function (xhr, response) { - var win = window, fd = new FormData(), xhr, val = 'prf_file'; + var win = window, fd = new FormData(), xhr, val = 'prf_file', resp = null; fd.append(val, fileSelector.files[0]); if (win.XMLHttpRequest) xhr = new XMLHttpRequest(); @@ -949,7 +949,8 @@ PMDesigner.ProcessFilesManager = function (processFileManagerOptionPath, optionC xhr.open('POST', '/api/1.0/' + WORKSPACE + '/project/' + PMDesigner.project.id + '/file-manager/' + response.prf_uid + '/upload', true); xhr.setRequestHeader('Authorization', 'Bearer ' + PMDesigner.project.keys.access_token); xhr.onload = function () { - if (this.status === 200) { + switch (this.status) { + case 200: formUploadField.reset(); windowUpload.close(); if (processFileManagerOptionPath == "templates") { @@ -960,6 +961,15 @@ PMDesigner.ProcessFilesManager = function (processFileManagerOptionPath, optionC PMDesigner.msgFlash('File uploaded successfully'.translate(), gridPublic); loadPublic(); } + break; + case 403: + case 415: + case 429: + if (this.response) { + resp = JSON.parse(this.response); + PMDesigner.msgWinError(resp.message ? resp.message : resp.error.message); + } + break; } }; xhr.send(fd); diff --git a/vendor/colosa/MichelangeloFE/src/applications/processPermissionsModule.js b/vendor/colosa/MichelangeloFE/src/applications/processPermissionsModule.js index 9067acfbf..364686f7b 100644 --- a/vendor/colosa/MichelangeloFE/src/applications/processPermissionsModule.js +++ b/vendor/colosa/MichelangeloFE/src/applications/processPermissionsModule.js @@ -38,7 +38,10 @@ cboOutputDocument, cboPermission, cboParticipationRequired, - processPermissionsDataIni = {}; + processPermissionsDataIni = {}, + notification, + notificationText = "Fields marked with an asterisk (%%ASTERISK%%) are required.".translate() + .replace(/%%ASTERISK%%/g, '*'); loadDataFromServerToFields = function () { var restClient = new PMRestClient({ @@ -494,9 +497,10 @@ }; processPermissionsSetForm = function (option, data) { - processPermissionsData = data + cboGroupOrUser.hideMessageRequired(); + processPermissionsData = data; PROCESS_PERMISSIONS_OPTION = option; - PROCESS_PERMISSIONS_UID = (typeof(processPermissionsData.op_uid) != "undefined") ? processPermissionsData.op_uid : ""; + PROCESS_PERMISSIONS_UID = (typeof(processPermissionsData.op_uid) !== "undefined") ? processPermissionsData.op_uid : ""; disableAllItems(); winGrdpnlProcessPermissions.showFooter(); @@ -623,6 +627,7 @@ cboGroupOrUser = new SuggestField({ label: "Group or User".translate(), id: "cboGroupOrUser", + name: "cboGroupOrUser", placeholder: "suggest users and groups", width: 500, required: true, @@ -679,6 +684,13 @@ } ] }); + notification = new PMUI.field.TextAnnotationField({ + id: "requiredMessage", + name: "Message", + textType: PMUI.field.TextAnnotationField.TEXT_TYPES.HTML, + text: notificationText, + text_Align: "center" + }); optionsType = [ { value: "ANY", @@ -717,7 +729,7 @@ if (enterprise == "1") { optionsType.push({value: "SUMMARY_FORM", label: "Summary Form".translate()}); } - // sorting the optionsType + // sorting the optionsType optionsType.sort(function(a, b) { return (a.label > b.label) ? 1 : ((b.label > a.label) ? -1 : 0); }); @@ -1047,6 +1059,7 @@ } } else { cboGroupOrUser.showMessageRequired(); + frmProcessPermissions.addItem(notification) } cboGroupOrUser.html.find("input").val(""); diff --git a/vendor/colosa/MichelangeloFE/src/applications/routingRule.js b/vendor/colosa/MichelangeloFE/src/applications/routingRule.js index e7d871091..d28c4d86d 100644 --- a/vendor/colosa/MichelangeloFE/src/applications/routingRule.js +++ b/vendor/colosa/MichelangeloFE/src/applications/routingRule.js @@ -402,10 +402,9 @@ PMDesigner.RoutingRule = function (shape) { * @param connection */ function removeConnection(connection) { - PMUI.getActiveCanvas().emptyCurrentSelection(); PMUI.getActiveCanvas().setCurrentConnection(connection); - PMUI.getActiveCanvas().removeElements(); + PMUI.getActiveCanvas().executeCommandDelete(); connection.saveAndDestroy(); PMUI.getActiveCanvas().removeConnection(connection); } diff --git a/vendor/colosa/MichelangeloFE/src/enviroment/constants.js b/vendor/colosa/MichelangeloFE/src/enviroment/constants.js index 0c693cd64..906f7dc20 100644 --- a/vendor/colosa/MichelangeloFE/src/enviroment/constants.js +++ b/vendor/colosa/MichelangeloFE/src/enviroment/constants.js @@ -1 +1 @@ -var __env = __env || {};__env.USER_GUEST = {"uid":"00000000000000000000000000000002","firstname":"Guest","lastname":"Guest","username":"guest"}; \ No newline at end of file +var __env = __env || {};__env.USER_GUEST = {"uid":"00000000000000000000000000000002","firstname":"Guest","lastname":"Guest","username":"guest"}; __env.pmVariable = {"regEx":"/^[a-zA-Z\\_]{1}\\w+$/"}; \ No newline at end of file diff --git a/vendor/colosa/MichelangeloFE/src/formDesigner/src/Designer.js b/vendor/colosa/MichelangeloFE/src/formDesigner/src/Designer.js index 75990a11a..ed989e563 100644 --- a/vendor/colosa/MichelangeloFE/src/formDesigner/src/Designer.js +++ b/vendor/colosa/MichelangeloFE/src/formDesigner/src/Designer.js @@ -423,6 +423,9 @@ that.form1.setDirty(); that.onSave(); }, + functionFailure: function (xhr, response) { + PMDesigner.msgWinError(response.error.message); + }, messageError: 'There are problems creating the DynaForm, please try again.'.translate(), messageSuccess: 'DynaForm saved successfully'.translate(), flashContainer: '' @@ -431,7 +434,14 @@ return false; }; this.areaButtons.export_[0].onclick = function () { - var jsondata = that.getData(); + var jsondata = that.getData(), + i, + variables, + size= (typeof jsondata['items'] !== 'undefined') ? jsondata['items'].length : 0; // validation for undefined issues + for (i = 0; i < size; i += 1) { + variables = jsondata['items'][i]['variables']; + variables.forEach(function(v){ delete v.create }); + }; var name = (that.form1.properties.name.value ? that.form1.properties.name.value : 'untitle') + '.json'; if (window.navigator.msSaveBlob) { window.navigator.msSaveBlob(new Blob([JSON.stringify(jsondata)], {'type': 'application/octet-stream'}), name); @@ -574,7 +584,8 @@ duplicated, regExp, type, - existRegExp; + existRegExp, + dateLimit; switch (prop) { case "name": if (target.properties[prop].node && target instanceof FormDesigner.main.Form) { @@ -767,39 +778,70 @@ break; case "defaultDate": if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { - if (value === "today") { - target.properties.defaultDate.disabledTodayOption = true; - listProperties.clear(); - listProperties.load(target.properties); - } - if (value === "") { - target.properties.defaultDate.disabledTodayOption = false; - listProperties.clear(); - listProperties.load(target.properties); + if (target.properties[prop].node) { + if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { + if (value === "today") { + target.properties.defaultDate.disabledTodayOption = true; + listProperties.clear(); + listProperties.load(target.properties); + } else if (value === "") { + target.properties.defaultDate.disabledTodayOption = false; + listProperties.clear(); + listProperties.load(target.properties); + } else { + dateLimit = that.thereIsDefaultDateLimit( + target.properties.minDate.value, + target.properties.maxDate.value, + target.properties.defaultDate.value + ); + if (dateLimit) { + dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Default date is out of range.".translate()); + dialogMessage.onClose = function () { + target.properties.set("defaultDate", dateLimit); + target.properties.defaultDate.node.value = dateLimit; + }; + } + } + } } + } break; case "maxDate": - if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { - if (target.properties.maxDate.value < target.properties.defaultDate.value && - target.properties.defaultDate.value !== "" && target.properties.maxDate.value !== "") { - dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Default date is out of range.".translate()); - dialogMessage.onClose = function () { - target.properties.set("defaultDate", target.properties.maxDate.value); - target.properties.defaultDate.node.value = target.properties.maxDate.value; - }; + if (target.properties[prop].node) { + if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { + if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { + dateLimit = that.thereIsMaxDateLimit( + target.properties.minDate.value, + target.properties.maxDate.value, + target.properties.defaultDate.value + ); + if (dateLimit) { + dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Max date must be greater than the min and default date".translate()); + dialogMessage.onClose = function () { + target.properties.set("maxDate", dateLimit); + target.properties.maxDate.node.value = dateLimit; + }; + } + } } } break; case "minDate": - if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { - if (target.properties.minDate.value > target.properties.defaultDate.value && - target.properties.defaultDate.value !== "" && target.properties.minDate.value !== "") { - dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Default date is out of range.".translate()); - dialogMessage.onClose = function () { - target.properties.set("defaultDate", target.properties.minDate.value); - target.properties.defaultDate.node.value = target.properties.minDate.value; - }; + if (target.properties[prop].node) { + if (target.properties.type.value === FormDesigner.main.TypesControl.datetime) { + dateLimit = that.thereIsMinDateLimit( + target.properties.minDate.value, + target.properties.maxDate.value, + target.properties.defaultDate.value + ); + if (dateLimit) { + dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Min date must be lesser than the max and default date.".translate()); + dialogMessage.onClose = function () { + target.properties.set("minDate", dateLimit); + target.properties.minDate.node.value = dateLimit; + }; + } } } break; @@ -808,6 +850,27 @@ target.properties.requiredFieldErrorMessage.node.disabled = !value; } break; + case "size": + case "sizeUnity": + //the "maxFileSizeInformation" variable, comes from backend. + that.validateMaxFileSize( + target, + maxFileSizeInformation, + function (target, message) { + var dialogMessage, + value, + oldValue; + value = target.properties[prop].value; + oldValue = target.properties[prop].oldValue; + if (target.properties[prop].node && value !== oldValue) { + dialogMessage = new FormDesigner.main.DialogMessage(null, "alert", message); + dialogMessage.onClose = function () { + that.setMinimalFileSize(target, maxFileSizeInformation); + }; + } + } + ); + break; } }; this.form1.onSynchronizeVariables = function (variables) { @@ -851,11 +914,6 @@ this.form1.properties.protectedValue.type = "hidden"; this.form1.setData(this.dynaform); this.form1.setDirty(); - //this.form2.onSelect = function (properties) { - // listProperties.clear(); - // listProperties.load(properties); - //}; - //methods that.title.text(this.dynaform.dyn_title).attr("title", this.dynaform.dyn_title).tooltip({ tooltipClass: "fd-tooltip", position: {my: "left top+1"} @@ -917,5 +975,185 @@ } }); }; + /** + * Validate the date + * @param date + * + */ + Designer.prototype.parseDate = function (stringDate) { + var parts; + if (typeof stringDate !== "undefined" && stringDate !== null) { + parts = stringDate.split("-"); + // new Date(year, month [, day [, hours[, minutes[, seconds[, ms]]]]]) + return new Date(parts[0], parts[1] - 1, parts[2]); // Note: months are 0-based + } + return null; + }; + /** + * Verifies if a date is valid + * @param date + * @returns {boolean} + */ + Designer.prototype.isValidDate = function (date) { + return date instanceof Date && !isNaN(date); + }; + /** + * Search if there is a limit lower than minDate property. + * @param minDateString + * @param maxDateString + * @param defaultDateString + * @returns {Object} + */ + Designer.prototype.thereIsMinDateLimit = function (minDateString, maxDateString, defaultDateString) { + var minDate = this.parseDate(minDateString), + maxDate = this.parseDate(maxDateString), + defaultDate = this.parseDate(defaultDateString), + result = null; + if (this.isValidDate(minDate)) { + if (this.isValidDate(defaultDate)) { + if (minDate > defaultDate) { + result = defaultDateString; + } + } + if (!result && this.isValidDate(maxDate)) { + if (minDate > maxDate) { + result = maxDateString; + } + } + } + return result; + }; + /** + * Search if there is a limit highest than maxDate property. + * @param minDateString + * @param maxDateString + * @param defaultDateString + * @returns {Object} + */ + Designer.prototype.thereIsMaxDateLimit = function (minDateString, maxDateString, defaultDateString) { + var minDate = this.parseDate(minDateString), + maxDate = this.parseDate(maxDateString), + defaultDate = this.parseDate(defaultDateString), + result = null; + if (this.isValidDate(maxDate)) { + if (this.isValidDate(defaultDate)) { + if (maxDate < defaultDate) { + result = defaultDateString; + } + } + if (!result && this.isValidDate(minDate)) { + if (maxDate < minDate) { + result = minDateString; + } + } + } + return result; + }; + /** + * Search if defaultDate property is in range of min date and max date. + * @param minDateString + * @param maxDateString + * @param defaultDateString + * @returns {Object} + */ + Designer.prototype.thereIsDefaultDateLimit = function (minDateString, maxDateString, defaultDateString) { + var minDate = this.parseDate(minDateString), + maxDate = this.parseDate(maxDateString), + defaultDate = this.parseDate(defaultDateString), + result = null; + if (this.isValidDate(defaultDate)) { + if (this.isValidDate(minDate)) { + if (defaultDate < minDate) { + result = minDateString; + } + } + if (!result && this.isValidDate(maxDate)) { + if (defaultDate > maxDate) { + result = maxDateString; + } + } + } + return result; + }; + /** + * Validate Max File Size, if the value exceeds the allowed limit, an alert message + * is displayed. + * + * @param object target + * @param object maxFileSizeInformation + * @param function callback + */ + Designer.prototype.validateMaxFileSize = function (target, maxFileSizeInformation, callback) { + var isTypeValid, + message; + + if (target.properties === null) { + return; + } + + isTypeValid = target.properties.type.value === FormDesigner.main.TypesControl.file || + target.properties.type.value === FormDesigner.main.TypesControl.multipleFile; + if (!isTypeValid) { + return; + } + if (this.isValidMaxFileSizeFromProperties(maxFileSizeInformation, target.properties) === false) { + message = "The maximum value of this field is ".translate() + maxFileSizeInformation.uploadMaxFileSize; + callback(target, message); + } + }; + /** + * Returns true if the value of Max files Size, satisfies the configuration of + * the php ini directives, false otherwise. + * + * @param {object} maxFileSizeInformation + * @param {object} properties + * @returns {Boolean} + */ + Designer.prototype.isValidMaxFileSizeFromProperties = function (maxFileSizeInformation, properties) { + var value, + unit, + items, + i; + value = parseInt(properties.size.value, 10); + unit = properties.sizeUnity.value; + items = properties.sizeUnity.items; + + if (Array.isArray(items)) { + for (i = 0; i < items.length; i += 1) { + if (unit === items[i].value) { + value = value * Math.pow(1024, i + 1); + } + } + } + + if (maxFileSizeInformation.uploadMaxFileSizeBytes < value) { + return false; + } + return true; + }; + /** + * Set Minimal File Size. + * + * @param object target + * @param object maxFileSizeInformation + */ + Designer.prototype.setMinimalFileSize = function (target, maxFileSizeInformation) { + var size, + sizeValue, + sizeUnity, + sizeUnityValue; + + sizeValue = maxFileSizeInformation.uploadMaxFileSizeMBytes; + size = target.properties.set("size", sizeValue); + if (size && size.node) { + size.node.value = sizeValue; + } + + sizeUnityValue = maxFileSizeInformation.uploadMaxFileSizeUnit; + sizeUnity = target.properties.set("sizeUnity", sizeUnityValue); + if (sizeUnity.node) { + sizeUnity.node.value = sizeUnityValue; + } + }; FormDesigner.extendNamespace('FormDesigner.main.Designer', Designer); }()); diff --git a/vendor/colosa/MichelangeloFE/src/formDesigner/src/ListProperties.js b/vendor/colosa/MichelangeloFE/src/formDesigner/src/ListProperties.js index cbb0b79d8..09b61a1d0 100644 --- a/vendor/colosa/MichelangeloFE/src/formDesigner/src/ListProperties.js +++ b/vendor/colosa/MichelangeloFE/src/formDesigner/src/ListProperties.js @@ -24,7 +24,8 @@ defaultDate = '', dialogMessage = '', width = "width:100%;border:1px solid gray;box-sizing:border-box;", - id = FormDesigner.generateUniqueId(); + id = FormDesigner.generateUniqueId(), + that = this; switch (propertiesGot[property].type) { case "label": //improvement changes in value @@ -117,7 +118,7 @@ break; case "datepicker": input = $("").val(propertiesGot[property].value); - input.on(propertiesGot[property].on ? propertiesGot[property].on : "keyup", function () { + input.on(propertiesGot[property].on ? propertiesGot[property].on : "change", function () { properties.set(property, this.value); }); input.attr("placeholder", propertiesGot[property].placeholder ? propertiesGot[property].placeholder : ""); @@ -196,56 +197,30 @@ return; switch (property) { case "defaultDate": - minDate = $(cellValue.parent().parent()[0].rows["minDate"]).find("input").val(); - maxDate = $(cellValue.parent().parent()[0].rows["maxDate"]).find("input").val(); + minDate = that.getDateByParam(cellValue, "minDate"); + maxDate = that.getDateByParam(cellValue, "maxDate"); break; case "minDate": - maxDate = $(cellValue.parent().parent()[0].rows["maxDate"]).find("input").val(); + maxDate = that.getDateByParam(cellValue, "maxDate"); break; case "maxDate": - minDate = $(cellValue.parent().parent()[0].rows["minDate"]).find("input").val(); + minDate = that.getDateByParam(cellValue, "minDate"); break; } - var dp = cellValue.find("input[type='text']").datepicker({ - showOtherMonths: true, - selectOtherMonths: true, - dateFormat: "yy-mm-dd", - showOn: "button", - changeMonth: true, - changeYear: true, - yearRange: "-100:+100", + + that.datepicker = that.dateComponentFactory(cellValue, { minDate: minDate, maxDate: maxDate, onSelect: function (dateText, inst) { properties.set(property, dateText, cellValue.find("input[type='text']")[0]); }, onClose: function (dateText, inst) { - dp.datepicker("destroy"); + that.datepicker.datepicker("destroy"); $("#ui-datepicker-div").remove(); } }); - dp.datepicker("show"); cellValue.find(".ui-datepicker-trigger").hide(); }); - if (property === "defaultDate") { - minDate = $(cellValue.parent().parent()[0].rows["minDate"]).find("input").val(); - maxDate = $(cellValue.parent().parent()[0].rows["maxDate"]).find("input").val(); - defaultDate = $(cellValue.parent().parent()[0].rows["defaultDate"]).find("input").val(); - if (minDate > defaultDate && minDate !== "") { - dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Default date is out of range.".translate()); - dialogMessage.onClose = function () { - properties.set(property, minDate); - properties[property].node.value = minDate; - }; - } - if (maxDate < defaultDate && maxDate !== "") { - dialogMessage = new FormDesigner.main.DialogMessage(null, "success", "Default date is out of range.".translate()); - dialogMessage.onClose = function () { - properties.set(property, maxDate); - properties[property].node.value = maxDate; - }; - } - } cellValue.append(button); n = n + 16; cellValue[0].style.paddingRight = n + "px"; @@ -296,5 +271,64 @@ ListProperties.prototype.clear = function () { this.tbody.find("tr").remove(); }; + /** + * Creates the date picker component. + * @param control the form control to set de datepicker. + * @param options dynamic params to set the properties. + * @returns {*} + */ + ListProperties.prototype.dateComponentFactory = function (control, options) { + var defaults = { + showOtherMonths: true, + selectOtherMonths: true, + dateFormat: "yy-mm-dd", + changeMonth: true, + changeYear: true, + yearRange: "-100:+100", + minDate: '', + maxDate: '', + onSelect: function() {}, + onClose: function() {} + }, + datePicker; + $.extend(true, defaults, options); + // append the date picker to the control component + datePicker = control + .find("input[type='text']") + .datepicker({ + showOtherMonths: defaults.showOtherMonths, + selectOtherMonths: defaults.selectOtherMonths, + dateFormat: defaults.dateFormat, + showOn: defaults.showOn, + changeMonth: defaults.changeMonth, + changeYear: defaults.changeYear, + yearRange: defaults.yearRange, + minDate: defaults.minDate, + maxDate: defaults.maxDate, + onSelect: defaults.onSelect, + onClose: defaults.onClose + }); + datePicker.datepicker("show"); + return datePicker; + }; + /** + * Gets the date according to the passed param + */ + ListProperties.prototype.getDateByParam = function(control, param) { + var varRegex = /\@(?:([\@\%\#\?\$\=\&Qq\!])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[['"]?\w+['"]?\])+|\-\>([a-zA-Z\_]\w*))?/, + value = ''; + if (control && param) { + value = $(control.parent().parent()[0].rows[param]) + .find("input") + .val(); + if (!varRegex.test(value)) { + return value; + } else { + return ''; + } + } else { + return ''; + } + }; FormDesigner.extendNamespace('FormDesigner.main.ListProperties', ListProperties); -}()); \ No newline at end of file +}()); diff --git a/vendor/colosa/MichelangeloFE/src/formDesigner/src/Properties.js b/vendor/colosa/MichelangeloFE/src/formDesigner/src/Properties.js index 1be64299d..ef2f09e05 100644 --- a/vendor/colosa/MichelangeloFE/src/formDesigner/src/Properties.js +++ b/vendor/colosa/MichelangeloFE/src/formDesigner/src/Properties.js @@ -16,8 +16,8 @@ value: "", type: "text", on: "change", - regExp: /^[a-zA-Z0-9-_]+$/, - regExpInv: /[^a-zA-Z0-9-_]/gi, + regExp: new RegExp(__env.pmVariable.regEx.substr(1, __env.pmVariable.regEx.length - 2)), + regExpInv: new RegExp(__env.pmVariable.regEx.substr(1, __env.pmVariable.regEx.length - 2), "gi"), required: true }; this.name = {label: "name".translate(), value: "", type: "hidden", labelButton: "...", required: true}; diff --git a/vendor/colosa/MichelangeloFE/src/import/Importer.js b/vendor/colosa/MichelangeloFE/src/import/Importer.js index cebe5ecf2..bad568717 100644 --- a/vendor/colosa/MichelangeloFE/src/import/Importer.js +++ b/vendor/colosa/MichelangeloFE/src/import/Importer.js @@ -847,7 +847,7 @@ importBpmnDiagram.prototype.completeImportFlows = function () { flo_element_dest: dest, flo_element_origin: origin, flo_is_inmediate: "1", - flo_name: null, + flo_name: element.name || null, flo_state: state, flo_type: conectionMap[element.$type], flo_x1: state[0].x, diff --git a/vendor/colosa/MichelangeloFE/src/pm_artifact.js b/vendor/colosa/MichelangeloFE/src/pm_artifact.js index f13213b8c..1981391a6 100644 --- a/vendor/colosa/MichelangeloFE/src/pm_artifact.js +++ b/vendor/colosa/MichelangeloFE/src/pm_artifact.js @@ -176,7 +176,10 @@ PMArtifact.prototype.createWithBpmn = function () { var businessObject = {}; var bpmnElementType = this.getBpmnElementType(); - businessObject.elem = PMDesigner.bpmnFactory.create(bpmnElementType, {id: this.id, text: this.getName()}); + businessObject.elem = PMDesigner.bpmnFactory.create(bpmnElementType, { + id: this.id, + text: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "" + }); if (!businessObject.di) { if (this.type === 'Connection') { diff --git a/vendor/colosa/MichelangeloFE/src/pm_canvas.js b/vendor/colosa/MichelangeloFE/src/pm_canvas.js index 060c814a0..9c9d94583 100644 --- a/vendor/colosa/MichelangeloFE/src/pm_canvas.js +++ b/vendor/colosa/MichelangeloFE/src/pm_canvas.js @@ -1486,14 +1486,31 @@ PMCanvas.prototype.hideFlowRecursively = function (shape) { * @chainable */ PMCanvas.prototype.removeElements = function () { - // destroy the shapes (also destroy all the references to them) - var shape, - command; - if (!this.canCreateShape && !this.isDragging) { - command = new PMCommandDelete(this); - this.commandStack.add(command); - command.execute(); + var that = this, + dialogConfirm; + if (!that.canCreateShape && !that.isDragging) { + // Delete shape with a modal Dialog Confirm. + dialogConfirm = new FormDesigner.main.DialogConfirm(null, "warning", "Are you sure you want to delete this element?".translate()); + dialogConfirm.onAccept = function () { + that.executeCommandDelete(); + }; + dialogConfirm.onClose = function () { + PMUI.isDelete = false; + return that; + }; } + return that; +}; + +/** + * Calls to Delete command and executes the action + * @param {PMCanvas} canvas + */ +PMCanvas.prototype.executeCommandDelete = function () { + // destroy the shapes (also destroy all the references to them) + var command = new PMCommandDelete(this); + this.commandStack.add(command); + command.execute(); return this; }; diff --git a/vendor/colosa/MichelangeloFE/src/pm_command_delete.js b/vendor/colosa/MichelangeloFE/src/pm_command_delete.js index 449c7d2ba..4044396e6 100644 --- a/vendor/colosa/MichelangeloFE/src/pm_command_delete.js +++ b/vendor/colosa/MichelangeloFE/src/pm_command_delete.js @@ -307,4 +307,4 @@ PMCommandDelete.prototype.undo = function () { PMCommandDelete.prototype.redo = function () { this.execute(); return this; -}; \ No newline at end of file +}; diff --git a/vendor/colosa/MichelangeloFE/src/pm_data.js b/vendor/colosa/MichelangeloFE/src/pm_data.js index 37551b556..dae94c1c1 100644 --- a/vendor/colosa/MichelangeloFE/src/pm_data.js +++ b/vendor/colosa/MichelangeloFE/src/pm_data.js @@ -251,21 +251,27 @@ PMData.prototype.updateBpmnDataType = function (newBpmnType, dataType) { PMData.prototype.createWithBpmn = function (bpmnElementType, name) { var businessObject = {}; if (this.extendedType === 'DATASTORE') { - var ds = PMDesigner.bpmnFactory.create('bpmn:DataStore', {id: this.id, name: this.getName()}); + var ds = PMDesigner.bpmnFactory.create('bpmn:DataStore', { + id: this.id, + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "", + }); PMDesigner.businessObject.get('rootElements').push(ds); businessObject.elem = PMDesigner.bpmnFactory.create('bpmn:DataStoreReference', { id: this.id + '_ref', - name: this.getName(), + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "", dataStoreRef: ds }); businessObject.elem.dsRef = ds; } else { if (bpmnElementType == 'bpmn:DataObject' || bpmnElementType === undefined) { - var dObj = PMDesigner.bpmnFactory.create('bpmn:DataObject', {id: this.id, name: this.getName()}); + var dObj = PMDesigner.bpmnFactory.create('bpmn:DataObject', { + id: this.id, + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "", + }); businessObject.elem = PMDesigner.bpmnFactory.create('bpmn:DataObjectReference', { id: this.id + '_ref', - name: this.getName(), + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "", dataObjectRef: dObj }); // validate if container is a lane because data store is always into process tag @@ -317,7 +323,7 @@ PMData.prototype.getDataType = function () { PMData.prototype.createDataIOEspecification = function (element) { var ioEspecification = PMDesigner.bpmnFactory.create('bpmn:InputOutputSpecification', { id: this.id + '_ioEspecification', - name: this.getName() + '_ioEspecification' + name: (this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "") + '_ioEspecification' }); ioEspecification['dataInputs'] = []; this.parent.businessObject.elem['ioSpecification'] = ioEspecification; @@ -334,7 +340,10 @@ PMData.prototype.createDataBusinessObject = function () { }; PMData.prototype.createDataIOBusinessObject = function (bpmnElementType) { - var dObj = PMDesigner.bpmnFactory.create(bpmnElementType, {id: this.id, name: this.getName()}); + var dObj = PMDesigner.bpmnFactory.create(bpmnElementType, { + id: this.id, + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "" + }); this.parent.businessObject.elem['ioSpecification'].dataInputs.push(dObj); return {elem: dObj}; }; \ No newline at end of file diff --git a/vendor/colosa/MichelangeloFE/src/pm_flow.js b/vendor/colosa/MichelangeloFE/src/pm_flow.js index fbdc62393..4c59888a9 100644 --- a/vendor/colosa/MichelangeloFE/src/pm_flow.js +++ b/vendor/colosa/MichelangeloFE/src/pm_flow.js @@ -744,7 +744,7 @@ PMFlow.prototype.getBpmnElementType = function () { PMFlow.prototype.createWithBpmn = function (bpmnElementType) { var businessObject = PMDesigner.bpmnFactory.create(bpmnElementType, { id: 'flo_' + this.id, - name: this.getName() ? this.getName() : "" + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "" }); businessObject.di = PMDesigner.bpmnFactory.createDiEdge(businessObject, [], { id: businessObject.id + '_di' diff --git a/vendor/colosa/MichelangeloFE/src/pm_gateway.js b/vendor/colosa/MichelangeloFE/src/pm_gateway.js index 5a93ef64a..a50454aa2 100644 --- a/vendor/colosa/MichelangeloFE/src/pm_gateway.js +++ b/vendor/colosa/MichelangeloFE/src/pm_gateway.js @@ -201,15 +201,17 @@ PMGateway.prototype.setGatewayType = function (type) { * @return {*} */ PMGateway.prototype.setDirection = function (direction) { - direction = direction.toLowerCase(); - var defaultDir = { - unspecified: 'UNSPECIFIED', - diverging: 'DIVERGING', - converging: 'CONVERGING', - mixed: 'MIXED' - }; - if (defaultDir[direction]) { - this.gat_direction = defaultDir[direction]; + if (typeof direction !== 'undefined') { + direction = direction.toLowerCase(); + var defaultDir = { + unspecified: 'UNSPECIFIED', + diverging: 'DIVERGING', + converging: 'CONVERGING', + mixed: 'MIXED' + }; + if (defaultDir[direction]) { + this.gat_direction = defaultDir[direction]; + } } return this; }; @@ -363,8 +365,16 @@ PMGateway.prototype.manualCreateMenu = function (e) { }; PMGateway.prototype.beforeContextMenu = function () { - var i, port, connection, shape, defaultflowItems = [], items, item, name, - target, menuItem, hasMarker; + var i, + port, + connection, + shape, + defaultflowItems = [], + items, + name, + target, + menuItem, + hasMarker; this.canvas.hideAllCoronas(); if (this.canvas.readOnly) { return; @@ -381,7 +391,6 @@ PMGateway.prototype.beforeContextMenu = function () { } } - defaultflowItems.push({ text: 'None'.translate(), id: 'emptyFlow', @@ -417,8 +426,7 @@ PMGateway.prototype.beforeContextMenu = function () { { text: name, id: connection.getID(), - disabled: (connection.getID() === this.gat_default_flow) - ? true : false, + disabled: (connection.getID() === this.gat_default_flow), onClick: function (menuOption) { target = menuOption.getMenuTargetElement(); //target.setDefaultFlow(menuOption.id); @@ -432,7 +440,7 @@ PMGateway.prototype.beforeContextMenu = function () { if (this.defaltFlowMenuItem) { this.menu.removeItem('defaultflowMenu'); } - if ((defaultflowItems.length > 0) && (this.gat_type != "PARALLEL")) { + if ((defaultflowItems.length > 0) && (this.gat_type !== "PARALLEL")) { this.defaltFlowMenuItem = { id: 'defaultflowMenu', text: "Default Flow".translate(), @@ -468,19 +476,20 @@ PMGateway.prototype.isSupported = function () { return isSupported; }; /** - * evaluates the gateway address, according to the amount of input and output connections + * Evaluates the gateway address, according to the amount of input and output connections, by default use Diverging. + * Converging multiples inputs and only an output. + * Diverging an input and an output. + * Diverging multiples inputs output and multiples outputs. * @returns {PMGateway} */ -PMGateway.prototype.evaluateGatewayDirection = function(){ +PMGateway.prototype.evaluateGatewayDirection = function () { var incomings = this.getIncomingConnections('SEQUENCE', 'DEFAULT') || [], outgoings = this.getOutgoingConnections('SEQUENCE', 'DEFAULT') || [], + direction; + if (incomings.length > 1 && outgoings.length === 1) { + direction = "CONVERGING"; + } else { direction = "DIVERGING"; - if (outgoings.length < incomings.length) { - if (incomings.length === 1 && outgoings.length === 0){ - direction = "DIVERGING"; - }else{ - direction = "CONVERGING"; - } } this.setDirection(direction); return this; @@ -527,4 +536,4 @@ PMGateway.prototype.addOutgoingConnection = function() { PMGateway.prototype.removeOutgoingConnection = function() { PMShape.prototype.removeOutgoingConnection.apply(this, arguments); return this.evaluateGatewayDirection(); -}; \ No newline at end of file +}; diff --git a/vendor/colosa/MichelangeloFE/src/pm_shape.js b/vendor/colosa/MichelangeloFE/src/pm_shape.js index 4c186c08a..b98b8daea 100644 --- a/vendor/colosa/MichelangeloFE/src/pm_shape.js +++ b/vendor/colosa/MichelangeloFE/src/pm_shape.js @@ -698,7 +698,10 @@ PMShape.prototype.getBpmnElementType = function () { PMShape.prototype.createWithBpmn = function (bpmnElementType, name) { var businessObject = {}; - businessObject.elem = PMDesigner.bpmnFactory.create(bpmnElementType, {id: 'el_' + this.id, name: this.getName()}); + businessObject.elem = PMDesigner.bpmnFactory.create(bpmnElementType, { + id: 'el_' + this.id, + name: this.getName() ? PMDesigner.escapeXMLCharacters(this.getName()) : "" + }); if (!businessObject.di) { if (this.type === 'PMParticipant' || this.type === 'PMPool' || this.type === 'PMLane') { businessObject.di = PMDesigner.bpmnFactory.createDiShape(businessObject.elem, {}, { diff --git a/vendor/colosa/MichelangeloFE/themes/mafe/build/pmui-mafe.css b/vendor/colosa/MichelangeloFE/themes/mafe/build/pmui-mafe.css index 878dfa933..370950bfd 100644 --- a/vendor/colosa/MichelangeloFE/themes/mafe/build/pmui-mafe.css +++ b/vendor/colosa/MichelangeloFE/themes/mafe/build/pmui-mafe.css @@ -93,11 +93,11 @@ @include font-face("SourceSansProBold", font-files("SourceSansPro-Bold/SourceSansPro-Bold-webfont.ttf", "SourceSansPro-Bold/SourceSansPro-Bold-webfont.eot", "SourceSansPro-Bold/SourceSansPro-Bold-webfont.woff", "SourceSansPro-Bold/SourceSansPro-Bold-webfont.svg"),"SourceSansPro-Bold/SourceSansPro-Bold-webfont.eot");*/ @font-face { font-family: "Chivo"; - src: url('../fonts/Chivo/Chivo-Black.ttf?1539896382') format('truetype'), url('../fonts/Chivo/Chivo-BlackItalic.ttf?1539896382') format('truetype'), url('../fonts/Chivo/Chivo-Italic.ttf?1539896382') format('truetype'), url('../fonts/Chivo/Chivo-Regular.ttf?1539896382') format('truetype'); + src: url('../fonts/Chivo/Chivo-Black.ttf?1557425009') format('truetype'), url('../fonts/Chivo/Chivo-BlackItalic.ttf?1557425009') format('truetype'), url('../fonts/Chivo/Chivo-Italic.ttf?1557425009') format('truetype'), url('../fonts/Chivo/Chivo-Regular.ttf?1557425009') format('truetype'); } @font-face { font-family: "Montserrat"; - src: url('../fonts/Montserrat/Montserrat-Bold.ttf?1539896382') format('truetype'), url('../fonts/Montserrat/Montserrat-Regular.ttf?1539896382') format('truetype'); + src: url('../fonts/Montserrat/Montserrat-Bold.ttf?1557425009') format('truetype'), url('../fonts/Montserrat/Montserrat-Regular.ttf?1557425009') format('truetype'); } .pmui-sprite-sprite, .pmui-sprite-arrow-down, .pmui-sprite-arrow-next, .pmui-sprite-arrow-previous, .pmui-sprite-arrow-right, .pmui-sprite-arrow-up, .pmui-sprite-delete-16, .pmui-sprite-error-64, .pmui-sprite-error, .pmui-sprite-grid-arrow-down, .pmui-sprite-grid-arrow-up, .pmui-sprite-help, .pmui-sprite-info-64, .pmui-sprite-information, .pmui-sprite-question-64, .pmui-sprite-success-64, .pmui-sprite-warning-64, .pmui-sprite-warning, .pmui-sprite-window-close, .pmui-accordion-item-closed, .pmui-accordion-item-expanded, .pmui-gridpanel-pagelink.pmui-gridpanel-nextbutton .pmui-icon, .pmui-gridpanel-pagelink.pmui-gridpanel-previousbutton .pmui-icon, .pmui-gridpanelcolumn.pmui-sortable.pmui-sort-asc .pmui-grid-sort-icon, .pmui-gridpanelcolumn.pmui-sortable.pmui-sort-desc .pmui-grid-sort-icon, .pmui-icon-help, .pmui-icon-info, .pmui-icon-error, .pmui-icon-warning, .pmui-messagewindow-icon-error, .pmui-messagewindow-icon-warning, .pmui-messagewindow-icon-info, .pmui-messagewindow-icon-success, .pmui-messagewindow-icon-confirm { background-image: url('../img/pmui-sprite-s947c1ade08.png'); @@ -1234,8 +1234,8 @@ a.mafe-button-create:hover{ .pmui-accordion-panel-body { border-top: 1px solid #c3d8e9; - border-bottom: 1px solid #c3d8e9; - height: auto; + border-bottom: 0px; + height: 357px; width: auto; } @@ -2351,6 +2351,7 @@ select.pmui-dropdownlistcontrol { .pmui-treepanel { display: inline-block; + height: 360px; } .pmui-treepanel-list { diff --git a/vendor/colosa/pmUI/build/js/pmui-0.1.1.js b/vendor/colosa/pmUI/build/js/pmui-0.1.1.js index 601c19d99..a70e1e102 100644 --- a/vendor/colosa/pmUI/build/js/pmui-0.1.1.js +++ b/vendor/colosa/pmUI/build/js/pmui-0.1.1.js @@ -3,33 +3,91 @@ * Base class PMUI * @singleton */ -var PMUI = {}; +var PMUI = {}, + getUsersOS; +/** + * Detect the users' OS + * @return {string} + */ +getUsersOS = function () { + var userAgent = window.navigator.userAgent, + platform = window.navigator.platform, + macOsPlatforms = ['Macintosh', 'MacIntel', 'MacPPC', 'Mac68K'], + windowsPlatforms = ['Win32', 'Win64', 'Windows', 'WinCE'], + iosPlatforms = ['iPhone', 'iPad', 'iPod'], + os = null; + + if (macOsPlatforms.indexOf(platform) !== -1) { + os = 'MacOS'; + } else if (iosPlatforms.indexOf(platform) !== -1) { + os = 'iOS'; + } else if (windowsPlatforms.indexOf(platform) !== -1) { + os = 'Windows'; + } else if (/Android/.test(userAgent)) { + os = 'Android'; + } else if (!os && /Linux/.test(platform)) { + os = 'Linux'; + } + return os; +}; PMUI.version = '0.1.1'; PMUI.isCtrl = false; +PMUI.isAlt = false; PMUI.isShift = false; +PMUI.metaKey = false; PMUI.activeCanvas = null; PMUI.currentContextMenu = null; PMUI.keyCodeF5 = 116; +PMUI.keyDown = false; +PMUI.isDelete = false; +PMUI.OS = getUsersOS(); $(document).keydown(function (e) { - var elementSelected; + var elementSelected, + flowSelected; if (PMUI.activeCanvas) { elementSelected = PMUI.activeCanvas.getCurrentSelection(); + flowSelected = PMUI.activeCanvas.getCurrentConnection(); switch (e.which) { + case 8: //BACKSPACE + if (PMUI.metaKey && PMUI.OS === "MacOS" && !PMUI.activeCanvas.readOnly && + (elementSelected.asArray().length !== 0 || flowSelected !== null) && !PMUI.isDelete) { + if (PMUI.activeCanvas && !PMUI.activeCanvas.currentLabel) { + PMUI.isDelete = true; + PMUI.activeCanvas.removeElements(); + } + } + break; case 16: // SHIFT KEY PMUI.isShift = true; break; case 17: // CTRL KEY - PMUI.isCtrl = true; + if (!PMUI.isAlt) { + PMUI.isCtrl = true; + } else if (PMUI.OS !== "MacOS") { + PMUI.isAlt = false; + PMUI.isCtrl = false; + } + break; + case 18: //ALT KEY + if (!PMUI.isCtrl) { + PMUI.isAlt = true; + } else if (PMUI.OS !== "MacOS") { + PMUI.isCtrl = false; + PMUI.isAlt = false; + } break; case 116: // F5 KEY e.preventDefault(); window.location.reload(true); break; + case 91: //meta key - window key - command key + PMUI.metaKey = true; + break; case 37: // Left - if (!PMUI.activeCanvas.currentLabel) { + if (!PMUI.activeCanvas.currentLabel && !PMUI.isDelete) { e.preventDefault(); if (!PMUI.getCoordinatesElement(elementSelected.asArray(), "LEFT")) { PMUI.activeCanvas.moveElements(PMUI.activeCanvas, 'LEFT'); @@ -38,7 +96,7 @@ $(document).keydown(function (e) { break; case 38: // Top - if (!PMUI.activeCanvas.currentLabel) { + if (!PMUI.activeCanvas.currentLabel && !PMUI.isDelete) { e.preventDefault(); if (!PMUI.getCoordinatesElement(elementSelected.asArray(), "TOP")) { PMUI.activeCanvas.moveElements(PMUI.activeCanvas, 'TOP'); @@ -47,7 +105,7 @@ $(document).keydown(function (e) { break; case 39: // Right - if (!PMUI.activeCanvas.currentLabel) { + if (!PMUI.activeCanvas.currentLabel && !PMUI.isDelete) { e.preventDefault(); if (!PMUI.getCoordinatesElement(elementSelected.asArray(), "RIGHT")) { PMUI.activeCanvas.moveElements(PMUI.activeCanvas, 'RIGHT'); @@ -56,7 +114,7 @@ $(document).keydown(function (e) { break; case 40: // Bottom - if (!PMUI.activeCanvas.currentLabel) { + if (!PMUI.activeCanvas.currentLabel && !PMUI.isDelete) { e.preventDefault(); if (!PMUI.getCoordinatesElement(elementSelected.asArray(), "BOTTOM")) { PMUI.activeCanvas.moveElements(PMUI.activeCanvas, 'BOTTOM'); @@ -69,7 +127,6 @@ $(document).keydown(function (e) { e.preventDefault(); PMUI.activeCanvas.copy(); } - } break; case 86: // char 'v' @@ -81,7 +138,8 @@ $(document).keydown(function (e) { } break; case 90: // char 'z' - if (PMUI.isCtrl && !PMUI.activeCanvas.readOnly) { + if ((PMUI.isCtrl && PMUI.OS !== "MacOS") || (PMUI.metaKey && PMUI.OS === "MacOS") + && !PMUI.activeCanvas.readOnly) { if (PMUI.isShift) { // ctrl + shift + z (redo) PMUI.activeCanvas.redo(); @@ -93,6 +151,17 @@ $(document).keydown(function (e) { } } break; + case 46: //Delete Key - Don't go to default. + if (!PMUI.isCtrl && !PMUI.isAlt && !PMUI.metaKey && PMUI.activeCanvas && !PMUI.keyDown && + !PMUI.activeCanvas.currentLabel && !PMUI.activeCanvas.readOnly && !PMUI.isDelete && + (elementSelected.asArray().length !== 0 || flowSelected !== null)) { + PMUI.isDelete = true; + PMUI.activeCanvas.removeElements(); + } + break; + default: + PMUI.keyDown = true; + break; } } }).keypress(function (e) { @@ -103,7 +172,7 @@ $(document).keydown(function (e) { e.preventDefault(); switch (e.which) { case 8: //BACKSPACE - if (PMUI.isCtrl) { + if (PMUI.metaKey && PMUI.OS === "MacOS" && !PMUI.activeCanvas.readOnly) { if (PMUI.activeCanvas && !PMUI.activeCanvas.currentLabel) { PMUI.activeCanvas.removeElements(); } @@ -113,11 +182,10 @@ $(document).keydown(function (e) { if (PMUI.activeCanvas && PMUI.activeCanvas.currentLabel) { PMUI.activeCanvas.currentLabel.loseFocus(); } + PMUI.keyDown = false; break; - case 46: // DELETE KEY - if (PMUI.activeCanvas && !PMUI.activeCanvas.currentLabel) { - PMUI.activeCanvas.removeElements(); - } + case 91: // META KEY + PMUI.metaKey = false; break; case 16: // SHIFT KEY PMUI.isShift = false; @@ -125,6 +193,12 @@ $(document).keydown(function (e) { case 17: //CTRL KEY PMUI.isCtrl = false; break; + case 18: //ALT KEY + PMUI.isAlt = false; + break; + case 46: + //PMUI.isDelete = false; + break; case 113: //F2 KEY if (PMUI.activeCanvas && PMUI.activeCanvas.getCurrentSelection().getLast() !== null) { @@ -137,6 +211,9 @@ $(document).keydown(function (e) { } } break; + default: + PMUI.keyDown = false; + break; } } @@ -12424,7 +12501,7 @@ if (typeof exports !== "undefined") { onChange: null, required: false, validAtChange: true, - requiredMessage: 'This field is required.', + requiredMessage: 'This field is required.'.translate(), labelVisible: true, labelPosition: 'left', form: null, @@ -12451,7 +12528,7 @@ if (typeof exports !== "undefined") { this.data = new PMUI.data.DataField(); this.message = new PMUI.ui.TextLabel({ - text: 'This field is required.', + text: 'This field is required.'.translate(), displayMode: 'block', mode: 'normal', visible: false @@ -13471,6 +13548,7 @@ if (typeof exports !== "undefined") { module.exports = Field; } }()); + (function () { /** * @class PMUI.field.TextField @@ -15586,11 +15664,11 @@ if (typeof exports !== "undefined") { * @example * var dateTimePicker; * $(function() { - * dateTimePicker = new PMUI.field.DateTimeField( - * { + * dateTimePicker = new PMUI.field.DateTimeField( + * { * label:'Calendar', * helper: 'This is calendar Gregorian', - * value: new Date(), + * value: new Date(), * datetime : true, * dateFormat: 'M dd yy', * minDate: -90, @@ -15659,8 +15737,8 @@ if (typeof exports !== "undefined") { * @cfg {String} [dateFormat="yy-mm-dd H:i:s"|"yy-mm-dd"],necessary to set the date format property of the control * [PMUI.control.DateTimeControl] * You can see more about the configuration in {@link PMUI.control.DateTimeControl#cfg-dateFormat dateFormat} - * @cfg {Object} [months={"january": "January", "february": "February", "march": "March", "april": "April", - * "may": "May", "june": "June", "july": "July", "august": "August", "september": "September", + * @cfg {Object} [months={"january": "January", "february": "February", "march": "March", "april": "April", + * "may": "May", "june": "June", "july": "July", "august": "August", "september": "September", * "october": "October", "november": "November", "december": "December"}], A JSON object to set the names and * shortnames for every month in year. * You can see more about the configuration in {@link PMUI.control.DateTimeControl#cfg-months months} @@ -15703,27 +15781,27 @@ if (typeof exports !== "undefined") { datetime: false, dateFormat: settings && settings.datetime ? 'yy-mm-dd H:i:s' : 'yy-mm-dd', months: { - "january": "January", - "february": "February", - "march": "March", - "april": "April", - "may": "May", - "june": "June", - "july": "July", - "august": "August", - "september": "September", - "october": "October", - "november": "November", - "december": "December" + "january": "January".translate(), + "february": "February".translate(), + "march": "March".translate(), + "april": "April".translate(), + "may": "May".translate(), + "june": "June".translate(), + "july": "July".translate(), + "august": "August".translate(), + "september": "September".translate(), + "october": "October".translate(), + "november": "November".translate(), + "december": "December".translate() }, days: { - "sunday": "Sunday", - "monday": "Monday", - "tuesday": "Tuesday", - "wednesday": "Wednesday", - "thursday": "Thursday", - "friday": "Friday", - "saturday": "Saturday" + "sunday": "Sunday".translate(), + "monday": "Monday".translate(), + "tuesday": "Tuesday".translate(), + "wednesday": "Wednesday".translate(), + "thursday": "Thursday".translate(), + "friday": "Friday".translate(), + "saturday": "Saturday".translate() }, minDate: -365, maxDate: 365, @@ -15931,6 +16009,7 @@ if (typeof exports !== "undefined") { module.exports = DateTimeField; } }()); + (function () { var TextAnnotationField = function (settings) { TextAnnotationField.superclass.call(this, settings); @@ -22471,8 +22550,10 @@ if (typeof exports !== "undefined") { tr.className = 'pmui-gridpanel-emptyrow pmui-nodrag'; td.colSpan = this.columns.getSize(); tr.appendChild(td); - $(this.dom.tbody).find('.pmui-gridpanel-emptyrow').remove().end().append(tr); + $(this.dom.tbody).find('.pmui-gridpanel-emptyrow').remove(); if (!sizeItems) { + // the empty row will be added only if there is not items in the container + $(this.dom.tbody).append(tr); if (typeof this.emptyMessage === 'function') { message = this.emptyMessage(this, !!this.filterCriteria); } else if (typeof this.emptyMessage === 'string') { @@ -51475,3 +51556,4 @@ if (typeof exports !== "undefined") { }()); PMUI.init(); + diff --git a/vendor/composer/ClassLoader.php b/vendor/composer/ClassLoader.php index 95f7e0978..fce8549f0 100644 --- a/vendor/composer/ClassLoader.php +++ b/vendor/composer/ClassLoader.php @@ -279,7 +279,7 @@ public function isClassMapAuthoritative() */ public function setApcuPrefix($apcuPrefix) { - $this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null; + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; } /** diff --git a/vendor/composer/autoload_alias_loader_real.php b/vendor/composer/autoload_alias_loader_real.php index 14f737844..4317ed11c 100644 --- a/vendor/composer/autoload_alias_loader_real.php +++ b/vendor/composer/autoload_alias_loader_real.php @@ -2,7 +2,7 @@ // autoload_alias_loader_real.php @generated by typo3/class-alias-loader -class ClassAliasLoaderInit3b31a4ba6de6371fab2d7a48d066dc80 { +class ClassAliasLoaderInit66bc30249e5d6d2d0fc249853688d926 { private static $loader; diff --git a/vendor/composer/autoload_files.php b/vendor/composer/autoload_files.php index feb7cebc9..d31987515 100644 --- a/vendor/composer/autoload_files.php +++ b/vendor/composer/autoload_files.php @@ -6,6 +6,7 @@ $baseDir = dirname($vendorDir); return array( + '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', '5255c38a0faeba867671b61dfda6d864' => $vendorDir . '/paragonie/random_compat/lib/random.php', '023d27dca8066ef29e6739335ea73bad' => $vendorDir . '/symfony/polyfill-php70/bootstrap.php', @@ -20,4 +21,5 @@ '6a81470282d9479c809e94c27bb9b307' => $baseDir . '/thirdparty/HTMLPurifier/HTMLPurifier.auto.php', '4d91dd78b19c48ca08f9722f053de1a3' => $baseDir . '/workflow/engine/classes/class.pmFunctions.php', 'a7e627efa6c9d1116d0855cb05b9ae90' => $baseDir . '/workflow/engine/src/ProcessMaker/Util/helpers.php', + '11b9e75510633a4e766ad43713ca8c86' => $baseDir . '/framework/src/Maveriks/Extension/Restler/UploadFormat.php', ); diff --git a/vendor/composer/autoload_psr4.php b/vendor/composer/autoload_psr4.php index a67c90a2a..bfaf0249e 100644 --- a/vendor/composer/autoload_psr4.php +++ b/vendor/composer/autoload_psr4.php @@ -11,6 +11,7 @@ 'TYPO3\\ClassAliasLoader\\' => array($vendorDir . '/typo3/class-alias-loader/src'), 'Symfony\\Polyfill\\Php70\\' => array($vendorDir . '/symfony/polyfill-php70'), 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'), + 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'), 'Symfony\\Component\\VarDumper\\' => array($vendorDir . '/symfony/var-dumper'), 'Symfony\\Component\\Translation\\' => array($vendorDir . '/symfony/translation'), 'Symfony\\Component\\Routing\\' => array($vendorDir . '/symfony/routing'), @@ -35,5 +36,6 @@ 'Dotenv\\' => array($vendorDir . '/vlucas/phpdotenv/src'), 'Cron\\' => array($vendorDir . '/mtdowling/cron-expression/src/Cron'), 'Chumper\\Zipper\\' => array($vendorDir . '/chumper/zipper/src/Chumper/Zipper'), + 'App\\' => array($baseDir . '/app'), '' => array($vendorDir . '/nesbot/carbon/src'), ); diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 89e629261..b151c4060 100644 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit3b31a4ba6de6371fab2d7a48d066dc80 +class ComposerAutoloaderInit66bc30249e5d6d2d0fc249853688d926 { private static $loader; @@ -19,9 +19,9 @@ public static function getLoader() return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit3b31a4ba6de6371fab2d7a48d066dc80', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit66bc30249e5d6d2d0fc249853688d926', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit3b31a4ba6de6371fab2d7a48d066dc80', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit66bc30249e5d6d2d0fc249853688d926', 'loadClassLoader')); $includePaths = require __DIR__ . '/include_paths.php'; $includePaths[] = get_include_path(); @@ -31,7 +31,7 @@ public static function getLoader() if ($useStaticLoader) { require_once __DIR__ . '/autoload_static.php'; - call_user_func(\Composer\Autoload\ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80::getInitializer($loader)); + call_user_func(\Composer\Autoload\ComposerStaticInit66bc30249e5d6d2d0fc249853688d926::getInitializer($loader)); } else { $map = require __DIR__ . '/autoload_namespaces.php'; foreach ($map as $namespace => $path) { @@ -52,19 +52,19 @@ public static function getLoader() $loader->register(true); if ($useStaticLoader) { - $includeFiles = Composer\Autoload\ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80::$files; + $includeFiles = Composer\Autoload\ComposerStaticInit66bc30249e5d6d2d0fc249853688d926::$files; } else { $includeFiles = require __DIR__ . '/autoload_files.php'; } foreach ($includeFiles as $fileIdentifier => $file) { - composerRequire3b31a4ba6de6371fab2d7a48d066dc80($fileIdentifier, $file); + composerRequire66bc30249e5d6d2d0fc249853688d926($fileIdentifier, $file); } return $loader; } } -function composerRequire3b31a4ba6de6371fab2d7a48d066dc80($fileIdentifier, $file) +function composerRequire66bc30249e5d6d2d0fc249853688d926($fileIdentifier, $file) { if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { require $file; diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index d52769252..a31970784 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -4,9 +4,10 @@ namespace Composer\Autoload; -class ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80 +class ComposerStaticInit66bc30249e5d6d2d0fc249853688d926 { public static $files = array ( + '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php', '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php', '5255c38a0faeba867671b61dfda6d864' => __DIR__ . '/..' . '/paragonie/random_compat/lib/random.php', '023d27dca8066ef29e6739335ea73bad' => __DIR__ . '/..' . '/symfony/polyfill-php70/bootstrap.php', @@ -21,6 +22,7 @@ class ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80 '6a81470282d9479c809e94c27bb9b307' => __DIR__ . '/../..' . '/thirdparty/HTMLPurifier/HTMLPurifier.auto.php', '4d91dd78b19c48ca08f9722f053de1a3' => __DIR__ . '/../..' . '/workflow/engine/classes/class.pmFunctions.php', 'a7e627efa6c9d1116d0855cb05b9ae90' => __DIR__ . '/../..' . '/workflow/engine/src/ProcessMaker/Util/helpers.php', + '11b9e75510633a4e766ad43713ca8c86' => __DIR__ . '/../..' . '/framework/src/Maveriks/Extension/Restler/UploadFormat.php', ); public static $prefixLengthsPsr4 = array ( @@ -34,6 +36,7 @@ class ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80 array ( 'Symfony\\Polyfill\\Php70\\' => 23, 'Symfony\\Polyfill\\Mbstring\\' => 26, + 'Symfony\\Polyfill\\Ctype\\' => 23, 'Symfony\\Component\\VarDumper\\' => 28, 'Symfony\\Component\\Translation\\' => 30, 'Symfony\\Component\\Routing\\' => 26, @@ -80,6 +83,10 @@ class ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80 'Cron\\' => 5, 'Chumper\\Zipper\\' => 15, ), + 'A' => + array ( + 'App\\' => 4, + ), ); public static $prefixDirsPsr4 = array ( @@ -103,6 +110,10 @@ class ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80 array ( 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring', ), + 'Symfony\\Polyfill\\Ctype\\' => + array ( + 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype', + ), 'Symfony\\Component\\VarDumper\\' => array ( 0 => __DIR__ . '/..' . '/symfony/var-dumper', @@ -199,6 +210,10 @@ class ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80 array ( 0 => __DIR__ . '/..' . '/chumper/zipper/src/Chumper/Zipper', ), + 'App\\' => + array ( + 0 => __DIR__ . '/../..' . '/app', + ), ); public static $fallbackDirsPsr4 = array ( @@ -5803,12 +5818,12 @@ class ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80 public static function getInitializer(ClassLoader $loader) { return \Closure::bind(function () use ($loader) { - $loader->prefixLengthsPsr4 = ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80::$prefixLengthsPsr4; - $loader->prefixDirsPsr4 = ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80::$prefixDirsPsr4; - $loader->fallbackDirsPsr4 = ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80::$fallbackDirsPsr4; - $loader->prefixesPsr0 = ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80::$prefixesPsr0; - $loader->fallbackDirsPsr0 = ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80::$fallbackDirsPsr0; - $loader->classMap = ComposerStaticInit3b31a4ba6de6371fab2d7a48d066dc80::$classMap; + $loader->prefixLengthsPsr4 = ComposerStaticInit66bc30249e5d6d2d0fc249853688d926::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInit66bc30249e5d6d2d0fc249853688d926::$prefixDirsPsr4; + $loader->fallbackDirsPsr4 = ComposerStaticInit66bc30249e5d6d2d0fc249853688d926::$fallbackDirsPsr4; + $loader->prefixesPsr0 = ComposerStaticInit66bc30249e5d6d2d0fc249853688d926::$prefixesPsr0; + $loader->fallbackDirsPsr0 = ComposerStaticInit66bc30249e5d6d2d0fc249853688d926::$fallbackDirsPsr0; + $loader->classMap = ComposerStaticInit66bc30249e5d6d2d0fc249853688d926::$classMap; }, null, ClassLoader::class); } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 5a8677c04..1e2da60ea 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -25,7 +25,7 @@ "OAuth2": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -108,17 +108,17 @@ }, { "name": "colosa/MichelangeloFE", - "version": "dev-release/3.2.4", - "version_normalized": "dev-release/3.2.4", + "version": "dev-release/3.3.1", + "version_normalized": "dev-release/3.3.1", "source": { "type": "git", "url": "git@bitbucket.org:colosa/michelangelofe.git", - "reference": "1780c624132004aa13d80882937f61527adafad5" + "reference": "4ac7ac3ebd1863c258c3f0e048fd3fff668f0184" }, "require": { - "colosa/pmui": "release/3.2.4-dev" + "colosa/pmui": "release/3.3.1-dev" }, - "time": "2018-05-04T18:33:23+00:00", + "time": "2018-11-29T15:23:08+00:00", "type": "library", "installation-source": "source", "description": "ProcessMaker Michelangelo Front End", @@ -129,14 +129,14 @@ }, { "name": "colosa/pmDynaform", - "version": "dev-release/3.2.4", - "version_normalized": "dev-release/3.2.4", + "version": "dev-release/3.3.1", + "version_normalized": "dev-release/3.3.1", "source": { "type": "git", "url": "git@bitbucket.org:colosa/pmdynaform.git", - "reference": "d22d2d185cac311fb803e0b6891160804091bac1" + "reference": "e4176c9772842904552997702e549035b6ba641d" }, - "time": "2018-04-23T18:36:59+00:00", + "time": "2018-11-28T17:54:53+00:00", "type": "library", "installation-source": "source", "description": "JS Library to render ProcessMaker Dynaforms", @@ -147,14 +147,14 @@ }, { "name": "colosa/pmUI", - "version": "dev-release/3.2.4", - "version_normalized": "dev-release/3.2.4", + "version": "dev-release/3.3.1", + "version_normalized": "dev-release/3.3.1", "source": { "type": "git", "url": "git@bitbucket.org:colosa/pmui.git", - "reference": "583402fdb1a5da606d02cc25f4a5573c3ff800b2" + "reference": "711b9796c7b5ad4363b9177d0969ec4abecc8d2e" }, - "time": "2018-04-19T20:17:00+00:00", + "time": "2018-11-16T14:26:15+00:00", "type": "library", "installation-source": "source", "description": "JS UI Library", @@ -338,18 +338,18 @@ "source": { "type": "git", "url": "https://github.com/GeSHi/geshi-1.0.git", - "reference": "ed9f49a7c7a195f6ed2bc864f5ce03b990b5867d" + "reference": "5861c58981244ab6ee0dd337f096ff14bf15b1eb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/GeSHi/geshi-1.0/zipball/ed9f49a7c7a195f6ed2bc864f5ce03b990b5867d", - "reference": "ed9f49a7c7a195f6ed2bc864f5ce03b990b5867d", + "url": "https://api.github.com/repos/GeSHi/geshi-1.0/zipball/5861c58981244ab6ee0dd337f096ff14bf15b1eb", + "reference": "5861c58981244ab6ee0dd337f096ff14bf15b1eb", "shasum": "" }, "require-dev": { "phpunit/phpunit": "^5.7" }, - "time": "2018-03-09T20:04:39+00:00", + "time": "2018-10-01T23:49:06+00:00", "type": "library", "installation-source": "source", "autoload": { @@ -379,12 +379,12 @@ "version_normalized": "1.1.6.0", "source": { "type": "git", - "url": "https://github.com/google/google-api-php-client.git", + "url": "https://github.com/googleapis/google-api-php-client.git", "reference": "a25dc9d5c109ebb02945ba1ff6336cc937c27628" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/google/google-api-php-client/zipball/a25dc9d5c109ebb02945ba1ff6336cc937c27628", + "url": "https://api.github.com/repos/googleapis/google-api-php-client/zipball/a25dc9d5c109ebb02945ba1ff6336cc937c27628", "reference": "a25dc9d5c109ebb02945ba1ff6336cc937c27628", "shasum": "" }, @@ -551,29 +551,29 @@ }, { "name": "league/flysystem", - "version": "1.0.45", - "version_normalized": "1.0.45.0", + "version": "1.0.49", + "version_normalized": "1.0.49.0", "source": { "type": "git", "url": "https://github.com/thephpleague/flysystem.git", - "reference": "a99f94e63b512d75f851b181afcdf0ee9ebef7e6" + "reference": "a63cc83d8a931b271be45148fa39ba7156782ffd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a99f94e63b512d75f851b181afcdf0ee9ebef7e6", - "reference": "a99f94e63b512d75f851b181afcdf0ee9ebef7e6", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/a63cc83d8a931b271be45148fa39ba7156782ffd", + "reference": "a63cc83d8a931b271be45148fa39ba7156782ffd", "shasum": "" }, "require": { + "ext-fileinfo": "*", "php": ">=5.5.9" }, "conflict": { "league/flysystem-sftp": "<1.0.6" }, "require-dev": { - "ext-fileinfo": "*", "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^5.7.10" }, "suggest": { "ext-fileinfo": "Required for MimeType", @@ -591,7 +591,7 @@ "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" }, - "time": "2018-05-07T08:44:23+00:00", + "time": "2018-11-23T23:41:29+00:00", "type": "library", "extra": { "branch-alias": { @@ -892,17 +892,17 @@ }, { "name": "nesbot/carbon", - "version": "1.27.0", - "version_normalized": "1.27.0.0", + "version": "1.36.1", + "version_normalized": "1.36.1.0", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "ef81c39b67200dcd7401c24363dcac05ac3a4fe9" + "reference": "63da8cdf89d7a5efe43aabc794365f6e7b7b8983" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/ef81c39b67200dcd7401c24363dcac05ac3a4fe9", - "reference": "ef81c39b67200dcd7401c24363dcac05ac3a4fe9", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/63da8cdf89d7a5efe43aabc794365f6e7b7b8983", + "reference": "63da8cdf89d7a5efe43aabc794365f6e7b7b8983", "shasum": "" }, "require": { @@ -910,11 +910,21 @@ "symfony/translation": "~2.6 || ~3.0 || ~4.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2", "phpunit/phpunit": "^4.8.35 || ^5.7" }, - "time": "2018-04-23T09:02:57+00:00", + "suggest": { + "friendsofphp/php-cs-fixer": "Needed for the `composer phpcs` command. Allow to automatically fix code style.", + "phpstan/phpstan": "Needed for the `composer phpstan` command. Allow to detect potential errors." + }, + "time": "2018-11-22T18:23:02+00:00", "type": "library", + "extra": { + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + } + }, "installation-source": "dist", "autoload": { "psr-4": { @@ -942,17 +952,17 @@ }, { "name": "paragonie/random_compat", - "version": "v2.0.12", - "version_normalized": "2.0.12.0", + "version": "v2.0.17", + "version_normalized": "2.0.17.0", "source": { "type": "git", "url": "https://github.com/paragonie/random_compat.git", - "reference": "258c89a6b97de7dfaf5b8c7607d0478e236b04fb" + "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/paragonie/random_compat/zipball/258c89a6b97de7dfaf5b8c7607d0478e236b04fb", - "reference": "258c89a6b97de7dfaf5b8c7607d0478e236b04fb", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/29af24f25bab834fcbb38ad2a69fa93b867e070d", + "reference": "29af24f25bab834fcbb38ad2a69fa93b867e070d", "shasum": "" }, "require": { @@ -964,7 +974,7 @@ "suggest": { "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." }, - "time": "2018-04-04T21:24:14+00:00", + "time": "2018-07-04T16:31:37+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -986,6 +996,7 @@ "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", "keywords": [ "csprng", + "polyfill", "pseudorandom", "random" ] @@ -1151,27 +1162,27 @@ }, { "name": "pear/pear-core-minimal", - "version": "v1.10.3", - "version_normalized": "1.10.3.0", + "version": "v1.10.6", + "version_normalized": "1.10.6.0", "source": { "type": "git", "url": "https://github.com/pear/pear-core-minimal.git", - "reference": "070f0b600b2caca2501e2c9b7e553016e4b0d115" + "reference": "052868b244d31f822796e7e9981f62557eb256d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/070f0b600b2caca2501e2c9b7e553016e4b0d115", - "reference": "070f0b600b2caca2501e2c9b7e553016e4b0d115", + "url": "https://api.github.com/repos/pear/pear-core-minimal/zipball/052868b244d31f822796e7e9981f62557eb256d4", + "reference": "052868b244d31f822796e7e9981f62557eb256d4", "shasum": "" }, "require": { - "pear/console_getopt": "~1.4", + "pear/console_getopt": "~1.3", "pear/pear_exception": "~1.0" }, "replace": { "rsky/pear-core-min": "self.version" }, - "time": "2017-02-28T16:46:11+00:00", + "time": "2018-08-22T19:28:09+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1442,22 +1453,23 @@ }, { "name": "ramsey/uuid", - "version": "3.7.3", - "version_normalized": "3.7.3.0", + "version": "3.8.0", + "version_normalized": "3.8.0.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76" + "reference": "d09ea80159c1929d75b3f9c60504d613aeb4a1e3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/44abcdad877d9a46685a3a4d221e3b2c4b87cb76", - "reference": "44abcdad877d9a46685a3a4d221e3b2c4b87cb76", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/d09ea80159c1929d75b3f9c60504d613aeb4a1e3", + "reference": "d09ea80159c1929d75b3f9c60504d613aeb4a1e3", "shasum": "" }, "require": { - "paragonie/random_compat": "^1.0|^2.0", - "php": "^5.4 || ^7.0" + "paragonie/random_compat": "^1.0|^2.0|9.99.99", + "php": "^5.4 || ^7.0", + "symfony/polyfill-ctype": "^1.8" }, "replace": { "rhumsaa/uuid": "self.version" @@ -1465,16 +1477,17 @@ "require-dev": { "codeception/aspect-mock": "^1.0 | ~2.0.0", "doctrine/annotations": "~1.2.0", - "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1", + "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ~2.1.0", "ircmaxell/random-lib": "^1.1", "jakub-onderka/php-parallel-lint": "^0.9.0", "mockery/mockery": "^0.9.9", "moontoast/math": "^1.1", "php-mock/php-mock-phpunit": "^0.3|^1.1", - "phpunit/phpunit": "^4.7|^5.0", + "phpunit/phpunit": "^4.7|^5.0|^6.5", "squizlabs/php_codesniffer": "^2.3" }, "suggest": { + "ext-ctype": "Provides support for PHP Ctype functions", "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", "ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter", @@ -1482,7 +1495,7 @@ "ramsey/uuid-console": "A console application for generating UUIDs with ramsey/uuid", "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." }, - "time": "2018-01-20T00:28:24+00:00", + "time": "2018-07-19T23:38:55+00:00", "type": "library", "extra": { "branch-alias": { @@ -1577,17 +1590,17 @@ }, { "name": "swiftmailer/swiftmailer", - "version": "v5.4.9", - "version_normalized": "5.4.9.0", + "version": "v5.4.12", + "version_normalized": "5.4.12.0", "source": { "type": "git", "url": "https://github.com/swiftmailer/swiftmailer.git", - "reference": "7ffc1ea296ed14bf8260b6ef11b80208dbadba91" + "reference": "181b89f18a90f8925ef805f950d47a7190e9b950" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/7ffc1ea296ed14bf8260b6ef11b80208dbadba91", - "reference": "7ffc1ea296ed14bf8260b6ef11b80208dbadba91", + "url": "https://api.github.com/repos/swiftmailer/swiftmailer/zipball/181b89f18a90f8925ef805f950d47a7190e9b950", + "reference": "181b89f18a90f8925ef805f950d47a7190e9b950", "shasum": "" }, "require": { @@ -1597,7 +1610,7 @@ "mockery/mockery": "~0.9.1", "symfony/phpunit-bridge": "~3.2" }, - "time": "2018-01-23T07:37:21+00:00", + "time": "2018-07-31T09:26:32+00:00", "type": "library", "extra": { "branch-alias": { @@ -1633,22 +1646,23 @@ }, { "name": "symfony/config", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/config.git", - "reference": "7c2a9d44f4433863e9bca682e7f03609234657f9" + "reference": "8a660daeb65dedbe0b099529f65e61866c055081" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/config/zipball/7c2a9d44f4433863e9bca682e7f03609234657f9", - "reference": "7c2a9d44f4433863e9bca682e7f03609234657f9", + "url": "https://api.github.com/repos/symfony/config/zipball/8a660daeb65dedbe0b099529f65e61866c055081", + "reference": "8a660daeb65dedbe0b099529f65e61866c055081", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0" + "symfony/filesystem": "~2.8|~3.0|~4.0", + "symfony/polyfill-ctype": "~1.8" }, "conflict": { "symfony/dependency-injection": "<3.3", @@ -1663,7 +1677,7 @@ "suggest": { "symfony/yaml": "To use the yaml reference dumper" }, - "time": "2018-03-19T22:32:39+00:00", + "time": "2018-11-26T10:17:44+00:00", "type": "library", "extra": { "branch-alias": { @@ -1698,17 +1712,17 @@ }, { "name": "symfony/console", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "5b1fdfa8eb93464bcc36c34da39cedffef822cdf" + "reference": "8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/5b1fdfa8eb93464bcc36c34da39cedffef822cdf", - "reference": "5b1fdfa8eb93464bcc36c34da39cedffef822cdf", + "url": "https://api.github.com/repos/symfony/console/zipball/8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb", + "reference": "8f80fc39bbc3b7c47ee54ba7aa2653521ace94bb", "shasum": "" }, "require": { @@ -1734,7 +1748,7 @@ "symfony/lock": "", "symfony/process": "" }, - "time": "2018-04-30T01:22:56+00:00", + "time": "2018-11-26T12:48:07+00:00", "type": "library", "extra": { "branch-alias": { @@ -1769,23 +1783,23 @@ }, { "name": "symfony/css-selector", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/css-selector.git", - "reference": "519a80d7c1d95c6cc0b67f686d15fe27c6910de0" + "reference": "345b9a48595d1ab9630db791dbc3e721bf0233e8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/css-selector/zipball/519a80d7c1d95c6cc0b67f686d15fe27c6910de0", - "reference": "519a80d7c1d95c6cc0b67f686d15fe27c6910de0", + "url": "https://api.github.com/repos/symfony/css-selector/zipball/345b9a48595d1ab9630db791dbc3e721bf0233e8", + "reference": "345b9a48595d1ab9630db791dbc3e721bf0233e8", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8" }, - "time": "2018-03-19T22:32:39+00:00", + "time": "2018-11-11T19:48:54+00:00", "type": "library", "extra": { "branch-alias": { @@ -1807,7 +1821,7 @@ ], "authors": [ { - "name": "Jean-Fran?ois Simon", + "name": "Jean-François Simon", "email": "jeanfrancois.simon@sensiolabs.com" }, { @@ -1824,17 +1838,17 @@ }, { "name": "symfony/debug", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", - "reference": "1b95888cfd996484527cb41e8952d9a5eaf7454f" + "reference": "2016b3eec2e49c127dd02d0ef44a35c53181560d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/debug/zipball/1b95888cfd996484527cb41e8952d9a5eaf7454f", - "reference": "1b95888cfd996484527cb41e8952d9a5eaf7454f", + "url": "https://api.github.com/repos/symfony/debug/zipball/2016b3eec2e49c127dd02d0ef44a35c53181560d", + "reference": "2016b3eec2e49c127dd02d0ef44a35c53181560d", "shasum": "" }, "require": { @@ -1847,7 +1861,7 @@ "require-dev": { "symfony/http-kernel": "~2.8|~3.0|~4.0" }, - "time": "2018-04-30T16:53:52+00:00", + "time": "2018-11-11T19:48:54+00:00", "type": "library", "extra": { "branch-alias": { @@ -1882,17 +1896,17 @@ }, { "name": "symfony/dependency-injection", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "54ff9d78b56429f9a1ac12e60bfb6d169c0468e3" + "reference": "622b330ced1bdf29d240bd1c364c038f647eb0f5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/54ff9d78b56429f9a1ac12e60bfb6d169c0468e3", - "reference": "54ff9d78b56429f9a1ac12e60bfb6d169c0468e3", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/622b330ced1bdf29d240bd1c364c038f647eb0f5", + "reference": "622b330ced1bdf29d240bd1c364c038f647eb0f5", "shasum": "" }, "require": { @@ -1920,7 +1934,7 @@ "symfony/proxy-manager-bridge": "Generate service proxies to lazy load them", "symfony/yaml": "" }, - "time": "2018-04-29T14:04:08+00:00", + "time": "2018-11-20T16:14:23+00:00", "type": "library", "extra": { "branch-alias": { @@ -1955,17 +1969,17 @@ }, { "name": "symfony/event-dispatcher", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8" + "reference": "d365fc4416ec4980825873962ea5d1b1bca46f1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/fdd5abcebd1061ec647089c6c41a07ed60af09f8", - "reference": "fdd5abcebd1061ec647089c6c41a07ed60af09f8", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/d365fc4416ec4980825873962ea5d1b1bca46f1a", + "reference": "d365fc4416ec4980825873962ea5d1b1bca46f1a", "shasum": "" }, "require": { @@ -1985,7 +1999,7 @@ "symfony/dependency-injection": "", "symfony/http-kernel": "" }, - "time": "2018-04-06T07:35:25+00:00", + "time": "2018-11-26T10:17:44+00:00", "type": "library", "extra": { "branch-alias": { @@ -2020,23 +2034,24 @@ }, { "name": "symfony/filesystem", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "253a4490b528597aa14d2bf5aeded6f5e5e4a541" + "reference": "b49b1ca166bd109900e6a1683d9bb1115727ef2d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/253a4490b528597aa14d2bf5aeded6f5e5e4a541", - "reference": "253a4490b528597aa14d2bf5aeded6f5e5e4a541", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/b49b1ca166bd109900e6a1683d9bb1115727ef2d", + "reference": "b49b1ca166bd109900e6a1683d9bb1115727ef2d", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" }, - "time": "2018-02-22T10:48:49+00:00", + "time": "2018-11-11T19:48:54+00:00", "type": "library", "extra": { "branch-alias": { @@ -2071,23 +2086,23 @@ }, { "name": "symfony/finder", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "bd14efe8b1fabc4de82bf50dce62f05f9a102433" + "reference": "6cf2be5cbd0e87aa35c01f80ae0bf40b6798e442" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/bd14efe8b1fabc4de82bf50dce62f05f9a102433", - "reference": "bd14efe8b1fabc4de82bf50dce62f05f9a102433", + "url": "https://api.github.com/repos/symfony/finder/zipball/6cf2be5cbd0e87aa35c01f80ae0bf40b6798e442", + "reference": "6cf2be5cbd0e87aa35c01f80ae0bf40b6798e442", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8" }, - "time": "2018-04-04T05:07:11+00:00", + "time": "2018-11-11T19:48:54+00:00", "type": "library", "extra": { "branch-alias": { @@ -2122,17 +2137,17 @@ }, { "name": "symfony/http-foundation", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/http-foundation.git", - "reference": "edc43b1a50402bb06b5111eb86b275c87a93e373" + "reference": "ea61dd57c4399b0b2a4162e1820cd9d0783acd38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-foundation/zipball/edc43b1a50402bb06b5111eb86b275c87a93e373", - "reference": "edc43b1a50402bb06b5111eb86b275c87a93e373", + "url": "https://api.github.com/repos/symfony/http-foundation/zipball/ea61dd57c4399b0b2a4162e1820cd9d0783acd38", + "reference": "ea61dd57c4399b0b2a4162e1820cd9d0783acd38", "shasum": "" }, "require": { @@ -2143,7 +2158,7 @@ "require-dev": { "symfony/expression-language": "~2.8|~3.0|~4.0" }, - "time": "2018-04-30T01:05:13+00:00", + "time": "2018-11-26T10:17:44+00:00", "type": "library", "extra": { "branch-alias": { @@ -2178,17 +2193,17 @@ }, { "name": "symfony/http-kernel", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/http-kernel.git", - "reference": "280fcedbcb3dabcc467a9c1734054af61928fe4f" + "reference": "78528325d90e5ad54a6e9eca750fe176932bc4fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/http-kernel/zipball/280fcedbcb3dabcc467a9c1734054af61928fe4f", - "reference": "280fcedbcb3dabcc467a9c1734054af61928fe4f", + "url": "https://api.github.com/repos/symfony/http-kernel/zipball/78528325d90e5ad54a6e9eca750fe176932bc4fa", + "reference": "78528325d90e5ad54a6e9eca750fe176932bc4fa", "shasum": "" }, "require": { @@ -2196,11 +2211,12 @@ "psr/log": "~1.0", "symfony/debug": "~2.8|~3.0|~4.0", "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/http-foundation": "^3.4.4|^4.0.4" + "symfony/http-foundation": "~3.4.12|~4.0.12|^4.1.1", + "symfony/polyfill-ctype": "~1.8" }, "conflict": { "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.4.5|<4.0.5,>=4", + "symfony/dependency-injection": "<3.4.10|<4.0.10,>=4", "symfony/var-dumper": "<3.3", "twig/twig": "<1.34|<2.4,>=2" }, @@ -2214,7 +2230,7 @@ "symfony/config": "~2.8|~3.0|~4.0", "symfony/console": "~2.8|~3.0|~4.0", "symfony/css-selector": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "^3.4.5|^4.0.5", + "symfony/dependency-injection": "^3.4.10|^4.0.10", "symfony/dom-crawler": "~2.8|~3.0|~4.0", "symfony/expression-language": "~2.8|~3.0|~4.0", "symfony/finder": "~2.8|~3.0|~4.0", @@ -2233,7 +2249,7 @@ "symfony/finder": "", "symfony/var-dumper": "" }, - "time": "2018-04-30T19:27:02+00:00", + "time": "2018-11-26T14:04:48+00:00", "type": "library", "extra": { "branch-alias": { @@ -2266,19 +2282,79 @@ "description": "Symfony HttpKernel Component", "homepage": "https://symfony.com" }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.10.0", + "version_normalized": "1.10.0.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/e3d826245268269cd66f8326bd8bc066687b4a19", + "reference": "e3d826245268269cd66f8326bd8bc066687b4a19", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "time": "2018-08-06T14:22:27+00:00", + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + }, + "installation-source": "dist", + "autoload": { + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + }, + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + }, + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ] + }, { "name": "symfony/polyfill-mbstring", - "version": "v1.8.0", - "version_normalized": "1.8.0.0", + "version": "v1.10.0", + "version_normalized": "1.10.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "3296adf6a6454a050679cde90f95350ad604b171" + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/3296adf6a6454a050679cde90f95350ad604b171", - "reference": "3296adf6a6454a050679cde90f95350ad604b171", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/c79c051f5b3a46be09205c73b80b346e4153e494", + "reference": "c79c051f5b3a46be09205c73b80b346e4153e494", "shasum": "" }, "require": { @@ -2287,11 +2363,11 @@ "suggest": { "ext-mbstring": "For best performance" }, - "time": "2018-04-26T10:06:28+00:00", + "time": "2018-09-21T13:07:52+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "installation-source": "dist", @@ -2329,28 +2405,28 @@ }, { "name": "symfony/polyfill-php70", - "version": "v1.8.0", - "version_normalized": "1.8.0.0", + "version": "v1.10.0", + "version_normalized": "1.10.0.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php70.git", - "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6" + "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/77454693d8f10dd23bb24955cffd2d82db1007a6", - "reference": "77454693d8f10dd23bb24955cffd2d82db1007a6", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/6b88000cdd431cd2e940caa2cb569201f3f84224", + "reference": "6b88000cdd431cd2e940caa2cb569201f3f84224", "shasum": "" }, "require": { - "paragonie/random_compat": "~1.0|~2.0", + "paragonie/random_compat": "~1.0|~2.0|~9.99", "php": ">=5.3.3" }, - "time": "2018-04-26T10:06:28+00:00", + "time": "2018-09-21T06:26:08+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } }, "installation-source": "dist", @@ -2390,23 +2466,23 @@ }, { "name": "symfony/process", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "4b7d64e852886319e93ddfdecff0d744ab87658b" + "reference": "abb46b909dd6ba0b50e10d4c10ffe6ee96dd70f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/4b7d64e852886319e93ddfdecff0d744ab87658b", - "reference": "4b7d64e852886319e93ddfdecff0d744ab87658b", + "url": "https://api.github.com/repos/symfony/process/zipball/abb46b909dd6ba0b50e10d4c10ffe6ee96dd70f2", + "reference": "abb46b909dd6ba0b50e10d4c10ffe6ee96dd70f2", "shasum": "" }, "require": { "php": "^5.5.9|>=7.0.8" }, - "time": "2018-04-03T05:22:50+00:00", + "time": "2018-11-20T16:10:26+00:00", "type": "library", "extra": { "branch-alias": { @@ -2441,17 +2517,17 @@ }, { "name": "symfony/routing", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/routing.git", - "reference": "9deb375986f5d1f37283d8386716d26985a0f4b6" + "reference": "86eb1a581279b5e40ca280a4f63a15e37d51d16c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/routing/zipball/9deb375986f5d1f37283d8386716d26985a0f4b6", - "reference": "9deb375986f5d1f37283d8386716d26985a0f4b6", + "url": "https://api.github.com/repos/symfony/routing/zipball/86eb1a581279b5e40ca280a4f63a15e37d51d16c", + "reference": "86eb1a581279b5e40ca280a4f63a15e37d51d16c", "shasum": "" }, "require": { @@ -2464,7 +2540,6 @@ }, "require-dev": { "doctrine/annotations": "~1.0", - "doctrine/common": "~2.2", "psr/log": "~1.0", "symfony/config": "^3.3.1|~4.0", "symfony/dependency-injection": "~3.3|~4.0", @@ -2480,7 +2555,7 @@ "symfony/http-foundation": "For using a Symfony Request object", "symfony/yaml": "For using the YAML loader" }, - "time": "2018-04-12T09:01:03+00:00", + "time": "2018-11-26T08:40:22+00:00", "type": "library", "extra": { "branch-alias": { @@ -2521,17 +2596,17 @@ }, { "name": "symfony/translation", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "d4af50f46cd8171fd5c1cdebdb9a8bbcd8078c6c" + "reference": "bdbe940ed3ef4179f86032086c32d3a858becc0f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/d4af50f46cd8171fd5c1cdebdb9a8bbcd8078c6c", - "reference": "d4af50f46cd8171fd5c1cdebdb9a8bbcd8078c6c", + "url": "https://api.github.com/repos/symfony/translation/zipball/bdbe940ed3ef4179f86032086c32d3a858becc0f", + "reference": "bdbe940ed3ef4179f86032086c32d3a858becc0f", "shasum": "" }, "require": { @@ -2556,7 +2631,7 @@ "symfony/config": "", "symfony/yaml": "" }, - "time": "2018-04-30T01:22:56+00:00", + "time": "2018-11-26T10:17:44+00:00", "type": "library", "extra": { "branch-alias": { @@ -2591,17 +2666,17 @@ }, { "name": "symfony/var-dumper", - "version": "v3.4.9", - "version_normalized": "3.4.9.0", + "version": "v3.4.19", + "version_normalized": "3.4.19.0", "source": { "type": "git", "url": "https://github.com/symfony/var-dumper.git", - "reference": "0e6545672d8c9ce70dd472adc2f8b03155a46f73" + "reference": "6867713afe6c50ade2f34ed6435563b065a52145" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/var-dumper/zipball/0e6545672d8c9ce70dd472adc2f8b03155a46f73", - "reference": "0e6545672d8c9ce70dd472adc2f8b03155a46f73", + "url": "https://api.github.com/repos/symfony/var-dumper/zipball/6867713afe6c50ade2f34ed6435563b065a52145", + "reference": "6867713afe6c50ade2f34ed6435563b065a52145", "shasum": "" }, "require": { @@ -2620,7 +2695,7 @@ "ext-intl": "To show region name in time zone dump", "ext-symfony_debug": "" }, - "time": "2018-04-26T12:42:15+00:00", + "time": "2018-11-20T16:10:26+00:00", "type": "library", "extra": { "branch-alias": { @@ -2711,17 +2786,17 @@ }, { "name": "typo3/class-alias-loader", - "version": "1.0.0", - "version_normalized": "1.0.0.0", + "version": "1.0.1", + "version_normalized": "1.0.1.0", "source": { "type": "git", "url": "https://github.com/TYPO3/class-alias-loader.git", - "reference": "a9dd295c81ed0b51455644be420ab9210cad688f" + "reference": "4972f9f6c2bad07ab1620b5c9717fa626e9b03b0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/TYPO3/class-alias-loader/zipball/a9dd295c81ed0b51455644be420ab9210cad688f", - "reference": "a9dd295c81ed0b51455644be420ab9210cad688f", + "url": "https://api.github.com/repos/TYPO3/class-alias-loader/zipball/4972f9f6c2bad07ab1620b5c9717fa626e9b03b0", + "reference": "4972f9f6c2bad07ab1620b5c9717fa626e9b03b0", "shasum": "" }, "require": { @@ -2734,9 +2809,9 @@ "require-dev": { "composer/composer": "dev-master", "mikey179/vfsstream": "1.4.*@dev", - "phpunit/phpunit": "~4.7.0" + "phpunit/phpunit": "^4.8" }, - "time": "2015-10-06T10:25:44+00:00", + "time": "2018-10-03T12:49:56+00:00", "type": "composer-plugin", "extra": { "class": "TYPO3\\ClassAliasLoader\\Plugin", @@ -2771,30 +2846,30 @@ }, { "name": "vlucas/phpdotenv", - "version": "v2.4.0", - "version_normalized": "2.4.0.0", + "version": "v2.5.1", + "version_normalized": "2.5.1.0", "source": { "type": "git", "url": "https://github.com/vlucas/phpdotenv.git", - "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c" + "reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", - "reference": "3cc116adbe4b11be5ec557bf1d24dc5e3a21d18c", + "url": "https://api.github.com/repos/vlucas/phpdotenv/zipball/8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e", + "reference": "8abb4f9aa89ddea9d52112c65bbe8d0125e2fa8e", "shasum": "" }, "require": { "php": ">=5.3.9" }, "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" + "phpunit/phpunit": "^4.8.35 || ^5.0" }, - "time": "2016-09-01T10:05:43+00:00", + "time": "2018-07-29T20:33:41+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } }, "installation-source": "dist", @@ -2805,7 +2880,7 @@ }, "notification-url": "https://packagist.org/downloads/", "license": [ - "BSD-3-Clause-Attribution" + "BSD-3-Clause" ], "authors": [ { diff --git a/vendor/league/flysystem/composer.json b/vendor/league/flysystem/composer.json index 6fc135c90..696c26feb 100644 --- a/vendor/league/flysystem/composer.json +++ b/vendor/league/flysystem/composer.json @@ -14,12 +14,12 @@ } ], "require": { - "php": ">=5.5.9" + "php": ">=5.5.9", + "ext-fileinfo": "*" }, "require-dev": { - "ext-fileinfo": "*", "phpspec/phpspec": "^3.4", - "phpunit/phpunit": "^5.7" + "phpunit/phpunit": "^5.7.10" }, "autoload": { "psr-4": { diff --git a/vendor/league/flysystem/deprecations.md b/vendor/league/flysystem/deprecations.md new file mode 100644 index 000000000..ef786d16c --- /dev/null +++ b/vendor/league/flysystem/deprecations.md @@ -0,0 +1,19 @@ +# Deprecations + +This document lists all the planned deprecations. + +## Handlers will be removed in 2.0 + +The `Handler` type and associated calls will be removed in version 2.0. + +### Upgrade path + +You should create your own implementation for handling OOP usage, +but it's recommended to move away from using an OOP-style wrapper entirely. + +The reason for this is that it's too easy for implementation details (for +your application this is Flysystem) to leak into the application. The most +important part for Flysystem is that it improves portability and creates a +solid boundary between your application core and the infrastructure you use. +The OOP-style handling breaks this principle, therefore I want to stop +promoting it. \ No newline at end of file diff --git a/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php b/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php index d42630736..932ffbbf9 100644 --- a/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php +++ b/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php @@ -71,11 +71,6 @@ abstract class AbstractFtpAdapter extends AbstractAdapter */ protected $systemType; - /** - * @var bool - */ - protected $alternativeRecursion = false; - /** * @var SafeStorage */ diff --git a/vendor/league/flysystem/src/Adapter/Local.php b/vendor/league/flysystem/src/Adapter/Local.php index 3e3c82762..1bdf51d81 100644 --- a/vendor/league/flysystem/src/Adapter/Local.php +++ b/vendor/league/flysystem/src/Adapter/Local.php @@ -33,13 +33,13 @@ class Local extends AbstractAdapter */ protected static $permissions = [ 'file' => [ - 'public' => 0644, + 'public' => 0644, 'private' => 0600, ], - 'dir' => [ - 'public' => 0755, + 'dir' => [ + 'public' => 0755, 'private' => 0700, - ] + ], ]; /** @@ -56,6 +56,7 @@ class Local extends AbstractAdapter * @var int */ protected $writeFlags; + /** * @var int */ @@ -99,11 +100,16 @@ protected function ensureDirectory($root) { if ( ! is_dir($root)) { $umask = umask(0); - @mkdir($root, $this->permissionMap['dir']['public'], true); + + if ( ! @mkdir($root, $this->permissionMap['dir']['public'], true)) { + $mkdirError = error_get_last(); + } + umask($umask); if ( ! is_dir($root)) { - throw new Exception(sprintf('Impossible to create the root directory "%s".', $root)); + $errorMessage = isset($mkdirError['message']) ? $mkdirError['message'] : ''; + throw new Exception(sprintf('Impossible to create the root directory "%s". %s', $root, $errorMessage)); } } } @@ -150,18 +156,11 @@ public function writeStream($path, $resource, Config $config) $this->ensureDirectory(dirname($location)); $stream = fopen($location, 'w+b'); - if ( ! $stream) { - return false; - } - - stream_copy_to_stream($resource, $stream); - - if ( ! fclose($stream)) { + if ( ! $stream || stream_copy_to_stream($resource, $stream) === false || ! fclose($stream)) { return false; } $type = 'file'; - $result = compact('type', 'path'); if ($visibility = $config->get('visibility')) { @@ -261,7 +260,7 @@ public function delete($path) { $location = $this->applyPathPrefix($path); - return unlink($location); + return @unlink($location); } /** diff --git a/vendor/league/flysystem/src/MountManager.php b/vendor/league/flysystem/src/MountManager.php index 6dea20010..620f540ea 100644 --- a/vendor/league/flysystem/src/MountManager.php +++ b/vendor/league/flysystem/src/MountManager.php @@ -3,7 +3,6 @@ namespace League\Flysystem; use InvalidArgumentException; -use League\Flysystem\FilesystemNotFoundException; use League\Flysystem\Plugin\PluggableTrait; use League\Flysystem\Plugin\PluginNotFoundException; @@ -14,36 +13,15 @@ * * @method AdapterInterface getAdapter($prefix) * @method Config getConfig($prefix) - * @method bool has($path) - * @method bool write($path, $contents, array $config = []) - * @method bool writeStream($path, $resource, array $config = []) - * @method bool put($path, $contents, $config = []) - * @method bool putStream($path, $contents, $config = []) - * @method string readAndDelete($path) - * @method bool update($path, $contents, $config = []) - * @method bool updateStream($path, $resource, $config = []) - * @method string|false read($path) - * @method resource|false readStream($path) - * @method bool rename($path, $newpath) - * @method bool delete($path) - * @method bool deleteDir($dirname) - * @method bool createDir($dirname, $config = []) * @method array listFiles($directory = '', $recursive = false) * @method array listPaths($directory = '', $recursive = false) * @method array getWithMetadata($path, array $metadata) - * @method string|false getMimetype($path) - * @method int|false getTimestamp($path) - * @method string|false getVisibility($path) - * @method int|false getSize($path); - * @method bool setVisibility($path, $visibility) - * @method array|false getMetadata($path) - * @method Handler get($path, Handler $handler = null) * @method Filesystem flushCache() * @method void assertPresent($path) * @method void assertAbsent($path) * @method Filesystem addPlugin(PluginInterface $plugin) */ -class MountManager +class MountManager implements FilesystemInterface { use PluggableTrait; @@ -195,6 +173,7 @@ public function __call($method, $arguments) * * @throws InvalidArgumentException * @throws FilesystemNotFoundException + * @throws FileExistsException * * @return bool */ @@ -317,4 +296,353 @@ protected function getPrefixAndPath($path) return explode('://', $path, 2); } + + /** + * Check whether a file exists. + * + * @param string $path + * + * @return bool + */ + public function has($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->has($path); + } + + /** + * Read a file. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file contents or false on failure. + */ + public function read($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->read($path); + } + + /** + * Retrieves a read-stream for a path. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return resource|false The path resource or false on failure. + */ + public function readStream($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->readStream($path); + } + + /** + * Get a file's metadata. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return array|false The file metadata or false on failure. + */ + public function getMetadata($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getMetadata($path); + } + + /** + * Get a file's size. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return int|false The file size or false on failure. + */ + public function getSize($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getSize($path); + } + + /** + * Get a file's mime-type. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file mime-type or false on failure. + */ + public function getMimetype($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getMimetype($path); + } + + /** + * Get a file's timestamp. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The timestamp or false on failure. + */ + public function getTimestamp($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getTimestamp($path); + } + + /** + * Get a file's visibility. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The visibility (public|private) or false on failure. + */ + public function getVisibility($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->getVisibility($path); + } + + /** + * Write a new file. + * + * @param string $path The path of the new file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @throws FileExistsException + * + * @return bool True on success, false on failure. + */ + public function write($path, $contents, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->write($path, $contents, $config); + } + + /** + * Write a new file using a stream. + * + * @param string $path The path of the new file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException If $resource is not a file handle. + * @throws FileExistsException + * + * @return bool True on success, false on failure. + */ + public function writeStream($path, $resource, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->writeStream($path, $resource, $config); + } + + /** + * Update an existing file. + * + * @param string $path The path of the existing file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function update($path, $contents, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->update($path, $contents, $config); + } + + /** + * Update an existing file using a stream. + * + * @param string $path The path of the existing file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException If $resource is not a file handle. + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function updateStream($path, $resource, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->updateStream($path, $resource, $config); + } + + /** + * Rename a file. + * + * @param string $path Path to the existing file. + * @param string $newpath The new path of the file. + * + * @throws FileExistsException Thrown if $newpath exists. + * @throws FileNotFoundException Thrown if $path does not exist. + * + * @return bool True on success, false on failure. + */ + public function rename($path, $newpath) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->rename($path, $newpath); + } + + /** + * Delete a file. + * + * @param string $path + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function delete($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->delete($path); + } + + /** + * Delete a directory. + * + * @param string $dirname + * + * @throws RootViolationException Thrown if $dirname is empty. + * + * @return bool True on success, false on failure. + */ + public function deleteDir($dirname) + { + list($prefix, $dirname) = $this->getPrefixAndPath($dirname); + + return $this->getFilesystem($prefix)->deleteDir($dirname); + } + + /** + * Create a directory. + * + * @param string $dirname The name of the new directory. + * @param array $config An optional configuration array. + * + * @return bool True on success, false on failure. + */ + public function createDir($dirname, array $config = []) + { + list($prefix, $dirname) = $this->getPrefixAndPath($dirname); + + return $this->getFilesystem($prefix)->createDir($dirname); + } + + /** + * Set the visibility for a file. + * + * @param string $path The path to the file. + * @param string $visibility One of 'public' or 'private'. + * + * @throws FileNotFoundException + * + * @return bool True on success, false on failure. + */ + public function setVisibility($path, $visibility) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->setVisibility($path, $visibility); + } + + /** + * Create a file or update if exists. + * + * @param string $path The path to the file. + * @param string $contents The file contents. + * @param array $config An optional configuration array. + * + * @return bool True on success, false on failure. + */ + public function put($path, $contents, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->put($path, $contents, $config); + } + + /** + * Create a file or update if exists. + * + * @param string $path The path to the file. + * @param resource $resource The file handle. + * @param array $config An optional configuration array. + * + * @throws InvalidArgumentException Thrown if $resource is not a resource. + * + * @return bool True on success, false on failure. + */ + public function putStream($path, $resource, array $config = []) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->putStream($path, $resource, $config); + } + + /** + * Read and delete a file. + * + * @param string $path The path to the file. + * + * @throws FileNotFoundException + * + * @return string|false The file contents, or false on failure. + */ + public function readAndDelete($path) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->readAndDelete($path); + } + + /** + * Get a file/directory handler. + * + * @deprecated + * + * @param string $path The path to the file. + * @param Handler $handler An optional existing handler to populate. + * + * @return Handler Either a file or directory handler. + */ + public function get($path, Handler $handler = null) + { + list($prefix, $path) = $this->getPrefixAndPath($path); + + return $this->getFilesystem($prefix)->get($path); + } } diff --git a/vendor/league/flysystem/src/Util/MimeType.php b/vendor/league/flysystem/src/Util/MimeType.php index 69e35e729..254bc2a14 100644 --- a/vendor/league/flysystem/src/Util/MimeType.php +++ b/vendor/league/flysystem/src/Util/MimeType.php @@ -10,6 +10,166 @@ */ class MimeType { + protected static $extensionToMimeTypeMap = [ + 'hqx' => 'application/mac-binhex40', + 'cpt' => 'application/mac-compactpro', + 'csv' => 'text/x-comma-separated-values', + 'bin' => 'application/octet-stream', + 'dms' => 'application/octet-stream', + 'lha' => 'application/octet-stream', + 'lzh' => 'application/octet-stream', + 'exe' => 'application/octet-stream', + 'class' => 'application/octet-stream', + 'psd' => 'application/x-photoshop', + 'so' => 'application/octet-stream', + 'sea' => 'application/octet-stream', + 'dll' => 'application/octet-stream', + 'oda' => 'application/oda', + 'pdf' => 'application/pdf', + 'ai' => 'application/pdf', + 'eps' => 'application/postscript', + 'epub' => 'application/epub+zip', + 'ps' => 'application/postscript', + 'smi' => 'application/smil', + 'smil' => 'application/smil', + 'mif' => 'application/vnd.mif', + 'xls' => 'application/vnd.ms-excel', + 'ppt' => 'application/powerpoint', + 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', + 'wbxml' => 'application/wbxml', + 'wmlc' => 'application/wmlc', + 'dcr' => 'application/x-director', + 'dir' => 'application/x-director', + 'dxr' => 'application/x-director', + 'dvi' => 'application/x-dvi', + 'gtar' => 'application/x-gtar', + 'gz' => 'application/x-gzip', + 'gzip' => 'application/x-gzip', + 'php' => 'application/x-httpd-php', + 'php4' => 'application/x-httpd-php', + 'php3' => 'application/x-httpd-php', + 'phtml' => 'application/x-httpd-php', + 'phps' => 'application/x-httpd-php-source', + 'js' => 'application/javascript', + 'swf' => 'application/x-shockwave-flash', + 'sit' => 'application/x-stuffit', + 'tar' => 'application/x-tar', + 'tgz' => 'application/x-tar', + 'z' => 'application/x-compress', + 'xhtml' => 'application/xhtml+xml', + 'xht' => 'application/xhtml+xml', + 'rdf' => 'application/rdf+xml', + 'zip' => 'application/x-zip', + 'rar' => 'application/x-rar', + 'mid' => 'audio/midi', + 'midi' => 'audio/midi', + 'mpga' => 'audio/mpeg', + 'mp2' => 'audio/mpeg', + 'mp3' => 'audio/mpeg', + 'aif' => 'audio/x-aiff', + 'aiff' => 'audio/x-aiff', + 'aifc' => 'audio/x-aiff', + 'ram' => 'audio/x-pn-realaudio', + 'rm' => 'audio/x-pn-realaudio', + 'rpm' => 'audio/x-pn-realaudio-plugin', + 'ra' => 'audio/x-realaudio', + 'rv' => 'video/vnd.rn-realvideo', + 'wav' => 'audio/x-wav', + 'jpg' => 'image/jpeg', + 'jpeg' => 'image/jpeg', + 'jpe' => 'image/jpeg', + 'png' => 'image/png', + 'gif' => 'image/gif', + 'bmp' => 'image/bmp', + 'tiff' => 'image/tiff', + 'tif' => 'image/tiff', + 'svg' => 'image/svg+xml', + 'css' => 'text/css', + 'html' => 'text/html', + 'htm' => 'text/html', + 'shtml' => 'text/html', + 'txt' => 'text/plain', + 'text' => 'text/plain', + 'log' => 'text/plain', + 'rtx' => 'text/richtext', + 'rtf' => 'text/rtf', + 'xml' => 'application/xml', + 'xsl' => 'application/xml', + 'dmn' => 'application/octet-stream', + 'bpmn' => 'application/octet-stream', + 'mpeg' => 'video/mpeg', + 'mpg' => 'video/mpeg', + 'mpe' => 'video/mpeg', + 'qt' => 'video/quicktime', + 'mov' => 'video/quicktime', + 'avi' => 'video/x-msvideo', + 'movie' => 'video/x-sgi-movie', + 'doc' => 'application/msword', + 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', + 'dot' => 'application/msword', + 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', + 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', + 'word' => 'application/msword', + 'xl' => 'application/excel', + 'eml' => 'message/rfc822', + 'json' => 'application/json', + 'pem' => 'application/x-x509-user-cert', + 'p10' => 'application/x-pkcs10', + 'p12' => 'application/x-pkcs12', + 'p7a' => 'application/x-pkcs7-signature', + 'p7c' => 'application/pkcs7-mime', + 'p7m' => 'application/pkcs7-mime', + 'p7r' => 'application/x-pkcs7-certreqresp', + 'p7s' => 'application/pkcs7-signature', + 'crt' => 'application/x-x509-ca-cert', + 'crl' => 'application/pkix-crl', + 'der' => 'application/x-x509-ca-cert', + 'kdb' => 'application/octet-stream', + 'pgp' => 'application/pgp', + 'gpg' => 'application/gpg-keys', + 'sst' => 'application/octet-stream', + 'csr' => 'application/octet-stream', + 'rsa' => 'application/x-pkcs7', + 'cer' => 'application/pkix-cert', + '3g2' => 'video/3gpp2', + '3gp' => 'video/3gp', + 'mp4' => 'video/mp4', + 'm4a' => 'audio/x-m4a', + 'f4v' => 'video/mp4', + 'webm' => 'video/webm', + 'aac' => 'audio/x-acc', + 'm4u' => 'application/vnd.mpegurl', + 'm3u' => 'text/plain', + 'xspf' => 'application/xspf+xml', + 'vlc' => 'application/videolan', + 'wmv' => 'video/x-ms-wmv', + 'au' => 'audio/x-au', + 'ac3' => 'audio/ac3', + 'flac' => 'audio/x-flac', + 'ogg' => 'audio/ogg', + 'kmz' => 'application/vnd.google-earth.kmz', + 'kml' => 'application/vnd.google-earth.kml+xml', + 'ics' => 'text/calendar', + 'zsh' => 'text/x-scriptzsh', + '7zip' => 'application/x-7z-compressed', + 'cdr' => 'application/cdr', + 'wma' => 'audio/x-ms-wma', + 'jar' => 'application/java-archive', + 'tex' => 'application/x-tex', + 'latex' => 'application/x-latex', + 'odt' => 'application/vnd.oasis.opendocument.text', + 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', + 'odp' => 'application/vnd.oasis.opendocument.presentation', + 'odg' => 'application/vnd.oasis.opendocument.graphics', + 'odc' => 'application/vnd.oasis.opendocument.chart', + 'odf' => 'application/vnd.oasis.opendocument.formula', + 'odi' => 'application/vnd.oasis.opendocument.image', + 'odm' => 'application/vnd.oasis.opendocument.text-master', + 'odb' => 'application/vnd.oasis.opendocument.database', + 'ott' => 'application/vnd.oasis.opendocument.text-template', + ]; + /** * Detects MIME Type based on given content. * @@ -41,17 +201,9 @@ public static function detectByContent($content) */ public static function detectByFileExtension($extension) { - static $extensionToMimeTypeMap; - - if (! $extensionToMimeTypeMap) { - $extensionToMimeTypeMap = static::getExtensionToMimeTypeMap(); - } - - if (isset($extensionToMimeTypeMap[$extension])) { - return $extensionToMimeTypeMap[$extension]; - } - - return 'text/plain'; + return isset(static::$extensionToMimeTypeMap[$extension]) + ? static::$extensionToMimeTypeMap[$extension] + : 'text/plain'; } /** @@ -71,162 +223,6 @@ public static function detectByFilename($filename) */ public static function getExtensionToMimeTypeMap() { - return [ - 'hqx' => 'application/mac-binhex40', - 'cpt' => 'application/mac-compactpro', - 'csv' => 'text/x-comma-separated-values', - 'bin' => 'application/octet-stream', - 'dms' => 'application/octet-stream', - 'lha' => 'application/octet-stream', - 'lzh' => 'application/octet-stream', - 'exe' => 'application/octet-stream', - 'class' => 'application/octet-stream', - 'psd' => 'application/x-photoshop', - 'so' => 'application/octet-stream', - 'sea' => 'application/octet-stream', - 'dll' => 'application/octet-stream', - 'oda' => 'application/oda', - 'pdf' => 'application/pdf', - 'ai' => 'application/pdf', - 'eps' => 'application/postscript', - 'ps' => 'application/postscript', - 'smi' => 'application/smil', - 'smil' => 'application/smil', - 'mif' => 'application/vnd.mif', - 'xls' => 'application/vnd.ms-excel', - 'ppt' => 'application/powerpoint', - 'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'wbxml' => 'application/wbxml', - 'wmlc' => 'application/wmlc', - 'dcr' => 'application/x-director', - 'dir' => 'application/x-director', - 'dxr' => 'application/x-director', - 'dvi' => 'application/x-dvi', - 'gtar' => 'application/x-gtar', - 'gz' => 'application/x-gzip', - 'gzip' => 'application/x-gzip', - 'php' => 'application/x-httpd-php', - 'php4' => 'application/x-httpd-php', - 'php3' => 'application/x-httpd-php', - 'phtml' => 'application/x-httpd-php', - 'phps' => 'application/x-httpd-php-source', - 'js' => 'application/javascript', - 'swf' => 'application/x-shockwave-flash', - 'sit' => 'application/x-stuffit', - 'tar' => 'application/x-tar', - 'tgz' => 'application/x-tar', - 'z' => 'application/x-compress', - 'xhtml' => 'application/xhtml+xml', - 'xht' => 'application/xhtml+xml', - 'zip' => 'application/x-zip', - 'rar' => 'application/x-rar', - 'mid' => 'audio/midi', - 'midi' => 'audio/midi', - 'mpga' => 'audio/mpeg', - 'mp2' => 'audio/mpeg', - 'mp3' => 'audio/mpeg', - 'aif' => 'audio/x-aiff', - 'aiff' => 'audio/x-aiff', - 'aifc' => 'audio/x-aiff', - 'ram' => 'audio/x-pn-realaudio', - 'rm' => 'audio/x-pn-realaudio', - 'rpm' => 'audio/x-pn-realaudio-plugin', - 'ra' => 'audio/x-realaudio', - 'rv' => 'video/vnd.rn-realvideo', - 'wav' => 'audio/x-wav', - 'jpg' => 'image/jpeg', - 'jpeg' => 'image/jpeg', - 'jpe' => 'image/jpeg', - 'png' => 'image/png', - 'gif' => 'image/gif', - 'bmp' => 'image/bmp', - 'tiff' => 'image/tiff', - 'tif' => 'image/tiff', - 'svg' => 'image/svg+xml', - 'css' => 'text/css', - 'html' => 'text/html', - 'htm' => 'text/html', - 'shtml' => 'text/html', - 'txt' => 'text/plain', - 'text' => 'text/plain', - 'log' => 'text/plain', - 'rtx' => 'text/richtext', - 'rtf' => 'text/rtf', - 'xml' => 'application/xml', - 'xsl' => 'application/xml', - 'dmn' => 'application/octet-stream', - 'bpmn' => 'application/octet-stream', - 'mpeg' => 'video/mpeg', - 'mpg' => 'video/mpeg', - 'mpe' => 'video/mpeg', - 'qt' => 'video/quicktime', - 'mov' => 'video/quicktime', - 'avi' => 'video/x-msvideo', - 'movie' => 'video/x-sgi-movie', - 'doc' => 'application/msword', - 'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'docm' => 'application/vnd.ms-word.template.macroEnabled.12', - 'dot' => 'application/msword', - 'dotx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', - 'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', - 'word' => 'application/msword', - 'xl' => 'application/excel', - 'eml' => 'message/rfc822', - 'json' => 'application/json', - 'pem' => 'application/x-x509-user-cert', - 'p10' => 'application/x-pkcs10', - 'p12' => 'application/x-pkcs12', - 'p7a' => 'application/x-pkcs7-signature', - 'p7c' => 'application/pkcs7-mime', - 'p7m' => 'application/pkcs7-mime', - 'p7r' => 'application/x-pkcs7-certreqresp', - 'p7s' => 'application/pkcs7-signature', - 'crt' => 'application/x-x509-ca-cert', - 'crl' => 'application/pkix-crl', - 'der' => 'application/x-x509-ca-cert', - 'kdb' => 'application/octet-stream', - 'pgp' => 'application/pgp', - 'gpg' => 'application/gpg-keys', - 'sst' => 'application/octet-stream', - 'csr' => 'application/octet-stream', - 'rsa' => 'application/x-pkcs7', - 'cer' => 'application/pkix-cert', - '3g2' => 'video/3gpp2', - '3gp' => 'video/3gp', - 'mp4' => 'video/mp4', - 'm4a' => 'audio/x-m4a', - 'f4v' => 'video/mp4', - 'webm' => 'video/webm', - 'aac' => 'audio/x-acc', - 'm4u' => 'application/vnd.mpegurl', - 'm3u' => 'text/plain', - 'xspf' => 'application/xspf+xml', - 'vlc' => 'application/videolan', - 'wmv' => 'video/x-ms-wmv', - 'au' => 'audio/x-au', - 'ac3' => 'audio/ac3', - 'flac' => 'audio/x-flac', - 'ogg' => 'audio/ogg', - 'kmz' => 'application/vnd.google-earth.kmz', - 'kml' => 'application/vnd.google-earth.kml+xml', - 'ics' => 'text/calendar', - 'zsh' => 'text/x-scriptzsh', - '7zip' => 'application/x-7z-compressed', - 'cdr' => 'application/cdr', - 'wma' => 'audio/x-ms-wma', - 'jar' => 'application/java-archive', - 'tex' => 'application/x-tex', - 'latex' => 'application/x-latex', - 'odt' => 'application/vnd.oasis.opendocument.text', - 'ods' => 'application/vnd.oasis.opendocument.spreadsheet', - 'odp' => 'application/vnd.oasis.opendocument.presentation', - 'odg' => 'application/vnd.oasis.opendocument.graphics', - 'odc' => 'application/vnd.oasis.opendocument.chart', - 'odf' => 'application/vnd.oasis.opendocument.formula', - 'odi' => 'application/vnd.oasis.opendocument.image', - 'odm' => 'application/vnd.oasis.opendocument.text-master', - 'odb' => 'application/vnd.oasis.opendocument.database', - 'ott' => 'application/vnd.oasis.opendocument.text-template', - ]; + return static::$extensionToMimeTypeMap; } } diff --git a/vendor/nesbot/carbon/.php_cs.dist b/vendor/nesbot/carbon/.php_cs.dist deleted file mode 100644 index f731e3ade..000000000 --- a/vendor/nesbot/carbon/.php_cs.dist +++ /dev/null @@ -1,60 +0,0 @@ - true, - 'array_syntax' => array( - 'syntax' => 'long', - ), - 'binary_operator_spaces' => array( - 'align_double_arrow' => false, - 'align_equals' => false, - ), - 'blank_line_before_return' => true, - 'cast_spaces' => true, - 'concat_space' => array( - 'spacing' => 'none', - ), - 'ereg_to_preg' => true, - 'method_separation' => true, - 'no_blank_lines_after_phpdoc' => true, - 'no_extra_consecutive_blank_lines' => true, - 'no_short_bool_cast' => true, - 'no_unneeded_control_parentheses' => true, - 'no_unused_imports' => true, - 'no_whitespace_in_blank_line' => true, - 'ordered_imports' => true, - 'phpdoc_align' => true, - 'phpdoc_indent' => true, - 'phpdoc_inline_tag' => true, - 'phpdoc_no_access' => true, - 'phpdoc_no_alias_tag' => array( - 'type' => 'var', - ), - 'phpdoc_no_package' => true, - 'phpdoc_order' => true, - 'phpdoc_scalar' => true, - 'phpdoc_separation' => true, - 'phpdoc_to_comment' => true, - 'phpdoc_trim' => true, - 'phpdoc_types' => true, - 'phpdoc_var_without_name' => true, - 'self_accessor' => true, - 'single_quote' => true, - 'space_after_semicolon' => true, - 'standardize_not_equals' => true, - 'ternary_operator_spaces' => true, - 'trailing_comma_in_multiline_array' => true, - 'trim_array_spaces' => true, - 'unary_operator_spaces' => true, - 'line_ending' => true, - 'blank_line_after_namespace' => true, - 'no_unused_imports' => true, -); - -return Config::create()->setRules($rules) - ->setFinder(Finder::create()->in(__DIR__)) - ->setUsingCache(true) - ->setRiskyAllowed(true); diff --git a/vendor/nesbot/carbon/build.php b/vendor/nesbot/carbon/build.php deleted file mode 100644 index 3cb0b5be9..000000000 --- a/vendor/nesbot/carbon/build.php +++ /dev/null @@ -1,87 +0,0 @@ -open($archive, ZipArchive::CREATE | ZipArchive::OVERWRITE); - - foreach (array('src', 'vendor', 'Carbon') as $directory) { - if (is_dir($directory)) { - $directory = realpath($directory); - $base = dirname($directory); - - $files = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($directory), - RecursiveIteratorIterator::LEAVES_ONLY - ); - - foreach ($files as $name => $file) { - if (!$file->isDir()) { - $filePath = $file->getRealPath(); - - $zip->addFile($filePath, substr($filePath, strlen($base) + 1)); - } - } - } - } - - $autoload = 'autoload.php'; - file_put_contents($autoload, "addFile($autoload, $autoload); - $zip->close(); - unlink($autoload); - - shell_exec('git checkout .'); - shell_exec("git checkout $currentBranch"); - shell_exec("git branch -d $branch"); - shell_exec('git stash pop'); - shell_exec('composer update --no-interaction'); -} - -exit(0); diff --git a/vendor/nesbot/carbon/composer.json b/vendor/nesbot/carbon/composer.json index 3ce2fbd54..709ff4ee7 100644 --- a/vendor/nesbot/carbon/composer.json +++ b/vendor/nesbot/carbon/composer.json @@ -25,9 +25,12 @@ "symfony/translation": "~2.6 || ~3.0 || ~4.0" }, "require-dev": { - "friendsofphp/php-cs-fixer": "~2", "phpunit/phpunit": "^4.8.35 || ^5.7" }, + "suggest": { + "friendsofphp/php-cs-fixer": "Needed for the `composer phpcs` command. Allow to automatically fix code style.", + "phpstan/phpstan": "Needed for the `composer phpstan` command. Allow to detect potential errors." + }, "autoload": { "psr-4": { "": "src/" @@ -49,5 +52,12 @@ "phpunit": "phpunit --verbose --coverage-clover=coverage.xml", "phpcs": "php-cs-fixer fix -v --diff --dry-run", "phpstan": "phpstan analyse --configuration phpstan.neon --level 3 src tests" + }, + "extra": { + "laravel": { + "providers": [ + "Carbon\\Laravel\\ServiceProvider" + ] + } } } diff --git a/vendor/nesbot/carbon/src/Carbon/Carbon.php b/vendor/nesbot/carbon/src/Carbon/Carbon.php index 36928acbe..a81770d10 100644 --- a/vendor/nesbot/carbon/src/Carbon/Carbon.php +++ b/vendor/nesbot/carbon/src/Carbon/Carbon.php @@ -13,6 +13,7 @@ use Carbon\Exceptions\InvalidDateException; use Closure; +use DateInterval; use DatePeriod; use DateTime; use DateTimeInterface; @@ -51,6 +52,14 @@ * @property-read bool $utc checks if the timezone is UTC, true if UTC, false otherwise * @property-read string $timezoneName * @property-read string $tzName + * @property-read string $englishDayOfWeek the day of week in English + * @property-read string $shortEnglishDayOfWeek the abbreviated day of week in English + * @property-read string $englishMonth the day of week in English + * @property-read string $shortEnglishMonth the abbreviated day of week in English + * @property-read string $localeDayOfWeek the day of week in current locale LC_TIME + * @property-read string $shortLocaleDayOfWeek the abbreviated day of week in current locale LC_TIME + * @property-read string $localeMonth the month in current locale LC_TIME + * @property-read string $shortLocaleMonth the abbreviated month in current locale LC_TIME */ class Carbon extends DateTime implements JsonSerializable { @@ -93,6 +102,7 @@ class Carbon extends DateTime implements JsonSerializable const MONTHS_PER_YEAR = 12; const MONTHS_PER_QUARTER = 3; const WEEKS_PER_YEAR = 52; + const WEEKS_PER_MONTH = 4; const DAYS_PER_WEEK = 7; const HOURS_PER_DAY = 24; const MINUTES_PER_HOUR = 60; @@ -186,7 +196,7 @@ class Carbon extends DateTime implements JsonSerializable 't' => '(2[89]|3[01])', 'L' => '(0|1)', 'o' => '([1-9][0-9]{0,4})', - 'Y' => '([1-9][0-9]{0,4})', + 'Y' => '([1-9]?[0-9]{4})', 'y' => '([0-9]{2})', 'a' => '(am|pm)', 'A' => '(AM|PM)', @@ -208,8 +218,8 @@ class Carbon extends DateTime implements JsonSerializable 'U' => '([0-9]*)', // The formats below are combinations of the above formats. - 'c' => '(([1-9][0-9]{0,4})\-(1[012]|0[1-9])\-(3[01]|[12][0-9]|0[1-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])[\+\-](1[012]|0[0-9]):([0134][05]))', // Y-m-dTH:i:sP - 'r' => '(([a-zA-Z]{3}), ([123][0-9]|[1-9]) ([a-zA-Z]{3}) ([1-9][0-9]{0,4}) (2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9]) [\+\-](1[012]|0[0-9])([0134][05]))', // D, j M Y H:i:s O + 'c' => '(([1-9]?[0-9]{4})\-(1[012]|0[1-9])\-(3[01]|[12][0-9]|0[1-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])[\+\-](1[012]|0[0-9]):([0134][05]))', // Y-m-dTH:i:sP + 'r' => '(([a-zA-Z]{3}), ([123][0-9]|[1-9]) ([a-zA-Z]{3}) ([1-9]?[0-9]{4}) (2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9]) [\+\-](1[012]|0[0-9])([0134][05]))', // D, j M Y H:i:s O ); /** @@ -275,6 +285,14 @@ class Carbon extends DateTime implements JsonSerializable */ protected static $yearsOverflow = true; + /** + * Indicates if years are compared with month by default so isSameMonth and isSameQuarter have $ofSameYear set + * to true by default. + * + * @var bool + */ + protected static $compareYearWithMonth = false; + /** * Options for diffForHumans(). * @@ -400,6 +418,26 @@ public static function shouldOverflowYears() return static::$yearsOverflow; } + /** + * Get the month comparison default behavior. + * + * @return bool + */ + public static function compareYearWithMonth($compareYearWithMonth = true) + { + static::$compareYearWithMonth = $compareYearWithMonth; + } + + /** + * Get the month comparison default behavior. + * + * @return bool + */ + public static function shouldCompareYearWithMonth() + { + return static::$compareYearWithMonth; + } + /** * Creates a DateTimeZone from a string, DateTimeZone or integer offset. * @@ -430,13 +468,25 @@ protected static function safeCreateDateTimeZone($object) $object = $tzName; } - $tz = @timezone_open((string) $object); + $tz = @timezone_open($object = (string) $object); - if ($tz === false) { - throw new InvalidArgumentException('Unknown or bad timezone ('.$object.')'); + if ($tz !== false) { + return $tz; + } + + // Work-around for a bug fixed in PHP 5.5.10 https://bugs.php.net/bug.php?id=45528 + // See: https://stackoverflow.com/q/14068594/2646927 + // @codeCoverageIgnoreStart + if (strpos($object, ':') !== false) { + try { + return static::createFromFormat('O', $object)->getTimezone(); + } catch (InvalidArgumentException $e) { + // + } } + // @codeCoverageIgnoreEnd - return $tz; + throw new InvalidArgumentException('Unknown or bad timezone ('.$object.')'); } /////////////////////////////////////////////////////////////////// @@ -677,7 +727,7 @@ public static function create($year = null, $month = null, $day = null, $hour = $year = 9999; } - $instance = static::createFromFormat('Y-n-j G:i:s', sprintf('%s-%s-%s %s:%02s:%02s', $year, $month, $day, $hour, $minute, $second), $tz); + $instance = static::createFromFormat('!Y-n-j G:i:s', sprintf('%s-%s-%s %s:%02s:%02s', $year, $month, $day, $hour, $minute, $second), $tz); if ($fixYear !== null) { $instance->addYears($fixYear); @@ -805,6 +855,13 @@ public static function createFromTimeString($time, $tz = null) return static::today($tz)->setTimeFromTimeString($time); } + private static function createFromFormatAndTimezone($format, $time, $tz) + { + return $tz !== null + ? parent::createFromFormat($format, $time, static::safeCreateDateTimeZone($tz)) + : parent::createFromFormat($format, $time); + } + /** * Create a Carbon instance from a specific format. * @@ -818,14 +875,31 @@ public static function createFromTimeString($time, $tz = null) */ public static function createFromFormat($format, $time, $tz = null) { - if ($tz !== null) { - $date = parent::createFromFormat($format, $time, static::safeCreateDateTimeZone($tz)); - } else { - $date = parent::createFromFormat($format, $time); - } - + // First attempt to create an instance, so that error messages are based on the unmodified format. + $date = self::createFromFormatAndTimezone($format, $time, $tz); $lastErrors = parent::getLastErrors(); + if (($mock = static::getTestNow()) && ($date instanceof DateTime || $date instanceof DateTimeInterface)) { + // Set timezone from mock if custom timezone was neither given directly nor as a part of format. + // First let's skip the part that will be ignored by the parser. + $nonEscaped = '(?getTimezone(); + } + + // Prepend mock datetime only if the format does not contain non escaped unix epoch reset flag. + if (!preg_match("/{$nonEscaped}[!|]/", $format)) { + $format = static::MOCK_DATETIME_FORMAT.' '.$format; + $time = $mock->format(static::MOCK_DATETIME_FORMAT).' '.$time; + } + + // Regenerate date from the modified format to base result on the mocked instance instead of now. + $date = self::createFromFormatAndTimezone($format, $time, $tz); + } + if ($date instanceof DateTime || $date instanceof DateTimeInterface) { $instance = static::instance($date); $instance::setLastErrors($lastErrors); @@ -895,6 +969,32 @@ public static function createFromTimestampUTC($timestamp) return new static('@'.$timestamp); } + /** + * Make a Carbon instance from given variable if possible. + * + * Always return a new instance. Parse only strings and only these likely to be dates (skip intervals + * and recurrences). Throw an exception for invalid format, but otherwise return null. + * + * @param mixed $var + * + * @return static|null + */ + public static function make($var) + { + if ($var instanceof DateTime || $var instanceof DateTimeInterface) { + return static::instance($var); + } + + if (is_string($var)) { + $var = trim($var); + $first = substr($var, 0, 1); + + if (is_string($var) && $first !== 'P' && $first !== 'R' && preg_match('/[a-z0-9]/i', $var)) { + return static::parse($var); + } + } + } + /** * Get a copy of the instance. * @@ -916,17 +1016,24 @@ public function nowWithSameTz() } /** - * Throws an exception if the given object is not a DateTime and does not implement DateTimeInterface. + * Throws an exception if the given object is not a DateTime and does not implement DateTimeInterface + * and not in $other. * - * @param mixed $date + * @param mixed $date + * @param string|array $other * * @throws \InvalidArgumentException */ - protected static function expectDateTime($date) + protected static function expectDateTime($date, $other = array()) { + $message = 'Expected '; + foreach ((array) $other as $expect) { + $message .= "{$expect}, "; + } + if (!$date instanceof DateTime && !$date instanceof DateTimeInterface) { throw new InvalidArgumentException( - 'Expected null, string, DateTime or DateTimeInterface, '. + $message.'DateTime or DateTimeInterface, '. (is_object($date) ? get_class($date) : gettype($date)).' given' ); } @@ -950,7 +1057,7 @@ protected function resolveCarbon($date = null) return static::parse($date, $this->getTimezone()); } - static::expectDateTime($date); + static::expectDateTime($date, array('null', 'string')); return $date instanceof self ? $date : static::instance($date); } @@ -966,7 +1073,7 @@ protected function resolveCarbon($date = null) * * @throws \InvalidArgumentException * - * @return string|int|\DateTimeZone + * @return string|int|bool|\DateTimeZone */ public function __get($name) { @@ -985,11 +1092,23 @@ public function __get($name) 'weekOfYear' => 'W', 'daysInMonth' => 't', 'timestamp' => 'U', + 'englishDayOfWeek' => 'l', + 'shortEnglishDayOfWeek' => 'D', + 'englishMonth' => 'F', + 'shortEnglishMonth' => 'M', + 'localeDayOfWeek' => '%A', + 'shortLocaleDayOfWeek' => '%a', + 'localeMonth' => '%B', + 'shortLocaleMonth' => '%b', ); switch (true) { case isset($formats[$name]): - return (int) $this->format($formats[$name]); + $format = $formats[$name]; + $method = substr($format, 0, 1) === '%' ? 'formatLocalized' : 'format'; + $value = $this->$method($format); + + return is_numeric($value) ? (int) $value : $value; case $name === 'weekOfMonth': return (int) ceil($this->day / static::DAYS_PER_WEEK); @@ -1336,10 +1455,16 @@ public static function getWeekStartsAt() * * @param int $day week start day * + * @throws InvalidArgumentException + * * @return void */ public static function setWeekStartsAt($day) { + if ($day > static::SATURDAY || $day < static::SUNDAY) { + throw new InvalidArgumentException('Day of a week should be greater than or equal to 0 and less than or equal to 6.'); + } + static::$weekStartsAt = $day; } @@ -1358,10 +1483,16 @@ public static function getWeekEndsAt() * * @param int $day * + * @throws InvalidArgumentException + * * @return void */ public static function setWeekEndsAt($day) { + if ($day > static::SATURDAY || $day < static::SUNDAY) { + throw new InvalidArgumentException('Day of a week should be greater than or equal to 0 and less than or equal to 6.'); + } + static::$weekEndsAt = $day; } @@ -1541,6 +1672,142 @@ public static function setLocale($locale) return static::translator()->setLocale($locale) !== false; } + /** + * Set the current locale to the given, execute the passed function, reset the locale to previous one, + * then return the result of the closure (or null if the closure was void). + * + * @param string $locale locale ex. en + * + * @return mixed + */ + public static function executeWithLocale($locale, $func) + { + $currentLocale = static::getLocale(); + $result = call_user_func($func, static::setLocale($locale) ? static::getLocale() : false, static::translator()); + static::setLocale($currentLocale); + + return $result; + } + + /** + * Returns true if the given locale is internally supported and has short-units support. + * Support is considered enabled if either year, day or hour has a short variant translated. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasShortUnits($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + ( + ($y = $translator->trans('y')) !== 'y' && + $y !== $translator->trans('year') + ) || ( + ($y = $translator->trans('d')) !== 'd' && + $y !== $translator->trans('day') + ) || ( + ($y = $translator->trans('h')) !== 'h' && + $y !== $translator->trans('hour') + ); + }); + } + + /** + * Returns true if the given locale is internally supported and has diff syntax support (ago, from now, before, after). + * Support is considered enabled if the 4 sentences are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasDiffSyntax($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('ago') !== 'ago' && + $translator->trans('from_now') !== 'from_now' && + $translator->trans('before') !== 'before' && + $translator->trans('after') !== 'after'; + }); + } + + /** + * Returns true if the given locale is internally supported and has words for 1-day diff (just now, yesterday, tomorrow). + * Support is considered enabled if the 3 words are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasDiffOneDayWords($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('diff_now') !== 'diff_now' && + $translator->trans('diff_yesterday') !== 'diff_yesterday' && + $translator->trans('diff_tomorrow') !== 'diff_tomorrow'; + }); + } + + /** + * Returns true if the given locale is internally supported and has words for 2-days diff (before yesterday, after tomorrow). + * Support is considered enabled if the 2 words are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasDiffTwoDayWords($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('diff_before_yesterday') !== 'diff_before_yesterday' && + $translator->trans('diff_after_tomorrow') !== 'diff_after_tomorrow'; + }); + } + + /** + * Returns true if the given locale is internally supported and has period syntax support (X times, every X, from X, to X). + * Support is considered enabled if the 4 sentences are translated in the given locale. + * + * @param string $locale locale ex. en + * + * @return bool + */ + public static function localeHasPeriodSyntax($locale) + { + return static::executeWithLocale($locale, function ($newLocale, TranslatorInterface $translator) { + return $newLocale && + $translator->trans('period_recurrences') !== 'period_recurrences' && + $translator->trans('period_interval') !== 'period_interval' && + $translator->trans('period_start_date') !== 'period_start_date' && + $translator->trans('period_end_date') !== 'period_end_date'; + }); + } + + /** + * Returns the list of internally available locales and already loaded custom locales. + * (It will ignore custom translator dynamic loading.) + * + * @return array + */ + public static function getAvailableLocales() + { + $translator = static::translator(); + $locales = array(); + if ($translator instanceof Translator) { + foreach (glob(__DIR__.'/Lang/*.php') as $file) { + $locales[] = substr($file, strrpos($file, '/') + 1, -4); + } + + $locales = array_unique(array_merge($locales, array_keys($translator->getMessages()))); + } + + return $locales; + } + /////////////////////////////////////////////////////////////////// /////////////////////// STRING FORMATTING ///////////////////////// /////////////////////////////////////////////////////////////////// @@ -1588,7 +1855,7 @@ public static function resetToStringFormat() /** * Set the default format used when type juggling a Carbon instance to a string * - * @param string $format + * @param string|Closure $format * * @return void */ @@ -1604,7 +1871,9 @@ public static function setToStringFormat($format) */ public function __toString() { - return $this->format(static::$toStringFormat); + $format = static::$toStringFormat; + + return $this->format($format instanceof Closure ? $format($this) : $format); } /** @@ -1977,7 +2246,7 @@ public function lessThanOrEqualTo($date) * * @param \Carbon\Carbon|\DateTimeInterface|mixed $date1 * @param \Carbon\Carbon|\DateTimeInterface|mixed $date2 - * @param bool $equal Indicates if a > and < comparison should be used or <= or >= + * @param bool $equal Indicates if an equal to comparison should be done * * @return bool */ @@ -1996,6 +2265,13 @@ public function between($date1, $date2, $equal = true) return $this->gt($date1) && $this->lt($date2); } + protected function floatDiffInSeconds($date) + { + $date = $this->resolveCarbon($date); + + return abs($this->diffInRealSeconds($date, false) + ($date->micro - $this->micro) / 1000000); + } + /** * Get the closest date from the instance. * @@ -2006,7 +2282,7 @@ public function between($date1, $date2, $equal = true) */ public function closest($date1, $date2) { - return $this->diffInSeconds($date1) < $this->diffInSeconds($date2) ? $date1 : $date2; + return $this->floatDiffInSeconds($date1) < $this->floatDiffInSeconds($date2) ? $date1 : $date2; } /** @@ -2019,13 +2295,13 @@ public function closest($date1, $date2) */ public function farthest($date1, $date2) { - return $this->diffInSeconds($date1) > $this->diffInSeconds($date2) ? $date1 : $date2; + return $this->floatDiffInSeconds($date1) > $this->floatDiffInSeconds($date2) ? $date1 : $date2; } /** * Get the minimum instance between a given instance (default now) and the current instance. * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date * * @return static */ @@ -2053,7 +2329,7 @@ public function minimum($date = null) /** * Get the maximum instance between a given instance (default now) and the current instance. * - * @param \Carbon\Carbon|\DateTimeInterface|mixed $date + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date * * @return static */ @@ -2079,7 +2355,7 @@ public function maximum($date = null) } /** - * Determines if the instance is a weekday + * Determines if the instance is a weekday. * * @return bool */ @@ -2089,7 +2365,7 @@ public function isWeekday() } /** - * Determines if the instance is a weekend day + * Determines if the instance is a weekend day. * * @return bool */ @@ -2099,7 +2375,7 @@ public function isWeekend() } /** - * Determines if the instance is yesterday + * Determines if the instance is yesterday. * * @return bool */ @@ -2109,7 +2385,7 @@ public function isYesterday() } /** - * Determines if the instance is today + * Determines if the instance is today. * * @return bool */ @@ -2119,7 +2395,7 @@ public function isToday() } /** - * Determines if the instance is tomorrow + * Determines if the instance is tomorrow. * * @return bool */ @@ -2129,7 +2405,7 @@ public function isTomorrow() } /** - * Determines if the instance is within the next week + * Determines if the instance is within the next week. * * @return bool */ @@ -2139,7 +2415,7 @@ public function isNextWeek() } /** - * Determines if the instance is within the last week + * Determines if the instance is within the last week. * * @return bool */ @@ -2149,7 +2425,7 @@ public function isLastWeek() } /** - * Determines if the instance is within the next quarter + * Determines if the instance is within the next quarter. * * @return bool */ @@ -2159,7 +2435,7 @@ public function isNextQuarter() } /** - * Determines if the instance is within the last quarter + * Determines if the instance is within the last quarter. * * @return bool */ @@ -2169,7 +2445,7 @@ public function isLastQuarter() } /** - * Determines if the instance is within the next month + * Determines if the instance is within the next month. * * @return bool */ @@ -2179,7 +2455,7 @@ public function isNextMonth() } /** - * Determines if the instance is within the last month + * Determines if the instance is within the last month. * * @return bool */ @@ -2189,7 +2465,7 @@ public function isLastMonth() } /** - * Determines if the instance is within next year + * Determines if the instance is within next year. * * @return bool */ @@ -2199,7 +2475,7 @@ public function isNextYear() } /** - * Determines if the instance is within the previous year + * Determines if the instance is within the previous year. * * @return bool */ @@ -2209,7 +2485,7 @@ public function isLastYear() } /** - * Determines if the instance is in the future, ie. greater (after) than now + * Determines if the instance is in the future, ie. greater (after) than now. * * @return bool */ @@ -2219,7 +2495,7 @@ public function isFuture() } /** - * Determines if the instance is in the past, ie. less (before) than now + * Determines if the instance is in the past, ie. less (before) than now. * * @return bool */ @@ -2229,7 +2505,7 @@ public function isPast() } /** - * Determines if the instance is a leap year + * Determines if the instance is a leap year. * * @return bool */ @@ -2264,13 +2540,13 @@ public function isSameAs($format, $date = null) { $date = $date ?: static::now($this->tz); - static::expectDateTime($date); + static::expectDateTime($date, 'null'); return $this->format($format) === $date->format($format); } /** - * Determines if the instance is in the current year + * Determines if the instance is in the current year. * * @return bool */ @@ -2292,7 +2568,7 @@ public function isSameYear($date = null) } /** - * Determines if the instance is in the current month + * Determines if the instance is in the current month. * * @return bool */ @@ -2309,23 +2585,27 @@ public function isCurrentQuarter() * * @return bool */ - public function isSameQuarter($date = null, $ofSameYear = false) + public function isSameQuarter($date = null, $ofSameYear = null) { $date = $date ? static::instance($date) : static::now($this->tz); - static::expectDateTime($date); + static::expectDateTime($date, 'null'); + + $ofSameYear = is_null($ofSameYear) ? static::shouldCompareYearWithMonth() : $ofSameYear; return $this->quarter === $date->quarter && (!$ofSameYear || $this->isSameYear($date)); } /** - * Determines if the instance is in the current month + * Determines if the instance is in the current month. + * + * @param bool $ofSameYear Check if it is the same month in the same year. * * @return bool */ - public function isCurrentMonth() + public function isCurrentMonth($ofSameYear = null) { - return $this->isSameMonth(); + return $this->isSameMonth($ofSameYear); } /** @@ -2339,8 +2619,10 @@ public function isCurrentMonth() * * @return bool */ - public function isSameMonth($date = null, $ofSameYear = false) + public function isSameMonth($date = null, $ofSameYear = null) { + $ofSameYear = is_null($ofSameYear) ? static::shouldCompareYearWithMonth() : $ofSameYear; + return $this->isSameAs($ofSameYear ? 'Y-m' : 'm', $date); } @@ -2536,6 +2818,56 @@ public function isLastOfMonth() return $this->day === $this->daysInMonth; } + /** + * Check if the instance is start of day / midnight. + * + * @param bool $checkMicroseconds check time at microseconds precision + * /!\ Warning, this is not reliable with PHP < 7.1.4 + * + * @return bool + */ + public function isStartOfDay($checkMicroseconds = false) + { + return $checkMicroseconds + ? $this->format('H:i:s.u') === '00:00:00.000000' + : $this->format('H:i:s') === '00:00:00'; + } + + /** + * Check if the instance is end of day. + * + * @param bool $checkMicroseconds check time at microseconds precision + * /!\ Warning, this is not reliable with PHP < 7.1.4 + * + * @return bool + */ + public function isEndOfDay($checkMicroseconds = false) + { + return $checkMicroseconds + ? $this->format('H:i:s.u') === '23:59:59.999999' + : $this->format('H:i:s') === '23:59:59'; + } + + /** + * Check if the instance is start of day / midnight. + * + * @return bool + */ + public function isMidnight() + { + return $this->isStartOfDay(); + } + + /** + * Check if the instance is midday. + * + * @return bool + */ + public function isMidday() + { + return $this->format('G:i:s') === static::$midDayAt.':00:00'; + } + /** * Checks if the (date)time string is in a given format. * @@ -3430,16 +3762,91 @@ public function subRealSecond($value = 1) /////////////////////////////////////////////////////////////////// /** - * Get the difference as a CarbonInterval instance + * @param DateInterval $diff + * @param bool $absolute + * @param bool $trimMicroseconds + * + * @return CarbonInterval + */ + protected static function fixDiffInterval(DateInterval $diff, $absolute, $trimMicroseconds) + { + $diff = CarbonInterval::instance($diff, $trimMicroseconds); + + // @codeCoverageIgnoreStart + if (version_compare(PHP_VERSION, '7.1.0-dev', '<')) { + return $diff; + } + + // Work-around for https://bugs.php.net/bug.php?id=77145 + if ($diff->f > 0 && $diff->y === -1 && $diff->m === 11 && $diff->d >= 27 && $diff->h === 23 && $diff->i === 59 && $diff->s === 59) { + $diff->y = 0; + $diff->m = 0; + $diff->d = 0; + $diff->h = 0; + $diff->i = 0; + $diff->s = 0; + $diff->f = (1000000 - round($diff->f * 1000000)) / 1000000; + $diff->invert(); + } elseif ($diff->f < 0) { + if ($diff->s !== 0 || $diff->i !== 0 || $diff->h !== 0 || $diff->d !== 0 || $diff->m !== 0 || $diff->y !== 0) { + $diff->f = (round($diff->f * 1000000) + 1000000) / 1000000; + $diff->s--; + if ($diff->s < 0) { + $diff->s += 60; + $diff->i--; + if ($diff->i < 0) { + $diff->i += 60; + $diff->h--; + if ($diff->h < 0) { + $diff->i += 24; + $diff->d--; + if ($diff->d < 0) { + $diff->d += 30; + $diff->m--; + if ($diff->m < 0) { + $diff->m += 12; + $diff->y--; + } + } + } + } + } + } else { + $diff->f *= -1; + $diff->invert(); + } + } + // @codeCoverageIgnoreEnd + if ($absolute && $diff->invert) { + $diff->invert(); + } + + return $diff; + } + + /** + * Get the difference as a CarbonInterval instance. + * + * Pass false as second argument to get a microseconds-precise interval. Else + * microseconds in the original interval will not be kept. * * @param \Carbon\Carbon|\DateTimeInterface|string|null $date - * @param bool $absolute Get the absolute of the difference + * @param bool $absolute Get the absolute of the difference + * @param bool $trimMicroseconds (true by default) * * @return CarbonInterval */ - public function diffAsCarbonInterval($date = null, $absolute = true) + public function diffAsCarbonInterval($date = null, $absolute = true, $trimMicroseconds = true) { - return CarbonInterval::instance($this->diff($this->resolveCarbon($date), $absolute)); + $from = $this; + $to = $this->resolveCarbon($date); + + if ($trimMicroseconds) { + $from = $from->copy()->startOfSecond(); + $to = $to->copy()->startOfSecond(); + } + + return static::fixDiffInterval($from->diff($to, $absolute), $absolute, $trimMicroseconds); } /** @@ -3649,6 +4056,9 @@ public function diffInRealMinutes($date = null, $absolute = true) public function diffInSeconds($date = null, $absolute = true) { $diff = $this->diff($this->resolveCarbon($date)); + if (!$diff->days && version_compare(PHP_VERSION, '5.4.0-dev', '>=')) { + $diff = static::fixDiffInterval($diff, $absolute, false); + } $value = $diff->days * static::HOURS_PER_DAY * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE + $diff->h * static::MINUTES_PER_HOUR * static::SECONDS_PER_MINUTE + $diff->i * static::SECONDS_PER_MINUTE + @@ -3818,9 +4228,8 @@ public function diffForHumans($other = null, $absolute = false, $short = false, } } } - // Some langs have special pluralization for past and future tense. + // Some languages have special pluralization for past and future tense. $key = $unit.'_'.$transId; - $count = isset($count) ? $count : 1; if ($key !== static::translator()->transChoice($key, $count)) { $time = static::translator()->transChoice($key, $count, array(':count' => $count)); } @@ -3850,7 +4259,7 @@ public function startOfDay() */ public function endOfDay() { - return $this->modify('23.59.59.999999'); + return $this->modify('23:59:59.999999'); } /** @@ -4008,7 +4417,7 @@ public function startOfHour() */ public function endOfHour() { - return $this->setTime($this->hour, 59, 59); + return $this->modify("$this->hour:59:59.999999"); } /** @@ -4028,7 +4437,27 @@ public function startOfMinute() */ public function endOfMinute() { - return $this->setTime($this->hour, $this->minute, 59); + return $this->modify("$this->hour:$this->minute:59.999999"); + } + + /** + * Modify to start of current minute, seconds become 0 + * + * @return static + */ + public function startOfSecond() + { + return $this->modify("$this->hour:$this->minute:$this->second.0"); + } + + /** + * Modify to end of current minute, seconds become 59 + * + * @return static + */ + public function endOfSecond() + { + return $this->modify("$this->hour:$this->minute:$this->second.999999"); } /** @@ -4302,13 +4731,28 @@ public function nthOfYear($nth, $dayOfWeek) /** * Modify the current instance to the average of a given instance (default now) and the current instance. * - * @param \Carbon\Carbon|\DateTimeInterface|null $date + * @param \Carbon\Carbon|\DateTimeInterface|string|null $date * * @return static */ public function average($date = null) { - return $this->addSeconds((int) ($this->diffInSeconds($this->resolveCarbon($date), false) / 2)); + $date = $this->resolveCarbon($date); + $increment = $this->diffInRealSeconds($date, false) / 2; + $intIncrement = floor($increment); + $microIncrement = (int) (($date->micro - $this->micro) / 2 + 1000000 * ($increment - $intIncrement)); + $micro = (int) ($this->micro + $microIncrement); + while ($micro >= 1000000) { + $micro -= 1000000; + $intIncrement++; + } + $this->addSeconds($intIncrement); + + if (version_compare(PHP_VERSION, '7.1.8-dev', '>=')) { + $this->setTime($this->hour, $this->minute, $this->second, $micro); + } + + return $this; } /////////////////////////////////////////////////////////////////// @@ -4409,8 +4853,6 @@ public static function macro($name, $macro) * * @param object $mixin * - * @throws \ReflectionException - * * @return void */ public static function mixin($mixin) diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php b/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php index 9f8ab0439..0bd9ab9df 100644 --- a/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php +++ b/vendor/nesbot/carbon/src/Carbon/CarbonInterval.php @@ -11,8 +11,12 @@ namespace Carbon; +use Closure; use DateInterval; use InvalidArgumentException; +use ReflectionClass; +use ReflectionFunction; +use ReflectionMethod; use Symfony\Component\Translation\TranslatorInterface; /** @@ -29,6 +33,14 @@ * @property int $seconds Total seconds of the current interval. * @property-read int $dayzExcludeWeeks Total days remaining in the final week of the current instance (days % 7). * @property-read int $daysExcludeWeeks alias of dayzExcludeWeeks + * @property-read float $totalYears Number of years equivalent to the interval. + * @property-read float $totalMonths Number of months equivalent to the interval. + * @property-read float $totalWeeks Number of weeks equivalent to the interval. + * @property-read float $totalDays Number of days equivalent to the interval. + * @property-read float $totalDayz Alias for totalDays. + * @property-read float $totalHours Number of hours equivalent to the interval. + * @property-read float $totalMinutes Number of minutes equivalent to the interval. + * @property-read float $totalSeconds Number of seconds equivalent to the interval. * * @method static CarbonInterval years($years = 1) Create instance specifying a number of years. * @method static CarbonInterval year($years = 1) Alias for years() @@ -82,12 +94,77 @@ class CarbonInterval extends DateInterval */ protected static $translator; + /** + * @var array|null + */ + protected static $cascadeFactors; + + /** + * @var array|null + */ + private static $flipCascadeFactors; + + /** + * The registered macros. + * + * @var array + */ + protected static $macros = array(); + /** * Before PHP 5.4.20/5.5.4 instead of FALSE days will be set to -99999 when the interval instance * was created by DateTime::diff(). */ const PHP_DAYS_FALSE = -99999; + /** + * Mapping of units and factors for cascading. + * + * Should only be modified by changing the factors or referenced constants. + * + * @return array + */ + public static function getCascadeFactors() + { + return static::$cascadeFactors ?: array( + 'minutes' => array(Carbon::SECONDS_PER_MINUTE, 'seconds'), + 'hours' => array(Carbon::MINUTES_PER_HOUR, 'minutes'), + 'dayz' => array(Carbon::HOURS_PER_DAY, 'hours'), + 'months' => array(Carbon::DAYS_PER_WEEK * Carbon::WEEKS_PER_MONTH, 'dayz'), + 'years' => array(Carbon::MONTHS_PER_YEAR, 'months'), + ); + } + + private static function standardizeUnit($unit) + { + $unit = rtrim($unit, 'sz').'s'; + + return $unit === 'days' ? 'dayz' : $unit; + } + + private static function getFlipCascadeFactors() + { + if (!self::$flipCascadeFactors) { + self::$flipCascadeFactors = array(); + foreach (static::getCascadeFactors() as $to => $tuple) { + list($factor, $from) = $tuple; + + self::$flipCascadeFactors[self::standardizeUnit($from)] = array(self::standardizeUnit($to), $factor); + } + } + + return self::$flipCascadeFactors; + } + + /** + * @param array $cascadeFactors + */ + public static function setCascadeFactors(array $cascadeFactors) + { + self::$flipCascadeFactors = null; + static::$cascadeFactors = $cascadeFactors; + } + /** * Determine if the interval was created via DateTime:diff() or not. * @@ -126,7 +203,7 @@ public function __construct($years = 1, $months = null, $weeks = null, $days = n $spec .= $months > 0 ? $months.static::PERIOD_MONTHS : ''; $specDays = 0; - $specDays += $weeks > 0 ? $weeks * Carbon::DAYS_PER_WEEK : 0; + $specDays += $weeks > 0 ? $weeks * static::getDaysPerWeek() : 0; $specDays += $days > 0 ? $days : 0; $spec .= $specDays > 0 ? $specDays.static::PERIOD_DAYS : ''; @@ -147,6 +224,69 @@ public function __construct($years = 1, $months = null, $weeks = null, $days = n parent::__construct($spec); } + /** + * Returns the factor for a given source-to-target couple. + * + * @param string $source + * @param string $target + * + * @return int|null + */ + public static function getFactor($source, $target) + { + $source = self::standardizeUnit($source); + $target = self::standardizeUnit($target); + $factors = static::getFlipCascadeFactors(); + if (isset($factors[$source])) { + list($to, $factor) = $factors[$source]; + if ($to === $target) { + return $factor; + } + } + + return null; + } + + /** + * Returns current config for days per week. + * + * @return int + */ + public static function getDaysPerWeek() + { + return static::getFactor('dayz', 'weeks') ?: Carbon::DAYS_PER_WEEK; + } + + /** + * Returns current config for hours per day. + * + * @return int + */ + public static function getHoursPerDay() + { + return static::getFactor('hours', 'dayz') ?: Carbon::HOURS_PER_DAY; + } + + /** + * Returns current config for minutes per hour. + * + * @return int + */ + public static function getMinutesPerHours() + { + return static::getFactor('minutes', 'hours') ?: Carbon::MINUTES_PER_HOUR; + } + + /** + * Returns current config for seconds per minute. + * + * @return int + */ + public static function getSecondsPerMinutes() + { + return static::getFactor('seconds', 'minutes') ?: Carbon::SECONDS_PER_MINUTE; + } + /** * Create a new CarbonInterval instance from specific values. * This is an alias for the constructor that allows better fluent @@ -168,6 +308,19 @@ public static function create($years = 1, $months = null, $weeks = null, $days = return new static($years, $months, $weeks, $days, $hours, $minutes, $seconds); } + /** + * Get a copy of the instance. + * + * @return static + */ + public function copy() + { + $date = new static($this->spec()); + $date->invert = $this->invert; + + return $date; + } + /** * Provide static helpers to create instances. Allows CarbonInterval::years(3). * @@ -213,10 +366,16 @@ public static function __callStatic($name, $args) case 'second': return new static(null, null, null, null, null, null, $arg); } + + if (static::hasMacro($name)) { + return call_user_func_array( + array(new static(0), $name), $args + ); + } } /** - * Creates a CarbonInterval from string + * Creates a CarbonInterval from string. * * Format: * @@ -278,8 +437,8 @@ public static function fromString($intervalDefinition) case 'weeks': case 'w': $weeks += $intValue; - if ($fraction != 0) { - $parts[] = array(null, $fraction * Carbon::DAYS_PER_WEEK, 'd'); + if ($fraction) { + $parts[] = array(null, $fraction * static::getDaysPerWeek(), 'd'); } break; @@ -287,8 +446,8 @@ public static function fromString($intervalDefinition) case 'days': case 'd': $days += $intValue; - if ($fraction != 0) { - $parts[] = array(null, $fraction * Carbon::HOURS_PER_DAY, 'h'); + if ($fraction) { + $parts[] = array(null, $fraction * static::getHoursPerDay(), 'h'); } break; @@ -296,8 +455,8 @@ public static function fromString($intervalDefinition) case 'hours': case 'h': $hours += $intValue; - if ($fraction != 0) { - $parts[] = array(null, $fraction * Carbon::MINUTES_PER_HOUR, 'm'); + if ($fraction) { + $parts[] = array(null, $fraction * static::getMinutesPerHours(), 'm'); } break; @@ -305,8 +464,8 @@ public static function fromString($intervalDefinition) case 'minutes': case 'm': $minutes += $intValue; - if ($fraction != 0) { - $seconds += round($fraction * Carbon::SECONDS_PER_MINUTE); + if ($fraction) { + $seconds += round($fraction * static::getSecondsPerMinutes()); } break; @@ -331,18 +490,60 @@ public static function fromString($intervalDefinition) * DateInterval objects created from DateTime::diff() as you can't externally * set the $days field. * + * Pass false as second argument to get a microseconds-precise interval. Else + * microseconds in the original interval will not be kept. + * * @param DateInterval $di + * @param bool $trimMicroseconds (true by default) * * @return static */ - public static function instance(DateInterval $di) + public static function instance(DateInterval $di, $trimMicroseconds = true) { + $microseconds = $trimMicroseconds || version_compare(PHP_VERSION, '7.1.0-dev', '<') ? 0 : $di->f; $instance = new static(static::getDateIntervalSpec($di)); + if ($microseconds) { + $instance->f = $microseconds; + } $instance->invert = $di->invert; + foreach (array('y', 'm', 'd', 'h', 'i', 's') as $unit) { + if ($di->$unit < 0) { + $instance->$unit *= -1; + } + } return $instance; } + /** + * Make a CarbonInterval instance from given variable if possible. + * + * Always return a new instance. Parse only strings and only these likely to be intervals (skip dates + * and recurrences). Throw an exception for invalid format, but otherwise return null. + * + * @param mixed $var + * + * @return static|null + */ + public static function make($var) + { + if ($var instanceof DateInterval) { + return static::instance($var); + } + + if (is_string($var)) { + $var = trim($var); + + if (substr($var, 0, 1) === 'P') { + return new static($var); + } + + if (preg_match('/^(?:\h*\d+(?:\.\d+)?\h*[a-z]+)+$/i', $var)) { + return static::fromString($var); + } + } + } + /////////////////////////////////////////////////////////////////// /////////////////////// LOCALIZATION ////////////////////////////// /////////////////////////////////////////////////////////////////// @@ -362,7 +563,7 @@ protected static function translator() } /** - * Get the translator instance in use + * Get the translator instance in use. * * @return \Symfony\Component\Translation\TranslatorInterface */ @@ -372,7 +573,7 @@ public static function getTranslator() } /** - * Set the translator instance to use + * Set the translator instance to use. * * @param TranslatorInterface $translator */ @@ -382,7 +583,7 @@ public static function setTranslator(TranslatorInterface $translator) } /** - * Get the current translator locale + * Get the current translator locale. * * @return string */ @@ -392,7 +593,7 @@ public static function getLocale() } /** - * Set the current translator locale + * Set the current translator locale. * * @param string $locale */ @@ -406,16 +607,20 @@ public static function setLocale($locale) /////////////////////////////////////////////////////////////////// /** - * Get a part of the CarbonInterval object + * Get a part of the CarbonInterval object. * * @param string $name * * @throws \InvalidArgumentException * - * @return int + * @return int|float */ public function __get($name) { + if (substr($name, 0, 5) === 'total') { + return $this->total(substr($name, 5)); + } + switch ($name) { case 'years': return $this->y; @@ -436,11 +641,11 @@ public function __get($name) return $this->s; case 'weeks': - return (int) floor($this->d / Carbon::DAYS_PER_WEEK); + return (int) floor($this->d / static::getDaysPerWeek()); case 'daysExcludeWeeks': case 'dayzExcludeWeeks': - return $this->d % Carbon::DAYS_PER_WEEK; + return $this->d % static::getDaysPerWeek(); default: throw new InvalidArgumentException(sprintf("Unknown getter '%s'", $name)); @@ -448,7 +653,7 @@ public function __get($name) } /** - * Set a part of the CarbonInterval object + * Set a part of the CarbonInterval object. * * @param string $name * @param int $val @@ -467,7 +672,7 @@ public function __set($name, $val) break; case 'weeks': - $this->d = $val * Carbon::DAYS_PER_WEEK; + $this->d = $val * static::getDaysPerWeek(); break; case 'dayz': @@ -498,11 +703,94 @@ public function __set($name, $val) */ public function weeksAndDays($weeks, $days) { - $this->dayz = ($weeks * Carbon::DAYS_PER_WEEK) + $days; + $this->dayz = ($weeks * static::getDaysPerWeek()) + $days; return $this; } + /** + * Register a custom macro. + * + * @param string $name + * @param object|callable $macro + * + * @return void + */ + public static function macro($name, $macro) + { + static::$macros[$name] = $macro; + } + + /** + * Register macros from a mixin object. + * + * @param object $mixin + * + * @throws \ReflectionException + * + * @return void + */ + public static function mixin($mixin) + { + $reflection = new ReflectionClass($mixin); + + $methods = $reflection->getMethods( + ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED + ); + + foreach ($methods as $method) { + $method->setAccessible(true); + + static::macro($method->name, $method->invoke($mixin)); + } + } + + /** + * Check if macro is registered. + * + * @param string $name + * + * @return bool + */ + public static function hasMacro($name) + { + return isset(static::$macros[$name]); + } + + /** + * Call given macro. + * + * @param string $name + * @param array $parameters + * + * @return mixed + */ + protected function callMacro($name, $parameters) + { + $macro = static::$macros[$name]; + + $reflection = new ReflectionFunction($macro); + + $reflectionParameters = $reflection->getParameters(); + + $expectedCount = count($reflectionParameters); + $actualCount = count($parameters); + + if ($expectedCount > $actualCount && $reflectionParameters[$expectedCount - 1]->name === 'self') { + for ($i = $actualCount; $i < $expectedCount - 1; $i++) { + $parameters[] = $reflectionParameters[$i]->getDefaultValue(); + } + + $parameters[] = $this; + } + + if ($macro instanceof Closure && method_exists($macro, 'bindTo')) { + $macro = $macro->bindTo($this, get_class($this)); + } + + return call_user_func_array($macro, $parameters); + } + /** * Allow fluent calls on the setters... CarbonInterval::years(3)->months(5)->day(). * @@ -516,6 +804,10 @@ public function weeksAndDays($weeks, $days) */ public function __call($name, $args) { + if (static::hasMacro($name)) { + return $this->callMacro($name, $args); + } + $arg = count($args) === 0 ? 1 : $args[0]; switch ($name) { @@ -531,7 +823,7 @@ public function __call($name, $args) case 'weeks': case 'week': - $this->dayz = $arg * Carbon::DAYS_PER_WEEK; + $this->dayz = $arg * static::getDaysPerWeek(); break; case 'days': @@ -562,24 +854,27 @@ public function __call($name, $args) /** * Get the current interval in a human readable format in the current locale. * + * @param bool $short (false by default), returns short units if true + * * @return string */ - public function forHumans() + public function forHumans($short = false) { $periods = array( - 'year' => $this->years, - 'month' => $this->months, - 'week' => $this->weeks, - 'day' => $this->daysExcludeWeeks, - 'hour' => $this->hours, - 'minute' => $this->minutes, - 'second' => $this->seconds, + 'year' => array('y', $this->years), + 'month' => array('m', $this->months), + 'week' => array('w', $this->weeks), + 'day' => array('d', $this->daysExcludeWeeks), + 'hour' => array('h', $this->hours), + 'minute' => array('min', $this->minutes), + 'second' => array('s', $this->seconds), ); $parts = array(); - foreach ($periods as $unit => $count) { + foreach ($periods as $unit => $options) { + list($shortUnit, $count) = $options; if ($count > 0) { - $parts[] = static::translator()->transChoice($unit, $count, array(':count' => $count)); + $parts[] = static::translator()->transChoice($short ? $shortUnit : $unit, $count, array(':count' => $count)); } } @@ -597,7 +892,31 @@ public function __toString() } /** - * Add the passed interval to the current instance + * Convert the interval to a CarbonPeriod. + * + * @return CarbonPeriod + */ + public function toPeriod() + { + return CarbonPeriod::createFromArray( + array_merge(array($this), func_get_args()) + ); + } + + /** + * Invert the interval. + * + * @return $this + */ + public function invert() + { + $this->invert = $this->invert ? 0 : 1; + + return $this; + } + + /** + * Add the passed interval to the current instance. * * @param DateInterval $interval * @@ -605,7 +924,7 @@ public function __toString() */ public function add(DateInterval $interval) { - $sign = $interval->invert === 1 ? -1 : 1; + $sign = ($this->invert === 1) !== ($interval->invert === 1) ? -1 : 1; if (static::wasCreatedFromDiff($interval)) { $this->dayz += $interval->days * $sign; @@ -618,6 +937,18 @@ public function add(DateInterval $interval) $this->seconds += $interval->s * $sign; } + if (($this->years || $this->months || $this->dayz || $this->hours || $this->minutes || $this->seconds) && + $this->years <= 0 && $this->months <= 0 && $this->dayz <= 0 && $this->hours <= 0 && $this->minutes <= 0 && $this->seconds <= 0 + ) { + $this->years *= -1; + $this->months *= -1; + $this->dayz *= -1; + $this->hours *= -1; + $this->minutes *= -1; + $this->seconds *= -1; + $this->invert(); + } + return $this; } @@ -635,18 +966,18 @@ public function times($factor) $factor = -$factor; } - $this->years = round($this->years * $factor); - $this->months = round($this->months * $factor); - $this->dayz = round($this->dayz * $factor); - $this->hours = round($this->hours * $factor); - $this->minutes = round($this->minutes * $factor); - $this->seconds = round($this->seconds * $factor); + $this->years = (int) round($this->years * $factor); + $this->months = (int) round($this->months * $factor); + $this->dayz = (int) round($this->dayz * $factor); + $this->hours = (int) round($this->hours * $factor); + $this->minutes = (int) round($this->minutes * $factor); + $this->seconds = (int) round($this->seconds * $factor); return $this; } /** - * Get the interval_spec string of a date interval + * Get the interval_spec string of a date interval. * * @param DateInterval $interval * @@ -655,15 +986,15 @@ public function times($factor) public static function getDateIntervalSpec(DateInterval $interval) { $date = array_filter(array( - static::PERIOD_YEARS => $interval->y, - static::PERIOD_MONTHS => $interval->m, - static::PERIOD_DAYS => $interval->d, + static::PERIOD_YEARS => abs($interval->y), + static::PERIOD_MONTHS => abs($interval->m), + static::PERIOD_DAYS => abs($interval->d), )); $time = array_filter(array( - static::PERIOD_HOURS => $interval->h, - static::PERIOD_MINUTES => $interval->i, - static::PERIOD_SECONDS => $interval->s, + static::PERIOD_HOURS => abs($interval->h), + static::PERIOD_MINUTES => abs($interval->i), + static::PERIOD_SECONDS => abs($interval->s), )); $specString = static::PERIOD_PREFIX; @@ -683,7 +1014,7 @@ public static function getDateIntervalSpec(DateInterval $interval) } /** - * Get the interval_spec string + * Get the interval_spec string. * * @return string */ @@ -693,7 +1024,7 @@ public function spec() } /** - * Comparing 2 date intervals + * Comparing 2 date intervals. * * @param DateInterval $a * @param DateInterval $b @@ -708,7 +1039,8 @@ public static function compareDateIntervals(DateInterval $a, DateInterval $b) if ($current < $passed) { return -1; - } elseif ($current > $passed) { + } + if ($current > $passed) { return 1; } @@ -716,7 +1048,7 @@ public static function compareDateIntervals(DateInterval $a, DateInterval $b) } /** - * Comparing with passed interval + * Comparing with passed interval. * * @param DateInterval $interval * @@ -726,4 +1058,98 @@ public function compare(DateInterval $interval) { return static::compareDateIntervals($this, $interval); } + + /** + * Convert overflowed values into bigger units. + * + * @return $this + */ + public function cascade() + { + foreach (static::getFlipCascadeFactors() as $source => $cascade) { + list($target, $factor) = $cascade; + + if ($source === 'dayz' && $target === 'weeks') { + continue; + } + + $value = $this->$source; + $this->$source = $modulo = $value % $factor; + $this->$target += ($value - $modulo) / $factor; + } + + return $this; + } + + /** + * Get amount of given unit equivalent to the interval. + * + * @param string $unit + * + * @throws \InvalidArgumentException + * + * @return float + */ + public function total($unit) + { + $realUnit = $unit = strtolower($unit); + + if (in_array($unit, array('days', 'weeks'))) { + $realUnit = 'dayz'; + } elseif (!in_array($unit, array('seconds', 'minutes', 'hours', 'dayz', 'months', 'years'))) { + throw new InvalidArgumentException("Unknown unit '$unit'."); + } + + $result = 0; + $cumulativeFactor = 0; + $unitFound = false; + + foreach (static::getFlipCascadeFactors() as $source => $cascade) { + list($target, $factor) = $cascade; + + if ($source === $realUnit) { + $unitFound = true; + $result += $this->$source; + $cumulativeFactor = 1; + } + + if ($factor === false) { + if ($unitFound) { + break; + } + + $result = 0; + $cumulativeFactor = 0; + + continue; + } + + if ($target === $realUnit) { + $unitFound = true; + } + + if ($cumulativeFactor) { + $cumulativeFactor *= $factor; + $result += $this->$target * $cumulativeFactor; + + continue; + } + + $result = ($result + $this->$source) / $factor; + } + + if (isset($target) && !$cumulativeFactor) { + $result += $this->$target; + } + + if (!$unitFound) { + throw new \InvalidArgumentException("Unit $unit have no configuration to get total from other units."); + } + + if ($unit === 'weeks') { + return $result / static::getDaysPerWeek(); + } + + return $result; + } } diff --git a/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php b/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php new file mode 100644 index 000000000..ae52c0b8b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/CarbonPeriod.php @@ -0,0 +1,1445 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Carbon; + +use BadMethodCallException; +use Closure; +use Countable; +use DateInterval; +use DateTime; +use DateTimeInterface; +use InvalidArgumentException; +use Iterator; +use ReflectionClass; +use ReflectionFunction; +use ReflectionMethod; +use RuntimeException; + +/** + * Substitution of DatePeriod with some modifications and many more features. + * Fully compatible with PHP 5.3+! + * + * @method static CarbonPeriod start($date, $inclusive = null) Create instance specifying start date. + * @method static CarbonPeriod since($date, $inclusive = null) Alias for start(). + * @method static CarbonPeriod sinceNow($inclusive = null) Create instance with start date set to now. + * @method static CarbonPeriod end($date = null, $inclusive = null) Create instance specifying end date. + * @method static CarbonPeriod until($date = null, $inclusive = null) Alias for end(). + * @method static CarbonPeriod untilNow($inclusive = null) Create instance with end date set to now. + * @method static CarbonPeriod dates($start, $end = null) Create instance with start and end date. + * @method static CarbonPeriod between($start, $end = null) Create instance with start and end date. + * @method static CarbonPeriod recurrences($recurrences = null) Create instance with maximum number of recurrences. + * @method static CarbonPeriod times($recurrences = null) Alias for recurrences(). + * @method static CarbonPeriod options($options = null) Create instance with options. + * @method static CarbonPeriod toggle($options, $state = null) Create instance with options toggled on or off. + * @method static CarbonPeriod filter($callback, $name = null) Create instance with filter added to the stack. + * @method static CarbonPeriod push($callback, $name = null) Alias for filter(). + * @method static CarbonPeriod prepend($callback, $name = null) Create instance with filter prepened to the stack. + * @method static CarbonPeriod filters(array $filters) Create instance with filters stack. + * @method static CarbonPeriod interval($interval) Create instance with given date interval. + * @method static CarbonPeriod each($interval) Create instance with given date interval. + * @method static CarbonPeriod every($interval) Create instance with given date interval. + * @method static CarbonPeriod step($interval) Create instance with given date interval. + * @method static CarbonPeriod stepBy($interval) Create instance with given date interval. + * @method static CarbonPeriod invert() Create instance with inverted date interval. + * @method static CarbonPeriod years($years = 1) Create instance specifying a number of years for date interval. + * @method static CarbonPeriod year($years = 1) Alias for years(). + * @method static CarbonPeriod months($months = 1) Create instance specifying a number of months for date interval. + * @method static CarbonPeriod month($months = 1) Alias for months(). + * @method static CarbonPeriod weeks($weeks = 1) Create instance specifying a number of weeks for date interval. + * @method static CarbonPeriod week($weeks = 1) Alias for weeks(). + * @method static CarbonPeriod days($days = 1) Create instance specifying a number of days for date interval. + * @method static CarbonPeriod dayz($days = 1) Alias for days(). + * @method static CarbonPeriod day($days = 1) Alias for days(). + * @method static CarbonPeriod hours($hours = 1) Create instance specifying a number of hours for date interval. + * @method static CarbonPeriod hour($hours = 1) Alias for hours(). + * @method static CarbonPeriod minutes($minutes = 1) Create instance specifying a number of minutes for date interval. + * @method static CarbonPeriod minute($minutes = 1) Alias for minutes(). + * @method static CarbonPeriod seconds($seconds = 1) Create instance specifying a number of seconds for date interval. + * @method static CarbonPeriod second($seconds = 1) Alias for seconds(). + * @method CarbonPeriod start($date, $inclusive = null) Change the period start date. + * @method CarbonPeriod since($date, $inclusive = null) Alias for start(). + * @method CarbonPeriod sinceNow($inclusive = null) Change the period start date to now. + * @method CarbonPeriod end($date = null, $inclusive = null) Change the period end date. + * @method CarbonPeriod until($date = null, $inclusive = null) Alias for end(). + * @method CarbonPeriod untilNow($inclusive = null) Change the period end date to now. + * @method CarbonPeriod dates($start, $end = null) Change the period start and end date. + * @method CarbonPeriod recurrences($recurrences = null) Change the maximum number of recurrences. + * @method CarbonPeriod times($recurrences = null) Alias for recurrences(). + * @method CarbonPeriod options($options = null) Change the period options. + * @method CarbonPeriod toggle($options, $state = null) Toggle given options on or off. + * @method CarbonPeriod filter($callback, $name = null) Add a filter to the stack. + * @method CarbonPeriod push($callback, $name = null) Alias for filter(). + * @method CarbonPeriod prepend($callback, $name = null) Prepend a filter to the stack. + * @method CarbonPeriod filters(array $filters = array()) Set filters stack. + * @method CarbonPeriod interval($interval) Change the period date interval. + * @method CarbonPeriod invert() Invert the period date interval. + * @method CarbonPeriod years($years = 1) Set the years portion of the date interval. + * @method CarbonPeriod year($years = 1) Alias for years(). + * @method CarbonPeriod months($months = 1) Set the months portion of the date interval. + * @method CarbonPeriod month($months = 1) Alias for months(). + * @method CarbonPeriod weeks($weeks = 1) Set the weeks portion of the date interval. + * @method CarbonPeriod week($weeks = 1) Alias for weeks(). + * @method CarbonPeriod days($days = 1) Set the days portion of the date interval. + * @method CarbonPeriod dayz($days = 1) Alias for days(). + * @method CarbonPeriod day($days = 1) Alias for days(). + * @method CarbonPeriod hours($hours = 1) Set the hours portion of the date interval. + * @method CarbonPeriod hour($hours = 1) Alias for hours(). + * @method CarbonPeriod minutes($minutes = 1) Set the minutes portion of the date interval. + * @method CarbonPeriod minute($minutes = 1) Alias for minutes(). + * @method CarbonPeriod seconds($seconds = 1) Set the seconds portion of the date interval. + * @method CarbonPeriod second($seconds = 1) Alias for seconds(). + */ +class CarbonPeriod implements Iterator, Countable +{ + /** + * Built-in filters. + * + * @var string + */ + const RECURRENCES_FILTER = 'Carbon\CarbonPeriod::filterRecurrences'; + const END_DATE_FILTER = 'Carbon\CarbonPeriod::filterEndDate'; + + /** + * Special value which can be returned by filters to end iteration. Also a filter. + * + * @var string + */ + const END_ITERATION = 'Carbon\CarbonPeriod::endIteration'; + + /** + * Available options. + * + * @var int + */ + const EXCLUDE_START_DATE = 1; + const EXCLUDE_END_DATE = 2; + + /** + * Number of maximum attempts before giving up on finding next valid date. + * + * @var int + */ + const NEXT_MAX_ATTEMPTS = 1000; + + /** + * The registered macros. + * + * @var array + */ + protected static $macros = array(); + + /** + * Underlying date interval instance. Always present, one day by default. + * + * @var CarbonInterval + */ + protected $dateInterval; + + /** + * Whether current date interval was set by default. + * + * @var bool + */ + protected $isDefaultInterval; + + /** + * The filters stack. + * + * @var array + */ + protected $filters = array(); + + /** + * Period start date. Applied on rewind. Always present, now by default. + * + * @var Carbon + */ + protected $startDate; + + /** + * Period end date. For inverted interval should be before the start date. Applied via a filter. + * + * @var Carbon|null + */ + protected $endDate; + + /** + * Limit for number of recurrences. Applied via a filter. + * + * @var int|null + */ + protected $recurrences; + + /** + * Iteration options. + * + * @var int + */ + protected $options; + + /** + * Index of current date. Always sequential, even if some dates are skipped by filters. + * Equal to null only before the first iteration. + * + * @var int + */ + protected $key; + + /** + * Current date. May temporarily hold unaccepted value when looking for a next valid date. + * Equal to null only before the first iteration. + * + * @var Carbon + */ + protected $current; + + /** + * Timezone of current date. Taken from the start date. + * + * @var \DateTimeZone|null + */ + protected $timezone; + + /** + * The cached validation result for current date. + * + * @var bool|string|null + */ + protected $validationResult; + + /** + * Create a new instance. + * + * @return static + */ + public static function create() + { + return static::createFromArray(func_get_args()); + } + + /** + * Create a new instance from an array of parameters. + * + * @param array $params + * + * @return static + */ + public static function createFromArray(array $params) + { + // PHP 5.3 equivalent of new static(...$params). + $reflection = new ReflectionClass(get_class()); + /** @var static $instance */ + $instance = $reflection->newInstanceArgs($params); + + return $instance; + } + + /** + * Create CarbonPeriod from ISO 8601 string. + * + * @param string $iso + * @param int|null $options + * + * @return static + */ + public static function createFromIso($iso, $options = null) + { + $params = static::parseIso8601($iso); + + $instance = static::createFromArray($params); + + if ($options !== null) { + $instance->setOptions($options); + } + + return $instance; + } + + /** + * Return whether given interval contains non zero value of any time unit. + * + * @param \DateInterval $interval + * + * @return bool + */ + protected static function intervalHasTime(DateInterval $interval) + { + // The array_key_exists and get_object_vars are used as a workaround to check microsecond support. + // Both isset and property_exists will fail on PHP 7.0.14 - 7.0.21 due to the following bug: + // https://bugs.php.net/bug.php?id=74852 + return $interval->h || $interval->i || $interval->s || array_key_exists('f', get_object_vars($interval)) && $interval->f; + } + + /** + * Return whether given callable is a string pointing to one of Carbon's is* methods + * and should be automatically converted to a filter callback. + * + * @param callable $callable + * + * @return bool + */ + protected static function isCarbonPredicateMethod($callable) + { + return is_string($callable) && substr($callable, 0, 2) === 'is' && (method_exists('Carbon\Carbon', $callable) || Carbon::hasMacro($callable)); + } + + /** + * Return whether given variable is an ISO 8601 specification. + * + * Note: Check is very basic, as actual validation will be done later when parsing. + * We just want to ensure that variable is not any other type of a valid parameter. + * + * @param mixed $var + * + * @return bool + */ + protected static function isIso8601($var) + { + if (!is_string($var)) { + return false; + } + + // Match slash but not within a timezone name. + $part = '[a-z]+(?:[_-][a-z]+)*'; + + preg_match("#\b$part/$part\b|(/)#i", $var, $match); + + return isset($match[1]); + } + + /** + * Parse given ISO 8601 string into an array of arguments. + * + * @param string $iso + * + * @return array + */ + protected static function parseIso8601($iso) + { + $result = array(); + + $interval = null; + $start = null; + $end = null; + + foreach (explode('/', $iso) as $key => $part) { + if ($key === 0 && preg_match('/^R([0-9]*)$/', $part, $match)) { + $parsed = strlen($match[1]) ? (int) $match[1] : null; + } elseif ($interval === null && $parsed = CarbonInterval::make($part)) { + $interval = $part; + } elseif ($start === null && $parsed = Carbon::make($part)) { + $start = $part; + } elseif ($end === null && $parsed = Carbon::make(static::addMissingParts($start, $part))) { + $end = $part; + } else { + throw new InvalidArgumentException("Invalid ISO 8601 specification: $iso."); + } + + $result[] = $parsed; + } + + return $result; + } + + /** + * Add missing parts of the target date from the soure date. + * + * @param string $source + * @param string $target + * + * @return string + */ + protected static function addMissingParts($source, $target) + { + $pattern = '/'.preg_replace('/[0-9]+/', '[0-9]+', preg_quote($target, '/')).'$/'; + + $result = preg_replace($pattern, $target, $source, 1, $count); + + return $count ? $result : $target; + } + + /** + * Register a custom macro. + * + * @param string $name + * @param object|callable $macro + * + * @return void + */ + public static function macro($name, $macro) + { + static::$macros[$name] = $macro; + } + + /** + * Register macros from a mixin object. + * + * @param object $mixin + * + * @throws \ReflectionException + * + * @return void + */ + public static function mixin($mixin) + { + $reflection = new ReflectionClass($mixin); + + $methods = $reflection->getMethods( + ReflectionMethod::IS_PUBLIC | ReflectionMethod::IS_PROTECTED + ); + + foreach ($methods as $method) { + $method->setAccessible(true); + + static::macro($method->name, $method->invoke($mixin)); + } + } + + /** + * Check if macro is registered. + * + * @param string $name + * + * @return bool + */ + public static function hasMacro($name) + { + return isset(static::$macros[$name]); + } + + /** + * Provide static proxy for instance aliases. + * + * @param string $method + * @param array $parameters + * + * @return mixed + */ + public static function __callStatic($method, $parameters) + { + return call_user_func_array( + array(new static, $method), $parameters + ); + } + + /** + * CarbonPeriod constructor. + * + * @throws InvalidArgumentException + */ + public function __construct() + { + // Parse and assign arguments one by one. First argument may be an ISO 8601 spec, + // which will be first parsed into parts and then processed the same way. + $arguments = func_get_args(); + + if (count($arguments) && static::isIso8601($iso = $arguments[0])) { + array_splice($arguments, 0, 1, static::parseIso8601($iso)); + } + + foreach ($arguments as $argument) { + if ($this->dateInterval === null && $parsed = CarbonInterval::make($argument)) { + $this->setDateInterval($parsed); + } elseif ($this->startDate === null && $parsed = Carbon::make($argument)) { + $this->setStartDate($parsed); + } elseif ($this->endDate === null && $parsed = Carbon::make($argument)) { + $this->setEndDate($parsed); + } elseif ($this->recurrences === null && $this->endDate === null && is_numeric($argument)) { + $this->setRecurrences($argument); + } elseif ($this->options === null && (is_int($argument) || $argument === null)) { + $this->setOptions($argument); + } else { + throw new InvalidArgumentException('Invalid constructor parameters.'); + } + } + + if ($this->startDate === null) { + $this->setStartDate(Carbon::now()); + } + + if ($this->dateInterval === null) { + $this->setDateInterval(CarbonInterval::day()); + + $this->isDefaultInterval = true; + } + + if ($this->options === null) { + $this->setOptions(0); + } + } + + /** + * Change the period date interval. + * + * @param DateInterval|string $interval + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setDateInterval($interval) + { + if (!$interval = CarbonInterval::make($interval)) { + throw new InvalidArgumentException('Invalid interval.'); + } + + if ($interval->spec() === 'PT0S') { + throw new InvalidArgumentException('Empty interval is not accepted.'); + } + + $this->dateInterval = $interval; + + $this->isDefaultInterval = false; + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Invert the period date interval. + * + * @return $this + */ + public function invertDateInterval() + { + $interval = $this->dateInterval->invert(); + + return $this->setDateInterval($interval); + } + + /** + * Set start and end date. + * + * @param DateTime|DateTimeInterface|string $start + * @param DateTime|DateTimeInterface|string|null $end + * + * @return $this + */ + public function setDates($start, $end) + { + $this->setStartDate($start); + $this->setEndDate($end); + + return $this; + } + + /** + * Change the period options. + * + * @param int|null $options + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setOptions($options) + { + if (!is_int($options) && !is_null($options)) { + throw new InvalidArgumentException('Invalid options.'); + } + + $this->options = $options ?: 0; + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Get the period options. + * + * @return int + */ + public function getOptions() + { + return $this->options; + } + + /** + * Toggle given options on or off. + * + * @param int $options + * @param bool|null $state + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function toggleOptions($options, $state = null) + { + if ($state === null) { + $state = ($this->options & $options) !== $options; + } + + return $this->setOptions($state ? + $this->options | $options : + $this->options & ~$options + ); + } + + /** + * Toggle EXCLUDE_START_DATE option. + * + * @param bool $state + * + * @return $this + */ + public function excludeStartDate($state = true) + { + return $this->toggleOptions(static::EXCLUDE_START_DATE, $state); + } + + /** + * Toggle EXCLUDE_END_DATE option. + * + * @param bool $state + * + * @return $this + */ + public function excludeEndDate($state = true) + { + return $this->toggleOptions(static::EXCLUDE_END_DATE, $state); + } + + /** + * Get the underlying date interval. + * + * @return CarbonInterval + */ + public function getDateInterval() + { + return $this->dateInterval->copy(); + } + + /** + * Get start date of the period. + * + * @return Carbon + */ + public function getStartDate() + { + return $this->startDate->copy(); + } + + /** + * Get end date of the period. + * + * @return Carbon|null + */ + public function getEndDate() + { + if ($this->endDate) { + return $this->endDate->copy(); + } + } + + /** + * Get number of recurrences. + * + * @return int|null + */ + public function getRecurrences() + { + return $this->recurrences; + } + + /** + * Returns true if the start date should be excluded. + * + * @return bool + */ + public function isStartExcluded() + { + return ($this->options & static::EXCLUDE_START_DATE) !== 0; + } + + /** + * Returns true if the end date should be excluded. + * + * @return bool + */ + public function isEndExcluded() + { + return ($this->options & static::EXCLUDE_END_DATE) !== 0; + } + + /** + * Add a filter to the stack. + * + * @param callable $callback + * @param string $name + * + * @return $this + */ + public function addFilter($callback, $name = null) + { + $tuple = $this->createFilterTuple(func_get_args()); + + $this->filters[] = $tuple; + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Prepend a filter to the stack. + * + * @param callable $callback + * @param string $name + * + * @return $this + */ + public function prependFilter($callback, $name = null) + { + $tuple = $this->createFilterTuple(func_get_args()); + + array_unshift($this->filters, $tuple); + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Create a filter tuple from raw parameters. + * + * Will create an automatic filter callback for one of Carbon's is* methods. + * + * @param array $parameters + * + * @return array + */ + protected function createFilterTuple(array $parameters) + { + $method = array_shift($parameters); + + if (!$this->isCarbonPredicateMethod($method)) { + return array($method, array_shift($parameters)); + } + + return array(function ($date) use ($method, $parameters) { + return call_user_func_array(array($date, $method), $parameters); + }, $method); + } + + /** + * Remove a filter by instance or name. + * + * @param callable|string $filter + * + * @return $this + */ + public function removeFilter($filter) + { + $key = is_callable($filter) ? 0 : 1; + + $this->filters = array_values(array_filter( + $this->filters, + function ($tuple) use ($key, $filter) { + return $tuple[$key] !== $filter; + } + )); + + $this->updateInternalState(); + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Return whether given instance or name is in the filter stack. + * + * @param callable|string $filter + * + * @return bool + */ + public function hasFilter($filter) + { + $key = is_callable($filter) ? 0 : 1; + + foreach ($this->filters as $tuple) { + if ($tuple[$key] === $filter) { + return true; + } + } + + return false; + } + + /** + * Get filters stack. + * + * @return array + */ + public function getFilters() + { + return $this->filters; + } + + /** + * Set filters stack. + * + * @param array $filters + * + * @return $this + */ + public function setFilters(array $filters) + { + $this->filters = $filters; + + $this->updateInternalState(); + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Reset filters stack. + * + * @return $this + */ + public function resetFilters() + { + $this->filters = array(); + + if ($this->endDate !== null) { + $this->filters[] = array(static::END_DATE_FILTER, null); + } + + if ($this->recurrences !== null) { + $this->filters[] = array(static::RECURRENCES_FILTER, null); + } + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Update properties after removing built-in filters. + * + * @return void + */ + protected function updateInternalState() + { + if (!$this->hasFilter(static::END_DATE_FILTER)) { + $this->endDate = null; + } + + if (!$this->hasFilter(static::RECURRENCES_FILTER)) { + $this->recurrences = null; + } + } + + /** + * Add a recurrences filter (set maximum number of recurrences). + * + * @param int|null $recurrences + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setRecurrences($recurrences) + { + if (!is_numeric($recurrences) && !is_null($recurrences) || $recurrences < 0) { + throw new InvalidArgumentException('Invalid number of recurrences.'); + } + + if ($recurrences === null) { + return $this->removeFilter(static::RECURRENCES_FILTER); + } + + $this->recurrences = (int) $recurrences; + + if (!$this->hasFilter(static::RECURRENCES_FILTER)) { + return $this->addFilter(static::RECURRENCES_FILTER); + } + + $this->handleChangedParameters(); + + return $this; + } + + /** + * Recurrences filter callback (limits number of recurrences). + * + * @param \Carbon\Carbon $current + * @param int $key + * + * @return bool|string + */ + protected function filterRecurrences($current, $key) + { + if ($key < $this->recurrences) { + return true; + } + + return static::END_ITERATION; + } + + /** + * Change the period start date. + * + * @param DateTime|DateTimeInterface|string $date + * @param bool|null $inclusive + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setStartDate($date, $inclusive = null) + { + if (!$date = Carbon::make($date)) { + throw new InvalidArgumentException('Invalid start date.'); + } + + $this->startDate = $date; + + if ($inclusive !== null) { + $this->toggleOptions(static::EXCLUDE_START_DATE, !$inclusive); + } + + return $this; + } + + /** + * Change the period end date. + * + * @param DateTime|DateTimeInterface|string|null $date + * @param bool|null $inclusive + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setEndDate($date, $inclusive = null) + { + if (!is_null($date) && !$date = Carbon::make($date)) { + throw new InvalidArgumentException('Invalid end date.'); + } + + if (!$date) { + return $this->removeFilter(static::END_DATE_FILTER); + } + + $this->endDate = $date; + + if ($inclusive !== null) { + $this->toggleOptions(static::EXCLUDE_END_DATE, !$inclusive); + } + + if (!$this->hasFilter(static::END_DATE_FILTER)) { + return $this->addFilter(static::END_DATE_FILTER); + } + + $this->handleChangedParameters(); + + return $this; + } + + /** + * End date filter callback. + * + * @param \Carbon\Carbon $current + * + * @return bool|string + */ + protected function filterEndDate($current) + { + if (!$this->isEndExcluded() && $current == $this->endDate) { + return true; + } + + if ($this->dateInterval->invert ? $current > $this->endDate : $current < $this->endDate) { + return true; + } + + return static::END_ITERATION; + } + + /** + * End iteration filter callback. + * + * @return string + */ + protected function endIteration() + { + return static::END_ITERATION; + } + + /** + * Handle change of the parameters. + */ + protected function handleChangedParameters() + { + $this->validationResult = null; + } + + /** + * Validate current date and stop iteration when necessary. + * + * Returns true when current date is valid, false if it is not, or static::END_ITERATION + * when iteration should be stopped. + * + * @return bool|static::END_ITERATION + */ + protected function validateCurrentDate() + { + if ($this->current === null) { + $this->rewind(); + } + + // Check after the first rewind to avoid repeating the initial validation. + if ($this->validationResult !== null) { + return $this->validationResult; + } + + return $this->validationResult = $this->checkFilters(); + } + + /** + * Check whether current value and key pass all the filters. + * + * @return bool|string + */ + protected function checkFilters() + { + $current = $this->prepareForReturn($this->current); + + foreach ($this->filters as $tuple) { + $result = call_user_func( + $tuple[0], $current->copy(), $this->key, $this + ); + + if ($result === static::END_ITERATION) { + return static::END_ITERATION; + } + + if (!$result) { + return false; + } + } + + return true; + } + + /** + * Prepare given date to be returned to the external logic. + * + * @param Carbon $date + * + * @return Carbon + */ + protected function prepareForReturn(Carbon $date) + { + $date = $date->copy(); + + if ($this->timezone) { + $date->setTimezone($this->timezone); + } + + return $date; + } + + /** + * Check if the current position is valid. + * + * @return bool + */ + public function valid() + { + return $this->validateCurrentDate() === true; + } + + /** + * Return the current key. + * + * @return int|null + */ + public function key() + { + if ($this->valid()) { + return $this->key; + } + } + + /** + * Return the current date. + * + * @return Carbon|null + */ + public function current() + { + if ($this->valid()) { + return $this->prepareForReturn($this->current); + } + } + + /** + * Move forward to the next date. + * + * @throws \RuntimeException + * + * @return void + */ + public function next() + { + if ($this->current === null) { + $this->rewind(); + } + + if ($this->validationResult !== static::END_ITERATION) { + $this->key++; + + $this->incrementCurrentDateUntilValid(); + } + } + + /** + * Rewind to the start date. + * + * Iterating over a date in the UTC timezone avoids bug during backward DST change. + * + * @see https://bugs.php.net/bug.php?id=72255 + * @see https://bugs.php.net/bug.php?id=74274 + * @see https://wiki.php.net/rfc/datetime_and_daylight_saving_time + * + * @throws \RuntimeException + * + * @return void + */ + public function rewind() + { + $this->key = 0; + $this->current = $this->startDate->copy(); + $this->timezone = static::intervalHasTime($this->dateInterval) ? $this->current->getTimezone() : null; + + if ($this->timezone) { + $this->current->setTimezone('UTC'); + } + + $this->validationResult = null; + + if ($this->isStartExcluded() || $this->validateCurrentDate() === false) { + $this->incrementCurrentDateUntilValid(); + } + } + + /** + * Skip iterations and returns iteration state (false if ended, true if still valid). + * + * @param int $count steps number to skip (1 by default) + * + * @return bool + */ + public function skip($count = 1) + { + for ($i = $count; $this->valid() && $i > 0; $i--) { + $this->next(); + } + + return $this->valid(); + } + + /** + * Keep incrementing the current date until a valid date is found or the iteration is ended. + * + * @throws \RuntimeException + * + * @return void + */ + protected function incrementCurrentDateUntilValid() + { + $attempts = 0; + + do { + $this->current->add($this->dateInterval); + + $this->validationResult = null; + + if (++$attempts > static::NEXT_MAX_ATTEMPTS) { + throw new RuntimeException('Could not find next valid date.'); + } + } while ($this->validateCurrentDate() === false); + } + + /** + * Format the date period as ISO 8601. + * + * @return string + */ + public function toIso8601String() + { + $parts = array(); + + if ($this->recurrences !== null) { + $parts[] = 'R'.$this->recurrences; + } + + $parts[] = $this->startDate->toIso8601String(); + + $parts[] = $this->dateInterval->spec(); + + if ($this->endDate !== null) { + $parts[] = $this->endDate->toIso8601String(); + } + + return implode('/', $parts); + } + + /** + * Convert the date period into a string. + * + * @return string + */ + public function toString() + { + $translator = Carbon::getTranslator(); + + $parts = array(); + + $format = !$this->startDate->isStartOfDay() || $this->endDate && !$this->endDate->isStartOfDay() + ? 'Y-m-d H:i:s' + : 'Y-m-d'; + + if ($this->recurrences !== null) { + $parts[] = $translator->transChoice('period_recurrences', $this->recurrences, array(':count' => $this->recurrences)); + } + + $parts[] = $translator->trans('period_interval', array(':interval' => $this->dateInterval->forHumans())); + + $parts[] = $translator->trans('period_start_date', array(':date' => $this->startDate->format($format))); + + if ($this->endDate !== null) { + $parts[] = $translator->trans('period_end_date', array(':date' => $this->endDate->format($format))); + } + + $result = implode(' ', $parts); + + return mb_strtoupper(mb_substr($result, 0, 1)).mb_substr($result, 1); + } + + /** + * Format the date period as ISO 8601. + * + * @return string + */ + public function spec() + { + return $this->toIso8601String(); + } + + /** + * Convert the date period into an array without changing current iteration state. + * + * @return array + */ + public function toArray() + { + $state = array( + $this->key, + $this->current ? $this->current->copy() : null, + $this->validationResult, + ); + + $result = iterator_to_array($this); + + list( + $this->key, + $this->current, + $this->validationResult + ) = $state; + + return $result; + } + + /** + * Count dates in the date period. + * + * @return int + */ + public function count() + { + return count($this->toArray()); + } + + /** + * Return the first date in the date period. + * + * @return Carbon|null + */ + public function first() + { + if ($array = $this->toArray()) { + return $array[0]; + } + } + + /** + * Return the last date in the date period. + * + * @return Carbon|null + */ + public function last() + { + if ($array = $this->toArray()) { + return $array[count($array) - 1]; + } + } + + /** + * Call given macro. + * + * @param string $name + * @param array $parameters + * + * @return mixed + */ + protected function callMacro($name, $parameters) + { + $macro = static::$macros[$name]; + + $reflection = new ReflectionFunction($macro); + + $reflectionParameters = $reflection->getParameters(); + + $expectedCount = count($reflectionParameters); + $actualCount = count($parameters); + + if ($expectedCount > $actualCount && $reflectionParameters[$expectedCount - 1]->name === 'self') { + for ($i = $actualCount; $i < $expectedCount - 1; $i++) { + $parameters[] = $reflectionParameters[$i]->getDefaultValue(); + } + + $parameters[] = $this; + } + + if ($macro instanceof Closure && method_exists($macro, 'bindTo')) { + $macro = $macro->bindTo($this, get_class($this)); + } + + return call_user_func_array($macro, $parameters); + } + + /** + * Convert the date period into a string. + * + * @return string + */ + public function __toString() + { + return $this->toString(); + } + + /** + * Add aliases for setters. + * + * CarbonPeriod::days(3)->hours(5)->invert() + * ->sinceNow()->until('2010-01-10') + * ->filter(...) + * ->count() + * + * Note: We use magic method to let static and instance aliases with the same names. + * + * @param string $method + * @param array $parameters + * + * @return mixed + */ + public function __call($method, $parameters) + { + if (static::hasMacro($method)) { + return $this->callMacro($method, $parameters); + } + + $first = count($parameters) >= 1 ? $parameters[0] : null; + $second = count($parameters) >= 2 ? $parameters[1] : null; + + switch ($method) { + case 'start': + case 'since': + return $this->setStartDate($first, $second); + + case 'sinceNow': + return $this->setStartDate(new Carbon, $first); + + case 'end': + case 'until': + return $this->setEndDate($first, $second); + + case 'untilNow': + return $this->setEndDate(new Carbon, $first); + + case 'dates': + case 'between': + return $this->setDates($first, $second); + + case 'recurrences': + case 'times': + return $this->setRecurrences($first); + + case 'options': + return $this->setOptions($first); + + case 'toggle': + return $this->toggleOptions($first, $second); + + case 'filter': + case 'push': + return $this->addFilter($first, $second); + + case 'prepend': + return $this->prependFilter($first, $second); + + case 'filters': + return $this->setFilters($first ?: array()); + + case 'interval': + case 'each': + case 'every': + case 'step': + case 'stepBy': + return $this->setDateInterval($first); + + case 'invert': + return $this->invertDateInterval(); + + case 'years': + case 'year': + case 'months': + case 'month': + case 'weeks': + case 'week': + case 'days': + case 'dayz': + case 'day': + case 'hours': + case 'hour': + case 'minutes': + case 'minute': + case 'seconds': + case 'second': + return $this->setDateInterval(call_user_func( + // Override default P1D when instantiating via fluent setters. + array($this->isDefaultInterval ? new CarbonInterval('PT0S') : $this->dateInterval, $method), + count($parameters) === 0 ? 1 : $first + )); + } + + throw new BadMethodCallException("Method $method does not exist."); + } +} diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/az.php b/vendor/nesbot/carbon/src/Carbon/Lang/az.php index d567c63c3..25f5c4a4d 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/az.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/az.php @@ -28,4 +28,13 @@ 'from_now' => ':time sonra', 'after' => ':time sonra', 'before' => ':time əvvəl', + 'diff_now' => 'indi', + 'diff_yesterday' => 'dünən', + 'diff_tomorrow' => 'sabah', + 'diff_before_yesterday' => 'srağagün', + 'diff_after_tomorrow' => 'birisi gün', + 'period_recurrences' => ':count dəfədən bir', + 'period_interval' => 'hər :interval', + 'period_start_date' => ':date tarixindən başlayaraq', + 'period_end_date' => ':date tarixinədək', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bn.php b/vendor/nesbot/carbon/src/Carbon/Lang/bn.php index a930df38a..5817599c6 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/bn.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bn.php @@ -10,22 +10,29 @@ */ return array( - 'year' => '১ বছর|:count বছর', - 'y' => '১ বছর|:count বছর', - 'month' => '১ মাস|:count মাস', - 'm' => '১ মাস|:count মাস', - 'week' => '১ সপ্তাহ|:count সপ্তাহ', - 'w' => '১ সপ্তাহ|:count সপ্তাহ', - 'day' => '১ দিন|:count দিন', - 'd' => '১ দিন|:count দিন', - 'hour' => '১ ঘন্টা|:count ঘন্টা', - 'h' => '১ ঘন্টা|:count ঘন্টা', - 'minute' => '১ মিনিট|:count মিনিট', - 'min' => '১ মিনিট|:count মিনিট', - 'second' => '১ সেকেন্ড|:count সেকেন্ড', - 's' => '১ সেকেন্ড|:count সেকেন্ড', - 'ago' => ':time পূর্বে', - 'from_now' => 'এখন থেকে :time', - 'after' => ':time পরে', - 'before' => ':time আগে', + 'year' => '১ বছর|:count বছর', + 'y' => '১ বছর|:count বছর', + 'month' => '১ মাস|:count মাস', + 'm' => '১ মাস|:count মাস', + 'week' => '১ সপ্তাহ|:count সপ্তাহ', + 'w' => '১ সপ্তাহ|:count সপ্তাহ', + 'day' => '১ দিন|:count দিন', + 'd' => '১ দিন|:count দিন', + 'hour' => '১ ঘন্টা|:count ঘন্টা', + 'h' => '১ ঘন্টা|:count ঘন্টা', + 'minute' => '১ মিনিট|:count মিনিট', + 'min' => '১ মিনিট|:count মিনিট', + 'second' => '১ সেকেন্ড|:count সেকেন্ড', + 's' => '১ সেকেন্ড|:count সেকেন্ড', + 'ago' => ':time পূর্বে', + 'from_now' => 'এখন থেকে :time', + 'after' => ':time পরে', + 'before' => ':time আগে', + 'diff_now' => 'এখন', + 'diff_yesterday' => 'গতকাল', + 'diff_tomorrow' => 'আগামীকাল', + 'period_recurrences' => ':count বার|:count বার', + 'period_interval' => 'প্রতি :interval', + 'period_start_date' => ':date থেকে', + 'period_end_date' => ':date পর্যন্ত', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php b/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php new file mode 100644 index 000000000..7a9b05aa4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/bs_BA.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count godina|:count godine|:count godina', + 'y' => ':count godina|:count godine|:count godina', + 'month' => ':count mjesec|:count mjeseca|:count mjeseci', + 'm' => ':count mjesec|:count mjeseca|:count mjeseci', + 'week' => ':count nedjelja|:count nedjelje|:count nedjelja', + 'w' => ':count nedjelja|:count nedjelje|:count nedjelja', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count dan|:count dana|:count dana', + 'hour' => ':count sat|:count sata|:count sati', + 'h' => ':count sat|:count sata|:count sati', + 'minute' => ':count minut|:count minuta|:count minuta', + 'min' => ':count minut|:count minuta|:count minuta', + 'second' => ':count sekund|:count sekunda|:count sekundi', + 's' => ':count sekund|:count sekunda|:count sekundi', + 'ago' => 'prije :time', + 'from_now' => 'za :time', + 'after' => 'nakon :time', + 'before' => ':time ranije', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ca.php b/vendor/nesbot/carbon/src/Carbon/Lang/ca.php index 0e5435fd6..c854b5a91 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ca.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ca.php @@ -25,7 +25,16 @@ 'second' => ':count segon|:count segons', 's' => ':count segon|:count segons', 'ago' => 'fa :time', - 'from_now' => 'dins de :time', + 'from_now' => 'd\'aquí :time', 'after' => ':time després', 'before' => ':time abans', + 'diff_now' => 'ara mateix', + 'diff_yesterday' => 'ahir', + 'diff_tomorrow' => 'demà', + 'diff_before_yesterday' => "abans d'ahir", + 'diff_after_tomorrow' => 'demà passat', + 'period_recurrences' => ':count cop|:count cops', + 'period_interval' => 'cada :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'fins a :date', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/de.php b/vendor/nesbot/carbon/src/Carbon/Lang/de.php index 37a2439d6..5ea2a03ad 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/de.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/de.php @@ -37,4 +37,10 @@ 'month_ago' => ':count Monat|:count Monaten', 'week_ago' => ':count Woche|:count Wochen', 'day_ago' => ':count Tag|:count Tagen', + + 'diff_now' => 'Gerade eben', + 'diff_yesterday' => 'Gestern', + 'diff_tomorrow' => 'Heute', + 'diff_before_yesterday' => 'Vorgestern', + 'diff_after_tomorrow' => 'Übermorgen', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/en.php b/vendor/nesbot/carbon/src/Carbon/Lang/en.php index 9df236ac9..a15c131fb 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/en.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/en.php @@ -33,4 +33,8 @@ 'diff_tomorrow' => 'tomorrow', 'diff_before_yesterday' => 'before yesterday', 'diff_after_tomorrow' => 'after tomorrow', + 'period_recurrences' => 'once|:count times', + 'period_interval' => 'every :interval', + 'period_start_date' => 'from :date', + 'period_end_date' => 'to :date', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/es.php b/vendor/nesbot/carbon/src/Carbon/Lang/es.php index 1ad82cea7..567a280f3 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/es.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/es.php @@ -28,4 +28,9 @@ 'from_now' => 'dentro de :time', 'after' => ':time después', 'before' => ':time antes', + 'diff_now' => 'ahora mismo', + 'diff_yesterday' => 'ayer', + 'diff_tomorrow' => 'mañana', + 'diff_before_yesterday' => 'antier', + 'diff_after_tomorrow' => 'pasado mañana', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/fr.php b/vendor/nesbot/carbon/src/Carbon/Lang/fr.php index d68ab95bf..0b20cdd29 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/fr.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/fr.php @@ -15,15 +15,15 @@ 'month' => ':count mois', 'm' => ':count mois', 'week' => ':count semaine|:count semaines', - 'w' => ':count sem.|:count sem.', + 'w' => ':count sem.', 'day' => ':count jour|:count jours', - 'd' => ':count j.|:count j.', + 'd' => ':count j.', 'hour' => ':count heure|:count heures', - 'h' => ':count h|:count h.', + 'h' => ':count h.', 'minute' => ':count minute|:count minutes', - 'min' => ':count min.|:count min.', + 'min' => ':count min.', 'second' => ':count seconde|:count secondes', - 's' => ':count sec.|:count sec.', + 's' => ':count sec.', 'ago' => 'il y a :time', 'from_now' => 'dans :time', 'after' => ':time après', @@ -33,4 +33,8 @@ 'diff_tomorrow' => 'demain', 'diff_before_yesterday' => 'avant-hier', 'diff_after_tomorrow' => 'après-demain', + 'period_recurrences' => ':count fois', + 'period_interval' => 'tous les :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'à :date', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/hi.php b/vendor/nesbot/carbon/src/Carbon/Lang/hi.php new file mode 100644 index 000000000..6c670ee8c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/hi.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '1 वर्ष|:count वर्षों', + 'y' => '1 वर्ष|:count वर्षों', + 'month' => '1 माह|:count महीने', + 'm' => '1 माह|:count महीने', + 'week' => '1 सप्ताह|:count सप्ताह', + 'w' => '1 सप्ताह|:count सप्ताह', + 'day' => '1 दिन|:count दिनों', + 'd' => '1 दिन|:count दिनों', + 'hour' => '1 घंटा|:count घंटे', + 'h' => '1 घंटा|:count घंटे', + 'minute' => '1 मिनट|:count मिनटों', + 'min' => '1 मिनट|:count मिनटों', + 'second' => '1 सेकंड|:count सेकंड', + 's' => '1 सेकंड|:count सेकंड', + 'ago' => ':time पूर्व', + 'from_now' => ':time से', + 'after' => ':time के बाद', + 'before' => ':time के पहले', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/is.php b/vendor/nesbot/carbon/src/Carbon/Lang/is.php new file mode 100644 index 000000000..94c76a7f2 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/is.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => '1 ár|:count ár', + 'y' => '1 ár|:count ár', + 'month' => '1 mánuður|:count mánuðir', + 'm' => '1 mánuður|:count mánuðir', + 'week' => '1 vika|:count vikur', + 'w' => '1 vika|:count vikur', + 'day' => '1 dagur|:count dagar', + 'd' => '1 dagur|:count dagar', + 'hour' => '1 klukkutími|:count klukkutímar', + 'h' => '1 klukkutími|:count klukkutímar', + 'minute' => '1 mínúta|:count mínútur', + 'min' => '1 mínúta|:count mínútur', + 'second' => '1 sekúnda|:count sekúndur', + 's' => '1 sekúnda|:count sekúndur', + 'ago' => ':time síðan', + 'from_now' => ':time síðan', + 'after' => ':time eftir', + 'before' => ':time fyrir', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ko.php b/vendor/nesbot/carbon/src/Carbon/Lang/ko.php index 9eac8c9f7..020916442 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ko.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ko.php @@ -26,6 +26,6 @@ 's' => ':count 초', 'ago' => ':time 전', 'from_now' => ':time 후', - 'after' => ':time 뒤', - 'before' => ':time 앞', + 'after' => ':time 이후', + 'before' => ':time 이전', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/my.php b/vendor/nesbot/carbon/src/Carbon/Lang/my.php new file mode 100644 index 000000000..e8e491ecf --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/my.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count နှစ်|:count နှစ်', + 'y' => ':count နှစ်|:count နှစ်', + 'month' => ':count လ|:count လ', + 'm' => ':count လ|:count လ', + 'week' => ':count ပတ်|:count ပတ်', + 'w' => ':count ပတ်|:count ပတ်', + 'day' => ':count ရက်|:count ရက်', + 'd' => ':count ရက်|:count ရက်', + 'hour' => ':count နာရီ|:count နာရီ', + 'h' => ':count နာရီ|:count နာရီ', + 'minute' => ':count မိနစ်|:count မိနစ်', + 'min' => ':count မိနစ်|:count မိနစ်', + 'second' => ':count စက္ကန့်|:count စက္ကန့်', + 's' => ':count စက္ကန့်|:count စက္ကန့်', + 'ago' => 'လွန်ခဲ့သော :time က', + 'from_now' => 'ယခုမှစ၍နောက် :time အကြာ', + 'after' => ':time ကြာပြီးနောက်', + 'before' => ':time မတိုင်ခင်', + 'diff_now' => 'အခုလေးတင်', + 'diff_yesterday' => 'မနေ့က', + 'diff_tomorrow' => 'မနက်ဖြန်', + 'diff_before_yesterday' => 'တမြန်နေ့က', + 'diff_after_tomorrow' => 'တဘက်ခါ', + 'period_recurrences' => ':count ကြိမ်', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ne.php b/vendor/nesbot/carbon/src/Carbon/Lang/ne.php new file mode 100644 index 000000000..0b528dfa4 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ne.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => ':count वर्ष', + 'y' => ':count वर्ष', + 'month' => ':count महिना', + 'm' => ':count महिना', + 'week' => ':count हप्ता', + 'w' => ':count हप्ता', + 'day' => ':count दिन', + 'd' => ':count दिन', + 'hour' => ':count घण्टा', + 'h' => ':count घण्टा', + 'minute' => ':count मिनेट', + 'min' => ':count मिनेट', + 'second' => ':count सेकेण्ड', + 's' => ':count सेकेण्ड', + 'ago' => ':time पहिले', + 'from_now' => ':time देखि', + 'after' => ':time पछि', + 'before' => ':time अघि', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/nl.php b/vendor/nesbot/carbon/src/Carbon/Lang/nl.php index 0430ccca7..ec5a88edf 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/nl.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/nl.php @@ -28,4 +28,9 @@ 'from_now' => 'over :time', 'after' => ':time later', 'before' => ':time eerder', + 'diff_now' => 'nu', + 'diff_yesterday' => 'gisteren', + 'diff_tomorrow' => 'morgen', + 'diff_after_tomorrow' => 'overmorgen', + 'diff_before_yesterday' => 'eergisteren', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/no.php b/vendor/nesbot/carbon/src/Carbon/Lang/no.php index 3c193177a..a6ece06a0 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/no.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/no.php @@ -28,4 +28,9 @@ 'from_now' => 'om :time', 'after' => ':time etter', 'before' => ':time før', + 'diff_now' => 'akkurat nå', + 'diff_yesterday' => 'i går', + 'diff_tomorrow' => 'i morgen', + 'diff_before_yesterday' => 'i forgårs', + 'diff_after_tomorrow' => 'i overmorgen', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/oc.php b/vendor/nesbot/carbon/src/Carbon/Lang/oc.php new file mode 100644 index 000000000..e89e94c3b --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/oc.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +\Symfony\Component\Translation\PluralizationRules::set(function ($number) { + return $number == 1 ? 0 : 1; +}, 'oc'); + +return array( + 'year' => ':count an|:count ans', + 'y' => ':count an|:count ans', + 'month' => ':count mes|:count meses', + 'm' => ':count mes|:count meses', + 'week' => ':count setmana|:count setmanas', + 'w' => ':count setmana|:count setmanas', + 'day' => ':count jorn|:count jorns', + 'd' => ':count jorn|:count jorns', + 'hour' => ':count ora|:count oras', + 'h' => ':count ora|:count oras', + 'minute' => ':count minuta|:count minutas', + 'min' => ':count minuta|:count minutas', + 'second' => ':count segonda|:count segondas', + 's' => ':count segonda|:count segondas', + 'ago' => 'fa :time', + 'from_now' => 'dins :time', + 'after' => ':time aprèp', + 'before' => ':time abans', + 'diff_now' => 'ara meteis', + 'diff_yesterday' => 'ièr', + 'diff_tomorrow' => 'deman', + 'diff_before_yesterday' => 'ièr delà', + 'diff_after_tomorrow' => 'deman passat', + 'period_recurrences' => ':count còp|:count còps', + 'period_interval' => 'cada :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'fins a :date', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pl.php b/vendor/nesbot/carbon/src/Carbon/Lang/pl.php index 32267233f..2308af2d0 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/pl.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pl.php @@ -11,21 +11,26 @@ return array( 'year' => ':count rok|:count lata|:count lat', - 'y' => ':count rok|:count lata|:count lat', + 'y' => ':countr|:countl', 'month' => ':count miesiąc|:count miesiące|:count miesięcy', - 'm' => ':count miesiąc|:count miesiące|:count miesięcy', + 'm' => ':countmies', 'week' => ':count tydzień|:count tygodnie|:count tygodni', - 'w' => ':count tydzień|:count tygodnie|:count tygodni', + 'w' => ':counttyg', 'day' => ':count dzień|:count dni|:count dni', - 'd' => ':count dzień|:count dni|:count dni', + 'd' => ':countd', 'hour' => ':count godzina|:count godziny|:count godzin', - 'h' => ':count godzina|:count godziny|:count godzin', + 'h' => ':countg', 'minute' => ':count minuta|:count minuty|:count minut', - 'min' => ':count minuta|:count minuty|:count minut', + 'min' => ':countm', 'second' => ':count sekunda|:count sekundy|:count sekund', - 's' => ':count sekunda|:count sekundy|:count sekund', + 's' => ':counts', 'ago' => ':time temu', 'from_now' => ':time od teraz', 'after' => ':time po', 'before' => ':time przed', + 'diff_now' => 'przed chwilą', + 'diff_yesterday' => 'wczoraj', + 'diff_tomorrow' => 'jutro', + 'diff_before_yesterday' => 'przedwczoraj', + 'diff_after_tomorrow' => 'pojutrze', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php b/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php index 22d122018..1f84eac5f 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/pt_BR.php @@ -11,21 +11,30 @@ return array( 'year' => ':count ano|:count anos', - 'y' => ':count ano|:count anos', + 'y' => ':counta|:counta', 'month' => ':count mês|:count meses', - 'm' => ':count mês|:count meses', + 'm' => ':countm|:countm', 'week' => ':count semana|:count semanas', - 'w' => ':count semana|:count semanas', + 'w' => ':countsem|:countsem', 'day' => ':count dia|:count dias', - 'd' => ':count dia|:count dias', + 'd' => ':countd|:countd', 'hour' => ':count hora|:count horas', - 'h' => ':count hora|:count horas', + 'h' => ':counth|:counth', 'minute' => ':count minuto|:count minutos', - 'min' => ':count minuto|:count minutos', + 'min' => ':countmin|:countmin', 'second' => ':count segundo|:count segundos', - 's' => ':count segundo|:count segundos', + 's' => ':counts|:counts', 'ago' => 'há :time', 'from_now' => 'em :time', 'after' => 'após :time', 'before' => ':time atrás', + 'diff_now' => 'agora', + 'diff_yesterday' => 'ontem', + 'diff_tomorrow' => 'amanhã', + 'diff_before_yesterday' => 'anteontem', + 'diff_after_tomorrow' => 'depois de amanhã', + 'period_recurrences' => 'uma|:count vez', + 'period_interval' => 'toda :interval', + 'period_start_date' => 'de :date', + 'period_end_date' => 'até :date', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/ru.php b/vendor/nesbot/carbon/src/Carbon/Lang/ru.php index 680cbdcb1..6a83fb131 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/ru.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/ru.php @@ -11,19 +11,19 @@ return array( 'year' => ':count год|:count года|:count лет', - 'y' => ':count год|:count года|:count лет', + 'y' => ':count г|:count г|:count л', 'month' => ':count месяц|:count месяца|:count месяцев', - 'm' => ':count месяц|:count месяца|:count месяцев', + 'm' => ':count м|:count м|:count м', 'week' => ':count неделю|:count недели|:count недель', - 'w' => ':count неделю|:count недели|:count недель', + 'w' => ':count н|:count н|:count н', 'day' => ':count день|:count дня|:count дней', - 'd' => ':count день|:count дня|:count дней', + 'd' => ':count д|:count д|:count д', 'hour' => ':count час|:count часа|:count часов', - 'h' => ':count час|:count часа|:count часов', + 'h' => ':count ч|:count ч|:count ч', 'minute' => ':count минуту|:count минуты|:count минут', - 'min' => ':count минуту|:count минуты|:count минут', + 'min' => ':count мин|:count мин|:count мин', 'second' => ':count секунду|:count секунды|:count секунд', - 's' => ':count секунду|:count секунды|:count секунд', + 's' => ':count с|:count с|:count с', 'ago' => ':time назад', 'from_now' => 'через :time', 'after' => ':time после', diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sh.php b/vendor/nesbot/carbon/src/Carbon/Lang/sh.php new file mode 100644 index 000000000..57f287a7c --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sh.php @@ -0,0 +1,35 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +\Symfony\Component\Translation\PluralizationRules::set(function ($number) { + return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); +}, 'sh'); + +return array( + 'year' => ':count godina|:count godine|:count godina', + 'y' => ':count godina|:count godine|:count godina', + 'month' => ':count mesec|:count meseca|:count meseci', + 'm' => ':count mesec|:count meseca|:count meseci', + 'week' => ':count nedelja|:count nedelje|:count nedelja', + 'w' => ':count nedelja|:count nedelje|:count nedelja', + 'day' => ':count dan|:count dana|:count dana', + 'd' => ':count dan|:count dana|:count dana', + 'hour' => ':count čas|:count časa|:count časova', + 'h' => ':count čas|:count časa|:count časova', + 'minute' => ':count minut|:count minuta|:count minuta', + 'min' => ':count minut|:count minuta|:count minuta', + 'second' => ':count sekund|:count sekunda|:count sekundi', + 's' => ':count sekund|:count sekunda|:count sekundi', + 'ago' => 'pre :time', + 'from_now' => 'za :time', + 'after' => 'nakon :time', + 'before' => ':time raniјe', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sl.php b/vendor/nesbot/carbon/src/Carbon/Lang/sl.php index fcef085ea..06686d135 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/sl.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sl.php @@ -35,4 +35,9 @@ 'from_now' => 'čez :time', 'after' => 'čez :time', 'before' => 'pred :time', + 'diff_now' => 'ravnokar', + 'diff_yesterday' => 'včeraj', + 'diff_tomorrow' => 'jutri', + 'diff_before_yesterday' => 'predvčerajšnjim', + 'diff_after_tomorrow' => 'pojutrišnjem', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php index e0596f8d3..2db83edd9 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl.php @@ -35,4 +35,9 @@ 'week_from_now' => '{1} :count недељу|{2,3,4} :count недеље|[5,Inf[ :count недеља', 'week_ago' => '{1} :count недељу|{2,3,4} :count недеље|[5,Inf[ :count недеља', + 'diff_now' => 'управо сада', + 'diff_yesterday' => 'јуче', + 'diff_tomorrow' => 'сутра', + 'diff_before_yesterday' => 'прекјуче', + 'diff_after_tomorrow' => 'прекосутра', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php index 9b67838ae..18214c44c 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Cyrl_ME.php @@ -35,4 +35,9 @@ 'week_from_now' => '{1} :count недјељу|{2,3,4} :count недјеље|[5,Inf[ :count недјеља', 'week_ago' => '{1} :count недјељу|{2,3,4} :count недјеље|[5,Inf[ :count недјеља', + 'diff_now' => 'управо сада', + 'diff_yesterday' => 'јуче', + 'diff_tomorrow' => 'сутра', + 'diff_before_yesterday' => 'прекјуче', + 'diff_after_tomorrow' => 'прекосјутра', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php index d0aaee37c..2d2e28814 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sr_Latn_ME.php @@ -35,4 +35,9 @@ 'week_from_now' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja', 'week_ago' => '{1} :count nedjelju|{2,3,4} :count nedjelje|[5,Inf[ :count nedjelja', + 'diff_now' => 'upravo sada', + 'diff_yesterday' => 'juče', + 'diff_tomorrow' => 'sutra', + 'diff_before_yesterday' => 'prekjuče', + 'diff_after_tomorrow' => 'preksutra', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/sw.php b/vendor/nesbot/carbon/src/Carbon/Lang/sw.php new file mode 100644 index 000000000..52f03429e --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Lang/sw.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +return array( + 'year' => 'mwaka 1|miaka :count', + 'y' => 'mwaka 1|miaka :count', + 'month' => 'mwezi 1|miezi :count', + 'm' => 'mwezi 1|miezi :count', + 'week' => 'wiki 1|wiki :count', + 'w' => 'wiki 1|wiki :count', + 'day' => 'siku 1|siku :count', + 'd' => 'siku 1|siku :count', + 'hour' => 'saa 1|masaa :count', + 'h' => 'saa 1|masaa :count', + 'minute' => 'dakika 1|dakika :count', + 'min' => 'dakika 1|dakika :count', + 'second' => 'sekunde 1|sekunde :count', + 's' => 'sekunde 1|sekunde :count', + 'ago' => ':time ziliyopita', + 'from_now' => ':time kwanzia sasa', + 'after' => ':time baada', + 'before' => ':time kabla', +); diff --git a/vendor/nesbot/carbon/src/Carbon/Lang/uk.php b/vendor/nesbot/carbon/src/Carbon/Lang/uk.php index eaba601bb..8d08eaa4e 100644 --- a/vendor/nesbot/carbon/src/Carbon/Lang/uk.php +++ b/vendor/nesbot/carbon/src/Carbon/Lang/uk.php @@ -28,4 +28,13 @@ 'from_now' => 'через :time', 'after' => ':time після', 'before' => ':time до', + 'diff_now' => 'щойно', + 'diff_yesterday' => 'вчора', + 'diff_tomorrow' => 'завтра', + 'diff_before_yesterday' => 'позавчора', + 'diff_after_tomorrow' => 'післязавтра', + 'period_recurrences' => 'один раз|:count рази|:count разів', + 'period_interval' => 'кожні :interval', + 'period_start_date' => 'з :date', + 'period_end_date' => 'до :date', ); diff --git a/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php b/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php new file mode 100644 index 000000000..4d83b0c65 --- /dev/null +++ b/vendor/nesbot/carbon/src/Carbon/Laravel/ServiceProvider.php @@ -0,0 +1,37 @@ +app['events']; + if ($events instanceof EventDispatcher || $events instanceof Dispatcher) { + $events->listen(class_exists('Illuminate\Foundation\Events\LocaleUpdated') ? 'Illuminate\Foundation\Events\LocaleUpdated' : 'locale.changed', function () use ($service) { + $service->updateLocale(); + }); + $service->updateLocale(); + } + } + + public function updateLocale() + { + $translator = $this->app['translator']; + if ($translator instanceof Translator || $translator instanceof IlluminateTranslator) { + Carbon::setLocale($translator->getLocale()); + } + } + + public function register() + { + // Needed for Laravel < 5.3 compatibility + } +} diff --git a/vendor/nesbot/carbon/src/JsonSerializable.php b/vendor/nesbot/carbon/src/JsonSerializable.php index b678e736c..d34060b44 100644 --- a/vendor/nesbot/carbon/src/JsonSerializable.php +++ b/vendor/nesbot/carbon/src/JsonSerializable.php @@ -1,16 +1,18 @@ json_encode, - * which is a value of any type other than a resource. - * - * @since 5.4.0 - */ - public function jsonSerialize(); +if (!interface_exists('JsonSerializable')) { + interface JsonSerializable + { + /** + * Specify data which should be serialized to JSON. + * + * @link http://php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed data which can be serialized by json_encode, + * which is a value of any type other than a resource. + * + * @since 5.4.0 + */ + public function jsonSerialize(); + } } diff --git a/vendor/paragonie/random_compat/composer.json b/vendor/paragonie/random_compat/composer.json index 1c5978c6f..34f1381d5 100644 --- a/vendor/paragonie/random_compat/composer.json +++ b/vendor/paragonie/random_compat/composer.json @@ -4,6 +4,7 @@ "keywords": [ "csprng", "random", + "polyfill", "pseudorandom" ], "license": "MIT", diff --git a/vendor/paragonie/random_compat/lib/byte_safe_strings.php b/vendor/paragonie/random_compat/lib/byte_safe_strings.php index 3de86b223..ef24488f9 100644 --- a/vendor/paragonie/random_compat/lib/byte_safe_strings.php +++ b/vendor/paragonie/random_compat/lib/byte_safe_strings.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -28,8 +28,9 @@ if (!is_callable('RandomCompat_strlen')) { if ( - defined('MB_OVERLOAD_STRING') && - ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING + defined('MB_OVERLOAD_STRING') + && + ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING ) { /** * strlen() implementation that isn't brittle to mbstring.func_overload @@ -82,8 +83,8 @@ function RandomCompat_strlen($binary_string) if ( defined('MB_OVERLOAD_STRING') - && - ini_get('mbstring.func_overload') & MB_OVERLOAD_STRING + && + ((int) ini_get('mbstring.func_overload')) & MB_OVERLOAD_STRING ) { /** * substr() implementation that isn't brittle to mbstring.func_overload @@ -93,7 +94,7 @@ function RandomCompat_strlen($binary_string) * * @param string $binary_string * @param int $start - * @param int $length (optional) + * @param int|null $length (optional) * * @throws TypeError * @@ -118,6 +119,7 @@ function RandomCompat_substr($binary_string, $start, $length = null) * mb_substr($str, 0, NULL, '8bit') returns an empty string on * PHP 5.3, so we have to find the length ourselves. */ + /** @var int $length */ $length = RandomCompat_strlen($binary_string) - $start; } elseif (!is_int($length)) { throw new TypeError( @@ -133,7 +135,12 @@ function RandomCompat_substr($binary_string, $start, $length = null) return ''; } - return (string) mb_substr($binary_string, $start, $length, '8bit'); + return (string) mb_substr( + (string) $binary_string, + (int) $start, + (int) $length, + '8bit' + ); } } else { @@ -145,7 +152,7 @@ function RandomCompat_substr($binary_string, $start, $length = null) * * @param string $binary_string * @param int $start - * @param int $length (optional) + * @param int|null $length (optional) * * @throws TypeError * @@ -172,10 +179,17 @@ function RandomCompat_substr($binary_string, $start, $length = null) ); } - return (string) substr($binary_string, $start, $length); + return (string) substr( + (string )$binary_string, + (int) $start, + (int) $length + ); } - return (string) substr($binary_string, $start); + return (string) substr( + (string) $binary_string, + (int) $start + ); } } } diff --git a/vendor/paragonie/random_compat/lib/cast_to_int.php b/vendor/paragonie/random_compat/lib/cast_to_int.php index 9a4fab991..f97e4349b 100644 --- a/vendor/paragonie/random_compat/lib/cast_to_int.php +++ b/vendor/paragonie/random_compat/lib/cast_to_int.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -50,14 +50,16 @@ function RandomCompat_intval($number, $fail_open = false) if (is_int($number) || is_float($number)) { $number += 0; } elseif (is_numeric($number)) { + /** @psalm-suppress InvalidOperand */ $number += 0; } + /** @var int|float $number */ if ( is_float($number) - && + && $number > ~PHP_INT_MAX - && + && $number < PHP_INT_MAX ) { $number = (int) $number; diff --git a/vendor/paragonie/random_compat/lib/error_polyfill.php b/vendor/paragonie/random_compat/lib/error_polyfill.php index 6a91990ce..6d4a19ac7 100644 --- a/vendor/paragonie/random_compat/lib/error_polyfill.php +++ b/vendor/paragonie/random_compat/lib/error_polyfill.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal diff --git a/vendor/paragonie/random_compat/lib/random.php b/vendor/paragonie/random_compat/lib/random.php index 080b87c19..36245f542 100644 --- a/vendor/paragonie/random_compat/lib/random.php +++ b/vendor/paragonie/random_compat/lib/random.php @@ -3,12 +3,12 @@ * Random_* Compatibility Library * for using the new PHP 7 random_* API in PHP 5 projects * - * @version 2.0.10 - * @released 2017-03-13 + * @version 2.0.17 + * @released 2018-07-04 * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -54,9 +54,9 @@ $RandomCompatDIR = dirname(__FILE__); -require_once $RandomCompatDIR . '/byte_safe_strings.php'; -require_once $RandomCompatDIR . '/cast_to_int.php'; -require_once $RandomCompatDIR . '/error_polyfill.php'; +require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'byte_safe_strings.php'; +require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'cast_to_int.php'; +require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'error_polyfill.php'; if (!is_callable('random_bytes')) { /** @@ -76,9 +76,9 @@ if (extension_loaded('libsodium')) { // See random_bytes_libsodium.php if (PHP_VERSION_ID >= 50300 && is_callable('\\Sodium\\randombytes_buf')) { - require_once $RandomCompatDIR . '/random_bytes_libsodium.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium.php'; } elseif (method_exists('Sodium', 'randombytes_buf')) { - require_once $RandomCompatDIR . '/random_bytes_libsodium_legacy.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_libsodium_legacy.php'; } } @@ -117,7 +117,7 @@ // place, that is not helpful to us here. // See random_bytes_dev_urandom.php - require_once $RandomCompatDIR . '/random_bytes_dev_urandom.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_dev_urandom.php'; } // Unset variables after use $RandomCompat_basedir = null; @@ -159,7 +159,7 @@ extension_loaded('mcrypt') ) { // See random_bytes_mcrypt.php - require_once $RandomCompatDIR . '/random_bytes_mcrypt.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_mcrypt.php'; } $RandomCompatUrandom = null; @@ -184,7 +184,7 @@ class_exists('COM') $RandomCompatCOMtest = new COM('CAPICOM.Utilities.1'); if (method_exists($RandomCompatCOMtest, 'GetRandom')) { // See random_bytes_com_dotnet.php - require_once $RandomCompatDIR . '/random_bytes_com_dotnet.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_bytes_com_dotnet.php'; } } catch (com_exception $e) { // Don't try to use it. @@ -203,7 +203,7 @@ class_exists('COM') * and hope the developer won't let it fail silently. * * @param mixed $length - * @psalm-suppress MissingReturnType + * @psalm-suppress InvalidReturnType * @throws Exception * @return string */ @@ -219,7 +219,7 @@ function random_bytes($length) } if (!is_callable('random_int')) { - require_once $RandomCompatDIR . '/random_int.php'; + require_once $RandomCompatDIR . DIRECTORY_SEPARATOR . 'random_int.php'; } $RandomCompatDIR = null; diff --git a/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php b/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php index fc1926e5c..077fb90d1 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_com_dotnet.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -41,6 +41,7 @@ function random_bytes($bytes) { try { + /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( @@ -54,12 +55,14 @@ function random_bytes($bytes) ); } + /** @var string $buf */ $buf = ''; if (!class_exists('COM')) { throw new Error( 'COM does not exist' ); } + /** @var COM $util */ $util = new COM('CAPICOM.Utilities.1'); $execCount = 0; @@ -68,12 +71,12 @@ function random_bytes($bytes) * get N bytes of random data, then CAPICOM has failed us. */ do { - $buf .= base64_decode($util->GetRandom($bytes, 0)); + $buf .= base64_decode((string) $util->GetRandom($bytes, 0)); if (RandomCompat_strlen($buf) >= $bytes) { /** * Return our random entropy buffer here: */ - return RandomCompat_substr($buf, 0, $bytes); + return (string) RandomCompat_substr($buf, 0, $bytes); } ++$execCount; } while ($execCount < $bytes); diff --git a/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php b/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php index df5b91524..5e0ac0e3e 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_dev_urandom.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -46,7 +46,9 @@ */ function random_bytes($bytes) { + /** @var resource $fp */ static $fp = null; + /** * This block should only be run once */ @@ -55,8 +57,10 @@ function random_bytes($bytes) * We use /dev/urandom if it is a char device. * We never fall back to /dev/random */ + /** @var resource|bool $fp */ $fp = fopen('/dev/urandom', 'rb'); - if (!empty($fp)) { + if (is_resource($fp)) { + /** @var array $st */ $st = fstat($fp); if (($st['mode'] & 0170000) !== 020000) { fclose($fp); @@ -64,7 +68,7 @@ function random_bytes($bytes) } } - if (!empty($fp)) { + if (is_resource($fp)) { /** * stream_set_read_buffer() does not exist in HHVM * @@ -83,6 +87,7 @@ function random_bytes($bytes) } try { + /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( @@ -103,7 +108,7 @@ function random_bytes($bytes) * if (empty($fp)) line is logic that should only be run once per * page load. */ - if (!empty($fp)) { + if (is_resource($fp)) { /** * @var int */ diff --git a/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php b/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php index 4af1a2422..7a95e2b40 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_libsodium.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -43,6 +43,7 @@ function random_bytes($bytes) { try { + /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( @@ -60,6 +61,7 @@ function random_bytes($bytes) * \Sodium\randombytes_buf() doesn't allow more than 2147483647 bytes to be * generated in one invocation. */ + /** @var string|bool $buf */ if ($bytes > 2147483647) { $buf = ''; for ($i = 0; $i < $bytes; $i += 1073741824) { @@ -69,10 +71,11 @@ function random_bytes($bytes) $buf .= \Sodium\randombytes_buf($n); } } else { + /** @var string|bool $buf */ $buf = \Sodium\randombytes_buf($bytes); } - if ($buf !== false) { + if (is_string($buf)) { if (RandomCompat_strlen($buf) === $bytes) { return $buf; } diff --git a/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php index 705af5262..95d31f9ba 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_libsodium_legacy.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -43,6 +43,7 @@ function random_bytes($bytes) { try { + /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( diff --git a/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php index aac9c013d..f427694f5 100644 --- a/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php +++ b/vendor/paragonie/random_compat/lib/random_bytes_mcrypt.php @@ -5,7 +5,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -42,6 +42,7 @@ function random_bytes($bytes) { try { + /** @var int $bytes */ $bytes = RandomCompat_intval($bytes); } catch (TypeError $ex) { throw new TypeError( @@ -55,10 +56,11 @@ function random_bytes($bytes) ); } - $buf = @mcrypt_create_iv($bytes, MCRYPT_DEV_URANDOM); + /** @var string|bool $buf */ + $buf = @mcrypt_create_iv((int) $bytes, (int) MCRYPT_DEV_URANDOM); if ( - $buf !== false - && + is_string($buf) + && RandomCompat_strlen($buf) === $bytes ) { /** diff --git a/vendor/paragonie/random_compat/lib/random_int.php b/vendor/paragonie/random_compat/lib/random_int.php index 5b2143a16..ff80dfa43 100644 --- a/vendor/paragonie/random_compat/lib/random_int.php +++ b/vendor/paragonie/random_compat/lib/random_int.php @@ -7,7 +7,7 @@ * * The MIT License (MIT) * - * Copyright (c) 2015 - 2017 Paragon Initiative Enterprises + * Copyright (c) 2015 - 2018 Paragon Initiative Enterprises * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -51,6 +51,7 @@ function random_int($min, $max) */ try { + /** @var int $min */ $min = RandomCompat_intval($min); } catch (TypeError $ex) { throw new TypeError( @@ -59,6 +60,7 @@ function random_int($min, $max) } try { + /** @var int $max */ $max = RandomCompat_intval($max); } catch (TypeError $ex) { throw new TypeError( @@ -90,11 +92,18 @@ function random_int($min, $max) * so we can minimize the number of discards */ $attempts = $bits = $bytes = $mask = $valueShift = 0; + /** @var int $attempts */ + /** @var int $bits */ + /** @var int $bytes */ + /** @var int $mask */ + /** @var int $valueShift */ /** * At this point, $range is a positive number greater than 0. It might * overflow, however, if $max - $min > PHP_INT_MAX. PHP will cast it to * a float and we will lose some precision. + * + * @var int|float $range */ $range = $max - $min; @@ -115,6 +124,7 @@ function random_int($min, $max) * @ref http://3v4l.org/XX9r5 (64-bit) */ $bytes = PHP_INT_SIZE; + /** @var int $mask */ $mask = ~0; } else { @@ -129,16 +139,19 @@ function random_int($min, $max) } ++$bits; $range >>= 1; + /** @var int $mask */ $mask = $mask << 1 | 1; } $valueShift = $min; } + /** @var int $val */ $val = 0; /** * Now that we have our parameters set up, let's begin generating * random integers until one falls between $min and $max */ + /** @psalm-suppress RedundantCondition */ do { /** * The rejection probability is at most 0.5, so this corresponds @@ -169,6 +182,7 @@ function random_int($min, $max) for ($i = 0; $i < $bytes; ++$i) { $val |= ord($randomByteString[$i]) << ($i * 8); } + /** @var int $val */ /** * Apply mask diff --git a/vendor/paragonie/random_compat/psalm.xml b/vendor/paragonie/random_compat/psalm.xml index ee072a972..d48076a02 100644 --- a/vendor/paragonie/random_compat/psalm.xml +++ b/vendor/paragonie/random_compat/psalm.xml @@ -1,18 +1,28 @@ + + - + + + + + + + diff --git a/vendor/pear/pear-core-minimal/composer.json b/vendor/pear/pear-core-minimal/composer.json index d805f56ae..c3e8e4aa8 100644 --- a/vendor/pear/pear-core-minimal/composer.json +++ b/vendor/pear/pear-core-minimal/composer.json @@ -23,7 +23,7 @@ }, "type": "library", "require": { - "pear/console_getopt": "~1.4", + "pear/console_getopt": "~1.3", "pear/pear_exception": "~1.0" }, "replace": { diff --git a/vendor/pear/pear-core-minimal/src/PEAR.php b/vendor/pear/pear-core-minimal/src/PEAR.php index b6bb191e7..89568a0e5 100644 --- a/vendor/pear/pear-core-minimal/src/PEAR.php +++ b/vendor/pear/pear-core-minimal/src/PEAR.php @@ -170,7 +170,7 @@ function __construct($error_class = null) $destructor = "_$classname"; if (method_exists($this, $destructor)) { global $_PEAR_destructor_object_list; - $_PEAR_destructor_object_list[] = &$this; + $_PEAR_destructor_object_list[] = $this; if (!isset($GLOBALS['_PEAR_SHUTDOWN_REGISTERED'])) { register_shutdown_function("_PEAR_call_destructors"); $GLOBALS['_PEAR_SHUTDOWN_REGISTERED'] = true; @@ -598,11 +598,11 @@ protected static function _raiseError($object, protected static function _throwError($object, $message = null, $code = null, $userinfo = null) { if ($object !== null) { - $a = &$object->raiseError($message, $code, null, null, $userinfo); + $a = $object->raiseError($message, $code, null, null, $userinfo); return $a; } - $a = &PEAR::raiseError($message, $code, null, null, $userinfo); + $a = PEAR::raiseError($message, $code, null, null, $userinfo); return $a; } @@ -782,7 +782,7 @@ function _PEAR_call_destructors() $_PEAR_destructor_object_list = array_reverse($_PEAR_destructor_object_list); } - while (list($k, $objref) = each($_PEAR_destructor_object_list)) { + foreach ($_PEAR_destructor_object_list as $k => $objref) { $classname = get_class($objref); while ($classname) { $destructor = "_$classname"; diff --git a/vendor/pear/pear-core-minimal/src/System.php b/vendor/pear/pear-core-minimal/src/System.php index 89c53e3c1..f4a132935 100644 --- a/vendor/pear/pear-core-minimal/src/System.php +++ b/vendor/pear/pear-core-minimal/src/System.php @@ -527,8 +527,14 @@ public static function which($program, $fallback = false) foreach ($exe_suffixes as $suff) { foreach ($path_elements as $dir) { $file = $dir . DIRECTORY_SEPARATOR . $program . $suff; - if (is_executable($file)) { + // It's possible to run a .bat on Windows that is_executable + // would return false for. The is_executable check is meaningless... + if (OS_WINDOWS) { return $file; + } else { + if (is_executable($file)) { + return $file; + } } } } @@ -619,4 +625,4 @@ public static function find($args) } return $files; } -} \ No newline at end of file +} diff --git a/vendor/ramsey/uuid/CHANGELOG.md b/vendor/ramsey/uuid/CHANGELOG.md index 866332619..3965fff27 100644 --- a/vendor/ramsey/uuid/CHANGELOG.md +++ b/vendor/ramsey/uuid/CHANGELOG.md @@ -1,5 +1,15 @@ # ramsey/uuid Changelog +## 3.8.0 + +_Released: 2018-07-19_ + + * Add support for determining MAC address on FreeBSD systems ([#212](https://github.com/ramsey/uuid/pull/212)) + * Add a polyfill for PHP ctype functions to support systems where the ctype functions are not part of the PHP build ([#223](https://github.com/ramsey/uuid/pull/223)) + * Improve validation to disallow UUIDs with a trailing newline character ([#225](https://github.com/ramsey/uuid/pull/225)) + * Add annotations for thrown exceptions for improved IDE hinting ([#232](https://github.com/ramsey/uuid/pull/232)) + * Improve documentation, testing, and project metadata (i.e. `.gitattributes`, etc.) + ## 3.7.3 _Released: 2018-01-19_ diff --git a/vendor/ramsey/uuid/composer.json b/vendor/ramsey/uuid/composer.json index ac842c8da..952120cd4 100644 --- a/vendor/ramsey/uuid/composer.json +++ b/vendor/ramsey/uuid/composer.json @@ -26,21 +26,23 @@ }, "require": { "php": "^5.4 || ^7.0", - "paragonie/random_compat": "^1.0|^2.0" + "paragonie/random_compat": "^1.0|^2.0|9.99.99", + "symfony/polyfill-ctype": "^1.8" }, "require-dev": { - "moontoast/math": "^1.1", + "codeception/aspect-mock": "^1.0 | ~2.0.0", + "doctrine/annotations": "~1.2.0", + "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ~2.1.0", "ircmaxell/random-lib": "^1.1", - "phpunit/phpunit": "^4.7|^5.0", - "squizlabs/php_codesniffer": "^2.3", "jakub-onderka/php-parallel-lint": "^0.9.0", "mockery/mockery": "^0.9.9", - "goaop/framework": "1.0.0-alpha.2 | ^1.0 | ^2.1", - "doctrine/annotations": "~1.2.0", - "codeception/aspect-mock": "^1.0 | ~2.0.0", - "php-mock/php-mock-phpunit": "^0.3|^1.1" + "moontoast/math": "^1.1", + "php-mock/php-mock-phpunit": "^0.3|^1.1", + "phpunit/phpunit": "^4.7|^5.0|^6.5", + "squizlabs/php_codesniffer": "^2.3" }, "suggest": { + "ext-ctype": "Provides support for PHP Ctype functions", "ircmaxell/random-lib": "Provides RandomLib for use with the RandomLibAdapter", "ext-libsodium": "Provides the PECL libsodium extension for use with the SodiumRandomGenerator", "ext-uuid": "Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator", @@ -71,5 +73,8 @@ "@phpunit", "@phpcs" ] + }, + "config": { + "sort-packages": true } } diff --git a/vendor/ramsey/uuid/docs/.gitignore b/vendor/ramsey/uuid/docs/.gitignore deleted file mode 100644 index 69fa449dd..000000000 --- a/vendor/ramsey/uuid/docs/.gitignore +++ /dev/null @@ -1 +0,0 @@ -_build/ diff --git a/vendor/ramsey/uuid/docs/Makefile b/vendor/ramsey/uuid/docs/Makefile deleted file mode 100644 index f4bd287a6..000000000 --- a/vendor/ramsey/uuid/docs/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# Minimal makefile for Sphinx documentation -# - -# You can set these variables from the command line. -SPHINXOPTS = -SPHINXBUILD = sphinx-build -SPHINXPROJ = ramseyuuid -SOURCEDIR = . -BUILDDIR = _build - -# Put it first so that "make" without argument is like "make help". -help: - @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) - -.PHONY: help Makefile - -# Catch-all target: route all unknown targets to Sphinx using the new -# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). -%: Makefile - @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/vendor/ramsey/uuid/docs/_static/.gitkeep b/vendor/ramsey/uuid/docs/_static/.gitkeep deleted file mode 100644 index e69de29bb..000000000 diff --git a/vendor/ramsey/uuid/docs/conf.py b/vendor/ramsey/uuid/docs/conf.py deleted file mode 100644 index 48984599d..000000000 --- a/vendor/ramsey/uuid/docs/conf.py +++ /dev/null @@ -1,169 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# ramsey/uuid documentation build configuration file, created by -# sphinx-quickstart on Tue Jan 16 20:01:49 2018. -# -# This file is execfile()d with the current directory set to its -# containing dir. -# -# Note that not all possible configuration values are present in this -# autogenerated file. -# -# All configuration values have a default; values that are commented out -# serve to show the default. - -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -# -# import os -# import sys -# sys.path.insert(0, os.path.abspath('.')) - - -# -- General configuration ------------------------------------------------ - -# If your documentation needs a minimal Sphinx version, state it here. -# -# needs_sphinx = '1.0' - -# Add any Sphinx extension module names here, as strings. They can be -# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom -# ones. -extensions = [] - -# Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] - -# The suffix(es) of source filenames. -# You can specify multiple suffix as a list of string: -# -# source_suffix = ['.rst', '.md'] -source_suffix = '.rst' - -# The master toctree document. -master_doc = 'index' - -# General information about the project. -project = 'ramsey/uuid' -copyright = '2018, Ben Ramsey' -author = 'Ben Ramsey' - -# The version info for the project you're documenting, acts as replacement for -# |version| and |release|, also used in various other places throughout the -# built documents. -# -# The short X.Y version. -version = '3.7' -# The full version, including alpha/beta/rc tags. -release = '3.7' - -# The language for content autogenerated by Sphinx. Refer to documentation -# for a list of supported languages. -# -# This is also used if you do content translation via gettext catalogs. -# Usually you set "language" from the command line for these cases. -language = None - -# List of patterns, relative to source directory, that match files and -# directories to ignore when looking for source files. -# This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] - -# The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' - -# If true, `todo` and `todoList` produce output, else they produce nothing. -todo_include_todos = False - - -# -- Options for HTML output ---------------------------------------------- - -# The theme to use for HTML and HTML Help pages. See the documentation for -# a list of builtin themes. -# -html_theme = 'alabaster' - -# Theme options are theme-specific and customize the look and feel of a theme -# further. For a list of options available for each theme, see the -# documentation. -# -# html_theme_options = {} - -# Add any paths that contain custom static files (such as style sheets) here, -# relative to this directory. They are copied after the builtin static files, -# so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] - -# Custom sidebar templates, must be a dictionary that maps document names -# to template names. -# -# This is required for the alabaster theme -# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars -html_sidebars = { - '**': [ - 'relations.html', # needs 'show_related': True theme option to display - 'searchbox.html', - ] -} - - -# -- Options for HTMLHelp output ------------------------------------------ - -# Output file base name for HTML help builder. -htmlhelp_basename = 'ramseyuuiddoc' - - -# -- Options for LaTeX output --------------------------------------------- - -latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', -} - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, -# author, documentclass [howto, manual, or own class]). -latex_documents = [ - (master_doc, 'ramseyuuid.tex', 'ramsey/uuid Documentation', - 'Ben Ramsey', 'manual'), -] - - -# -- Options for manual page output --------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'ramseyuuid', 'ramsey/uuid Documentation', - [author], 1) -] - - -# -- Options for Texinfo output ------------------------------------------- - -# Grouping the document tree into Texinfo files. List of tuples -# (source start file, target name, title, author, -# dir menu entry, description, category) -texinfo_documents = [ - (master_doc, 'ramseyuuid', 'ramsey/uuid Documentation', - author, 'ramseyuuid', 'One line description of project.', - 'Miscellaneous'), -] - - - diff --git a/vendor/ramsey/uuid/docs/index.rst b/vendor/ramsey/uuid/docs/index.rst deleted file mode 100644 index 0a3d176c5..000000000 --- a/vendor/ramsey/uuid/docs/index.rst +++ /dev/null @@ -1,19 +0,0 @@ -.. ramsey/uuid documentation master file, created by - sphinx-quickstart on Tue Jan 16 20:01:49 2018. - You can adapt this file completely to your liking, but it should at least - contain the root `toctree` directive. - -ramsey/uuid -=========== - -.. toctree:: - :maxdepth: 2 - :caption: Contents: - - - -Indices and tables -================== - -* :ref:`genindex` -* :ref:`search` diff --git a/vendor/ramsey/uuid/src/Codec/CodecInterface.php b/vendor/ramsey/uuid/src/Codec/CodecInterface.php index f0dde9506..6ea20544f 100644 --- a/vendor/ramsey/uuid/src/Codec/CodecInterface.php +++ b/vendor/ramsey/uuid/src/Codec/CodecInterface.php @@ -42,6 +42,7 @@ public function encodeBinary(UuidInterface $uuid); * * @param string $encodedUuid * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public function decode($encodedUuid); @@ -50,6 +51,8 @@ public function decode($encodedUuid); * * @param string $bytes * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws \InvalidArgumentException if string has not 16 characters */ public function decodeBytes($bytes); } diff --git a/vendor/ramsey/uuid/src/Codec/GuidStringCodec.php b/vendor/ramsey/uuid/src/Codec/GuidStringCodec.php index 380d94efe..864980b30 100644 --- a/vendor/ramsey/uuid/src/Codec/GuidStringCodec.php +++ b/vendor/ramsey/uuid/src/Codec/GuidStringCodec.php @@ -60,6 +60,7 @@ public function encodeBinary(UuidInterface $uuid) * * @param string $encodedUuid * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public function decode($encodedUuid) { @@ -75,6 +76,7 @@ public function decode($encodedUuid) * * @param string $bytes * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public function decodeBytes($bytes) { diff --git a/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php b/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php index cbbb75ea1..3257759c9 100644 --- a/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php +++ b/vendor/ramsey/uuid/src/Codec/OrderedTimeCodec.php @@ -50,6 +50,7 @@ public function encodeBinary(UuidInterface $uuid) * * @param string $bytes * @return UuidInterface + * @throws \InvalidArgumentException if string has not 16 characters */ public function decodeBytes($bytes) { diff --git a/vendor/ramsey/uuid/src/Codec/StringCodec.php b/vendor/ramsey/uuid/src/Codec/StringCodec.php index 46181964d..7f352065c 100644 --- a/vendor/ramsey/uuid/src/Codec/StringCodec.php +++ b/vendor/ramsey/uuid/src/Codec/StringCodec.php @@ -74,6 +74,7 @@ public function encodeBinary(UuidInterface $uuid) * * @param string $encodedUuid * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public function decode($encodedUuid) { @@ -88,6 +89,7 @@ public function decode($encodedUuid) * * @param string $bytes * @return UuidInterface + * @throws \InvalidArgumentException if string has not 16 characters */ public function decodeBytes($bytes) { @@ -115,6 +117,7 @@ protected function getBuilder() * * @param string $encodedUuid * @return array + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ protected function extractComponents($encodedUuid) { diff --git a/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php b/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php index c4434384f..2c4ded89e 100644 --- a/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php +++ b/vendor/ramsey/uuid/src/Codec/TimestampFirstCombCodec.php @@ -60,6 +60,7 @@ public function encodeBinary(UuidInterface $uuid) * @param string $encodedUuid * * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public function decode($encodedUuid) { @@ -76,6 +77,7 @@ public function decode($encodedUuid) * @param string $bytes * * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public function decodeBytes($bytes) { diff --git a/vendor/ramsey/uuid/src/Converter/NumberConverterInterface.php b/vendor/ramsey/uuid/src/Converter/NumberConverterInterface.php index 673c1df36..9505e8c6d 100644 --- a/vendor/ramsey/uuid/src/Converter/NumberConverterInterface.php +++ b/vendor/ramsey/uuid/src/Converter/NumberConverterInterface.php @@ -28,6 +28,7 @@ interface NumberConverterInterface * * @param string $hex The hexadecimal string representation to convert * @return mixed + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present */ public function fromHex($hex); @@ -39,6 +40,7 @@ public function fromHex($hex); * a true integer, a string integer, or a object representation that * this converter can understand * @return string Hexadecimal string + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present */ public function toHex($integer); } diff --git a/vendor/ramsey/uuid/src/Converter/Time/DegradedTimeConverter.php b/vendor/ramsey/uuid/src/Converter/Time/DegradedTimeConverter.php index 46edbe78e..b94589cd3 100644 --- a/vendor/ramsey/uuid/src/Converter/Time/DegradedTimeConverter.php +++ b/vendor/ramsey/uuid/src/Converter/Time/DegradedTimeConverter.php @@ -30,7 +30,7 @@ class DegradedTimeConverter implements TimeConverterInterface * @param string $seconds * @param string $microSeconds * @return void - * @throws UnsatisfiedDependencyException + * @throws UnsatisfiedDependencyException if called on a 32-bit system and `Moontoast\Math\BigNumber` is not present */ public function calculateTime($seconds, $microSeconds) { diff --git a/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php b/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php index f0688367b..382008ac3 100644 --- a/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php +++ b/vendor/ramsey/uuid/src/Converter/TimeConverterInterface.php @@ -27,6 +27,8 @@ interface TimeConverterInterface * @param string $seconds * @param string $microSeconds * @return string[] An array guaranteed to contain `low`, `mid`, and `high` keys + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and + * `Moontoast\Math\BigNumber` is not present * @link http://tools.ietf.org/html/rfc4122#section-4.2.2 */ public function calculateTime($seconds, $microSeconds); diff --git a/vendor/ramsey/uuid/src/DegradedUuid.php b/vendor/ramsey/uuid/src/DegradedUuid.php index b596c3883..bcf0be800 100644 --- a/vendor/ramsey/uuid/src/DegradedUuid.php +++ b/vendor/ramsey/uuid/src/DegradedUuid.php @@ -24,6 +24,9 @@ */ class DegradedUuid extends Uuid { + /** + * @inheritdoc + */ public function getDateTime() { if ($this->getVersion() != 1) { diff --git a/vendor/ramsey/uuid/src/Generator/CombGenerator.php b/vendor/ramsey/uuid/src/Generator/CombGenerator.php index 1a4277673..7a9482318 100644 --- a/vendor/ramsey/uuid/src/Generator/CombGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/CombGenerator.php @@ -53,6 +53,9 @@ public function __construct(RandomGeneratorInterface $generator, NumberConverter * * @param integer $length The number of bytes of random binary data to generate * @return string A binary string + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws \InvalidArgumentException if length is not a positive integer + * @throws \Exception */ public function generate($length) { diff --git a/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php b/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php index f05d81835..c9969b3af 100644 --- a/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/DefaultTimeGenerator.php @@ -72,6 +72,10 @@ public function __construct( * could arise when the clock is set backwards in time or if the node ID * changes. * @return string A binary string + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and + * `Moontoast\Math\BigNumber` is not present + * @throws \InvalidArgumentException + * @throws \Exception if it was not possible to gather sufficient entropy */ public function generate($node = null, $clockSeq = null) { @@ -111,6 +115,8 @@ public function generate($node = null, $clockSeq = null) * * @param string|int $node A node value that may be used to override the node provider * @return string Hexadecimal representation of the node ID + * @throws \InvalidArgumentException + * @throws \Exception */ protected function getValidNode($node) { diff --git a/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php b/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php index 1e8392abf..aaa285df0 100644 --- a/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php +++ b/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php @@ -28,6 +28,7 @@ class RandomBytesGenerator implements RandomGeneratorInterface * * @param integer $length The number of bytes of random binary data to generate * @return string A binary string + * @throws \Exception if it was not possible to gather sufficient entropy */ public function generate($length) { diff --git a/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php b/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php index 87ccbc954..3a1bcae7e 100644 --- a/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php +++ b/vendor/ramsey/uuid/src/Generator/RandomGeneratorInterface.php @@ -25,6 +25,9 @@ interface RandomGeneratorInterface * * @param integer $length The number of bytes of random binary data to generate * @return string A binary string + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws \InvalidArgumentException + * @throws \Exception if it was not possible to gather sufficient entropy */ public function generate($length); } diff --git a/vendor/ramsey/uuid/src/Generator/TimeGeneratorInterface.php b/vendor/ramsey/uuid/src/Generator/TimeGeneratorInterface.php index 1a56d5131..cb182ea00 100644 --- a/vendor/ramsey/uuid/src/Generator/TimeGeneratorInterface.php +++ b/vendor/ramsey/uuid/src/Generator/TimeGeneratorInterface.php @@ -30,6 +30,10 @@ interface TimeGeneratorInterface * could arise when the clock is set backwards in time or if the node ID * changes. * @return string A binary string + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and + * `Moontoast\Math\BigNumber` is not present + * @throws \InvalidArgumentException + * @throws \Exception if it was not possible to gather sufficient entropy */ public function generate($node = null, $clockSeq = null); } diff --git a/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php b/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php index e230e17a5..289fddeae 100644 --- a/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php +++ b/vendor/ramsey/uuid/src/Provider/Node/FallbackNodeProvider.php @@ -43,6 +43,7 @@ public function __construct(array $providers) * and returning the first non-empty value found * * @return string System node ID as a hexadecimal string + * @throws \Exception */ public function getNode() { diff --git a/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php b/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php index 1018554e2..76c570d7f 100644 --- a/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php +++ b/vendor/ramsey/uuid/src/Provider/Node/RandomNodeProvider.php @@ -28,6 +28,7 @@ class RandomNodeProvider implements NodeProviderInterface * Returns the system node ID * * @return string System node ID as a hexadecimal string + * @throws \Exception if it was not possible to gather sufficient entropy */ public function getNode() { diff --git a/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php b/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php index e1b28fcb8..ae6a09eaa 100644 --- a/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php +++ b/vendor/ramsey/uuid/src/Provider/Node/SystemNodeProvider.php @@ -62,6 +62,10 @@ public function getNode() */ protected function getIfconfig() { + if (strpos(strtolower(ini_get('disable_functions')), 'passthru') !== false) { + return ''; + } + ob_start(); switch (strtoupper(substr(php_uname('a'), 0, 3))) { case 'WIN': @@ -70,6 +74,9 @@ protected function getIfconfig() case 'DAR': passthru('ifconfig 2>&1'); break; + case 'FRE': + passthru('netstat -i -f link 2>&1'); + break; case 'LIN': default: passthru('netstat -ie 2>&1'); @@ -88,17 +95,16 @@ protected function getSysfs() { $mac = false; - if (strtoupper(php_uname('s')) === "LINUX") { + if (strtoupper(php_uname('s')) === 'LINUX') { $addressPaths = glob('/sys/class/net/*/address', GLOB_NOSORT); if (empty($addressPaths)) { return false; } - $macs = array_map( - 'file_get_contents', - $addressPaths - ); + array_walk($addressPaths, function ($addressPath) use (&$macs) { + $macs[] = file_get_contents($addressPath); + }); $macs = array_map('trim', $macs); diff --git a/vendor/ramsey/uuid/src/Provider/NodeProviderInterface.php b/vendor/ramsey/uuid/src/Provider/NodeProviderInterface.php index 864e8404f..14f747bea 100644 --- a/vendor/ramsey/uuid/src/Provider/NodeProviderInterface.php +++ b/vendor/ramsey/uuid/src/Provider/NodeProviderInterface.php @@ -24,6 +24,7 @@ interface NodeProviderInterface * Returns the system node ID * * @return string System node ID as a hexadecimal string + * @throws \Exception if it was not possible to gather sufficient entropy */ public function getNode(); } diff --git a/vendor/ramsey/uuid/src/Uuid.php b/vendor/ramsey/uuid/src/Uuid.php index fa07aa544..45f9fa448 100644 --- a/vendor/ramsey/uuid/src/Uuid.php +++ b/vendor/ramsey/uuid/src/Uuid.php @@ -229,6 +229,7 @@ public function serialize() * * @param string $serialized * @link http://php.net/manual/en/class.serializable.php + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public function unserialize($serialized) { @@ -332,6 +333,9 @@ public function getNumberConverter() return $this->converter; } + /** + * @inheritdoc + */ public function getDateTime() { if ($this->getVersion() != 1) { @@ -384,6 +388,9 @@ public function getHex() return str_replace('-', '', $this->toString()); } + /** + * @inheritdoc + */ public function getInteger() { return $this->converter->fromHex($this->getHex()); @@ -393,6 +400,7 @@ public function getInteger() * Returns the least significant 64 bits of this UUID's 128 bit value. * * @return mixed Converted representation of the unsigned 64-bit integer value + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present */ public function getLeastSignificantBits() { @@ -413,6 +421,7 @@ public function getLeastSignificantBitsHex() * Returns the most significant 64 bits of this UUID's 128 bit value. * * @return mixed Converted representation of the unsigned 64-bit integer value + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present */ public function getMostSignificantBits() { @@ -534,6 +543,9 @@ public function getTimestamp() return hexdec($this->getTimestampHex()); } + /** + * @inheritdoc + */ public function getTimestampHex() { if ($this->getVersion() != 1) { @@ -612,6 +624,8 @@ public static function setFactory(UuidFactoryInterface $factory) * * @param string $bytes * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws \InvalidArgumentException */ public static function fromBytes($bytes) { @@ -623,6 +637,7 @@ public static function fromBytes($bytes) * * @param string $name A string that specifies a UUID * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public static function fromString($name) { @@ -634,6 +649,8 @@ public static function fromString($name) * * @param string $integer String representation of 128-bit integer * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public static function fromInteger($integer) { @@ -654,7 +671,7 @@ public static function isValid($uuid) return true; } - if (!preg_match('/' . self::VALID_PATTERN . '/', $uuid)) { + if (!preg_match('/' . self::VALID_PATTERN . '/D', $uuid)) { return false; } @@ -670,6 +687,10 @@ public static function isValid($uuid) * could arise when the clock is set backwards in time or if the node ID * changes. * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and + * `Moontoast\Math\BigNumber` is not present + * @throws \InvalidArgumentException + * @throws \Exception if it was not possible to gather sufficient entropy */ public static function uuid1($node = null, $clockSeq = null) { @@ -683,6 +704,7 @@ public static function uuid1($node = null, $clockSeq = null) * @param string $ns The UUID namespace in which to create the named UUID * @param string $name The name to create a UUID for * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public static function uuid3($ns, $name) { @@ -693,6 +715,9 @@ public static function uuid3($ns, $name) * Generate a version 4 (random) UUID. * * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws \InvalidArgumentException + * @throws \Exception */ public static function uuid4() { @@ -706,6 +731,7 @@ public static function uuid4() * @param string $ns The UUID namespace in which to create the named UUID * @param string $name The name to create a UUID for * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public static function uuid5($ns, $name) { diff --git a/vendor/ramsey/uuid/src/UuidFactory.php b/vendor/ramsey/uuid/src/UuidFactory.php index 77d2383c3..99644d4b4 100644 --- a/vendor/ramsey/uuid/src/UuidFactory.php +++ b/vendor/ramsey/uuid/src/UuidFactory.php @@ -180,17 +180,26 @@ public function setUuidBuilder(UuidBuilderInterface $builder) $this->uuidBuilder = $builder; } + /** + * @inheritdoc + */ public function fromBytes($bytes) { return $this->codec->decodeBytes($bytes); } + /** + * @inheritdoc + */ public function fromString($uuid) { $uuid = strtolower($uuid); return $this->codec->decode($uuid); } + /** + * @inheritdoc + */ public function fromInteger($integer) { $hex = $this->numberConverter->toHex($integer); @@ -199,6 +208,9 @@ public function fromInteger($integer) return $this->fromString($hex); } + /** + * @inheritdoc + */ public function uuid1($node = null, $clockSeq = null) { $bytes = $this->timeGenerator->generate($node, $clockSeq); @@ -207,11 +219,17 @@ public function uuid1($node = null, $clockSeq = null) return $this->uuidFromHashedName($hex, 1); } + /** + * @inheritdoc + */ public function uuid3($ns, $name) { return $this->uuidFromNsAndName($ns, $name, 3, 'md5'); } + /** + * @inheritdoc + */ public function uuid4() { $bytes = $this->randomGenerator->generate(16); @@ -224,6 +242,9 @@ public function uuid4() return $this->uuidFromHashedName($hex, 4); } + /** + * @inheritdoc + */ public function uuid5($ns, $name) { return $this->uuidFromNsAndName($ns, $name, 5, 'sha1'); @@ -253,6 +274,7 @@ public function uuid(array $fields) * @param string $hashFunction The hash function to use when hashing together * the namespace and name * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ protected function uuidFromNsAndName($ns, $name, $version, $hashFunction) { diff --git a/vendor/ramsey/uuid/src/UuidFactoryInterface.php b/vendor/ramsey/uuid/src/UuidFactoryInterface.php index 6895ff2cf..a228f5bc7 100644 --- a/vendor/ramsey/uuid/src/UuidFactoryInterface.php +++ b/vendor/ramsey/uuid/src/UuidFactoryInterface.php @@ -23,12 +23,16 @@ interface UuidFactoryInterface /** * Generate a version 1 UUID from a host ID, sequence number, and the current time. * - * @param int|string $node A 48-bit number representing the hardware address + * @param int|string|null $node A 48-bit number representing the hardware address * This number may be represented as an integer or a hexadecimal string. - * @param int $clockSeq A 14-bit number used to help avoid duplicates that + * @param int|null $clockSeq A 14-bit number used to help avoid duplicates that * could arise when the clock is set backwards in time or if the node ID * changes. * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called on a 32-bit system and + * `Moontoast\Math\BigNumber` is not present + * @throws \InvalidArgumentException + * @throws \Exception if it was not possible to gather sufficient entropy */ public function uuid1($node = null, $clockSeq = null); @@ -39,6 +43,7 @@ public function uuid1($node = null, $clockSeq = null); * @param string $ns The UUID namespace in which to create the named UUID * @param string $name The name to create a UUID for * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public function uuid3($ns, $name); @@ -46,6 +51,9 @@ public function uuid3($ns, $name); * Generate a version 4 (random) UUID. * * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws \InvalidArgumentException + * @throws \Exception */ public function uuid4(); @@ -56,6 +64,7 @@ public function uuid4(); * @param string $ns The UUID namespace in which to create the named UUID * @param string $name The name to create a UUID for * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public function uuid5($ns, $name); @@ -64,6 +73,8 @@ public function uuid5($ns, $name); * * @param string $bytes A 16-byte string representation of a UUID * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException + * @throws \InvalidArgumentException if string has not 16 characters */ public function fromBytes($bytes); @@ -72,6 +83,7 @@ public function fromBytes($bytes); * * @param string $uuid A string representation of a UUID * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public function fromString($uuid); @@ -84,6 +96,8 @@ public function fromString($uuid); * @param mixed $integer The integer to use when creating a `Uuid` from an * integer; may be of any type understood by the configured number converter * @return UuidInterface + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present + * @throws \Ramsey\Uuid\Exception\InvalidUuidStringException */ public function fromInteger($integer); } diff --git a/vendor/ramsey/uuid/src/UuidInterface.php b/vendor/ramsey/uuid/src/UuidInterface.php index 792c32aad..ea3a46fb2 100644 --- a/vendor/ramsey/uuid/src/UuidInterface.php +++ b/vendor/ramsey/uuid/src/UuidInterface.php @@ -123,6 +123,8 @@ public function getClockSequenceHex(); * * @return \DateTime A PHP DateTime representation of the date * @throws UnsupportedOperationException If this UUID is not a version 1 UUID + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if called in a 32-bit system and + * `Moontoast\Math\BigNumber` is not present */ public function getDateTime(); @@ -131,6 +133,7 @@ public function getDateTime(); * representation. * * @return mixed Converted representation of the unsigned 128-bit integer value + * @throws \Ramsey\Uuid\Exception\UnsatisfiedDependencyException if `Moontoast\Math\BigNumber` is not present */ public function getInteger(); diff --git a/vendor/swiftmailer/swiftmailer/CHANGES b/vendor/swiftmailer/swiftmailer/CHANGES index 07fa342bc..3532ec2dc 100644 --- a/vendor/swiftmailer/swiftmailer/CHANGES +++ b/vendor/swiftmailer/swiftmailer/CHANGES @@ -1,6 +1,21 @@ Changelog ========= +5.4.12 (2018-07-31) +------------------- + + * fixed typo + +5.4.11 (2018-07-31) +------------------- + + * fixed startTLS support for PHP 5.6- + +5.4.10 (2018-07-27) +------------------- + + * fixed startTLS only allowed tls1.0, now allowed: tls1.0, tls1.1, tls1.2 + 5.4.9 (2018-01-23) ------------------ diff --git a/vendor/swiftmailer/swiftmailer/VERSION b/vendor/swiftmailer/swiftmailer/VERSION index 1842f65a0..82a2d1d04 100644 --- a/vendor/swiftmailer/swiftmailer/VERSION +++ b/vendor/swiftmailer/swiftmailer/VERSION @@ -1 +1 @@ -Swift-5.4.9 +Swift-5.4.12 diff --git a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php index 9f2fff4bf..3a9fe76b2 100644 --- a/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php +++ b/vendor/swiftmailer/swiftmailer/lib/classes/Swift/Transport/StreamBuffer.php @@ -91,7 +91,16 @@ public function setParam($param, $value) public function startTLS() { - return stream_socket_enable_crypto($this->_stream, true, STREAM_CRYPTO_METHOD_TLS_CLIENT); + // STREAM_CRYPTO_METHOD_TLS_CLIENT only allow tls1.0 connections (some php versions) + // To support modern tls we allow explicit tls1.0, tls1.1, tls1.2 + // Ssl3 and older are not allowed because they are vulnerable + // @TODO make tls arguments configurable + $cryptoType = STREAM_CRYPTO_METHOD_TLS_CLIENT; + if (PHP_VERSION_ID >= 50600) { + $cryptoType = STREAM_CRYPTO_METHOD_TLSv1_0_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT; + } + + return stream_socket_enable_crypto($this->_stream, true, $cryptoType); } /** diff --git a/vendor/symfony/config/ConfigCacheFactory.php b/vendor/symfony/config/ConfigCacheFactory.php index 06dbe6c29..7903cca93 100644 --- a/vendor/symfony/config/ConfigCacheFactory.php +++ b/vendor/symfony/config/ConfigCacheFactory.php @@ -37,13 +37,13 @@ public function __construct($debug) */ public function cache($file, $callback) { - if (!is_callable($callback)) { - throw new \InvalidArgumentException(sprintf('Invalid type for callback argument. Expected callable, but got "%s".', gettype($callback))); + if (!\is_callable($callback)) { + throw new \InvalidArgumentException(sprintf('Invalid type for callback argument. Expected callable, but got "%s".', \gettype($callback))); } $cache = new ConfigCache($file, $this->debug); if (!$cache->isFresh()) { - call_user_func($callback, $cache); + \call_user_func($callback, $cache); } return $cache; diff --git a/vendor/symfony/config/ConfigCacheFactoryInterface.php b/vendor/symfony/config/ConfigCacheFactoryInterface.php index bd614c4b6..8e80142b7 100644 --- a/vendor/symfony/config/ConfigCacheFactoryInterface.php +++ b/vendor/symfony/config/ConfigCacheFactoryInterface.php @@ -26,7 +26,7 @@ interface ConfigCacheFactoryInterface * @param string $file The absolute cache file path * @param callable $callable The callable to be executed when the cache needs to be filled (i. e. is not fresh). The cache will be passed as the only parameter to this callback * - * @return ConfigCacheInterface $configCache The cache instance + * @return ConfigCacheInterface The cache instance */ public function cache($file, $callable); } diff --git a/vendor/symfony/config/Definition/ArrayNode.php b/vendor/symfony/config/Definition/ArrayNode.php index 5f51a5da4..25d9cfc5e 100644 --- a/vendor/symfony/config/Definition/ArrayNode.php +++ b/vendor/symfony/config/Definition/ArrayNode.php @@ -52,7 +52,7 @@ public function setNormalizeKeys($normalizeKeys) */ protected function preNormalize($value) { - if (!$this->normalizeKeys || !is_array($value)) { + if (!$this->normalizeKeys || !\is_array($value)) { return $value; } @@ -92,7 +92,7 @@ public function setXmlRemappings(array $remappings) /** * Gets the xml remappings that should be performed. * - * @return array $remappings an array of the form array(array(string, string)) + * @return array an array of the form array(array(string, string)) */ public function getXmlRemappings() { @@ -196,7 +196,7 @@ public function getDefaultValue() public function addChild(NodeInterface $node) { $name = $node->getName(); - if (!strlen($name)) { + if (!\strlen($name)) { throw new \InvalidArgumentException('Child nodes must be named.'); } if (isset($this->children[$name])) { @@ -219,15 +219,13 @@ public function addChild(NodeInterface $node) protected function finalizeValue($value) { if (false === $value) { - $msg = sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value)); - throw new UnsetKeyException($msg); + throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value))); } foreach ($this->children as $name => $child) { if (!array_key_exists($name, $value)) { if ($child->isRequired()) { - $msg = sprintf('The child node "%s" at path "%s" must be configured.', $name, $this->getPath()); - $ex = new InvalidConfigurationException($msg); + $ex = new InvalidConfigurationException(sprintf('The child node "%s" at path "%s" must be configured.', $name, $this->getPath())); $ex->setPath($this->getPath()); throw $ex; @@ -263,12 +261,8 @@ protected function finalizeValue($value) */ protected function validateType($value) { - if (!is_array($value) && (!$this->allowFalse || false !== $value)) { - $ex = new InvalidTypeException(sprintf( - 'Invalid type for path "%s". Expected array, but got %s', - $this->getPath(), - gettype($value) - )); + if (!\is_array($value) && (!$this->allowFalse || false !== $value)) { + $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected array, but got %s', $this->getPath(), \gettype($value))); if ($hint = $this->getInfo()) { $ex->addHint($hint); } @@ -298,7 +292,10 @@ protected function normalizeValue($value) $normalized = array(); foreach ($value as $name => $val) { if (isset($this->children[$name])) { - $normalized[$name] = $this->children[$name]->normalize($val); + try { + $normalized[$name] = $this->children[$name]->normalize($val); + } catch (UnsetKeyException $e) { + } unset($value[$name]); } elseif (!$this->removeExtraKeys) { $normalized[$name] = $val; @@ -306,9 +303,8 @@ protected function normalizeValue($value) } // if extra fields are present, throw exception - if (count($value) && !$this->ignoreExtraKeys) { - $msg = sprintf('Unrecognized option%s "%s" under "%s"', 1 === count($value) ? '' : 's', implode(', ', array_keys($value)), $this->getPath()); - $ex = new InvalidConfigurationException($msg); + if (\count($value) && !$this->ignoreExtraKeys) { + $ex = new InvalidConfigurationException(sprintf('Unrecognized option%s "%s" under "%s"', 1 === \count($value) ? '' : 's', implode(', ', array_keys($value)), $this->getPath())); $ex->setPath($this->getPath()); throw $ex; @@ -365,13 +361,7 @@ protected function mergeValues($leftSide, $rightSide) // no conflict if (!array_key_exists($k, $leftSide)) { if (!$this->allowNewKeys) { - $ex = new InvalidConfigurationException(sprintf( - 'You are not allowed to define new elements for path "%s". ' - .'Please define all elements for this path in one config file. ' - .'If you are trying to overwrite an element, make sure you redefine it ' - .'with the same name.', - $this->getPath() - )); + $ex = new InvalidConfigurationException(sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file. If you are trying to overwrite an element, make sure you redefine it with the same name.', $this->getPath())); $ex->setPath($this->getPath()); throw $ex; diff --git a/vendor/symfony/config/Definition/BaseNode.php b/vendor/symfony/config/Definition/BaseNode.php index 010098fcb..d3f0f96e3 100644 --- a/vendor/symfony/config/Definition/BaseNode.php +++ b/vendor/symfony/config/Definition/BaseNode.php @@ -242,12 +242,7 @@ public function getPath() final public function merge($leftSide, $rightSide) { if (!$this->allowOverwrite) { - throw new ForbiddenOverwriteException(sprintf( - 'Configuration path "%s" cannot be overwritten. You have to ' - .'define all options for this path, and any of its sub-paths in ' - .'one configuration section.', - $this->getPath() - )); + throw new ForbiddenOverwriteException(sprintf('Configuration path "%s" cannot be overwritten. You have to define all options for this path, and any of its sub-paths in one configuration section.', $this->getPath())); } $this->validateType($leftSide); @@ -287,7 +282,7 @@ final public function normalize($value) * * @param $value * - * @return $value The normalized array value + * @return The normalized array value */ protected function preNormalize($value) { diff --git a/vendor/symfony/config/Definition/BooleanNode.php b/vendor/symfony/config/Definition/BooleanNode.php index 08e1a7730..85f467b6b 100644 --- a/vendor/symfony/config/Definition/BooleanNode.php +++ b/vendor/symfony/config/Definition/BooleanNode.php @@ -25,12 +25,8 @@ class BooleanNode extends ScalarNode */ protected function validateType($value) { - if (!is_bool($value)) { - $ex = new InvalidTypeException(sprintf( - 'Invalid type for path "%s". Expected boolean, but got %s.', - $this->getPath(), - gettype($value) - )); + if (!\is_bool($value)) { + $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected boolean, but got %s.', $this->getPath(), \gettype($value))); if ($hint = $this->getInfo()) { $ex->addHint($hint); } diff --git a/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php b/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php index 7a0439f1a..28a00be09 100644 --- a/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php +++ b/vendor/symfony/config/Definition/Builder/ArrayNodeDefinition.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Config\Definition\Builder; use Symfony\Component\Config\Definition\ArrayNode; -use Symfony\Component\Config\Definition\PrototypedArrayNode; use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; +use Symfony\Component\Config\Definition\PrototypedArrayNode; /** * This class provides a fluent interface for defining an array node. @@ -472,9 +472,7 @@ protected function validateConcreteNode(ArrayNode $node) $path = $node->getPath(); if (null !== $this->key) { - throw new InvalidDefinitionException( - sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('->useAttributeAsKey() is not applicable to concrete nodes at path "%s"', $path)); } if (false === $this->allowEmptyValue) { @@ -482,21 +480,15 @@ protected function validateConcreteNode(ArrayNode $node) } if (true === $this->atLeastOne) { - throw new InvalidDefinitionException( - sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('->requiresAtLeastOneElement() is not applicable to concrete nodes at path "%s"', $path)); } if ($this->default) { - throw new InvalidDefinitionException( - sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('->defaultValue() is not applicable to concrete nodes at path "%s"', $path)); } if (false !== $this->addDefaultChildren) { - throw new InvalidDefinitionException( - sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() is not applicable to concrete nodes at path "%s"', $path)); } } @@ -510,28 +502,20 @@ protected function validatePrototypeNode(PrototypedArrayNode $node) $path = $node->getPath(); if ($this->addDefaults) { - throw new InvalidDefinitionException( - sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('->addDefaultsIfNotSet() is not applicable to prototype nodes at path "%s"', $path)); } if (false !== $this->addDefaultChildren) { if ($this->default) { - throw new InvalidDefinitionException( - sprintf('A default value and default children might not be used together at path "%s"', $path) - ); + throw new InvalidDefinitionException(sprintf('A default value and default children might not be used together at path "%s"', $path)); } - if (null !== $this->key && (null === $this->addDefaultChildren || is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) { - throw new InvalidDefinitionException( - sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path) - ); + if (null !== $this->key && (null === $this->addDefaultChildren || \is_int($this->addDefaultChildren) && $this->addDefaultChildren > 0)) { + throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() should set default children names as ->useAttributeAsKey() is used at path "%s"', $path)); } - if (null === $this->key && (is_string($this->addDefaultChildren) || is_array($this->addDefaultChildren))) { - throw new InvalidDefinitionException( - sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s"', $path) - ); + if (null === $this->key && (\is_string($this->addDefaultChildren) || \is_array($this->addDefaultChildren))) { + throw new InvalidDefinitionException(sprintf('->addDefaultChildrenIfNoneSet() might not set default children names as ->useAttributeAsKey() is not used at path "%s"', $path)); } } } diff --git a/vendor/symfony/config/Definition/Builder/ExprBuilder.php b/vendor/symfony/config/Definition/Builder/ExprBuilder.php index 64c0f5578..7ba19515b 100644 --- a/vendor/symfony/config/Definition/Builder/ExprBuilder.php +++ b/vendor/symfony/config/Definition/Builder/ExprBuilder.php @@ -71,7 +71,7 @@ public function ifTrue(\Closure $closure = null) */ public function ifString() { - $this->ifPart = function ($v) { return is_string($v); }; + $this->ifPart = function ($v) { return \is_string($v); }; return $this; } @@ -107,7 +107,7 @@ public function ifEmpty() */ public function ifArray() { - $this->ifPart = function ($v) { return is_array($v); }; + $this->ifPart = function ($v) { return \is_array($v); }; return $this; } @@ -119,7 +119,7 @@ public function ifArray() */ public function ifInArray(array $array) { - $this->ifPart = function ($v) use ($array) { return in_array($v, $array, true); }; + $this->ifPart = function ($v) use ($array) { return \in_array($v, $array, true); }; return $this; } @@ -131,7 +131,7 @@ public function ifInArray(array $array) */ public function ifNotInArray(array $array) { - $this->ifPart = function ($v) use ($array) { return !in_array($v, $array, true); }; + $this->ifPart = function ($v) use ($array) { return !\in_array($v, $array, true); }; return $this; } @@ -143,7 +143,7 @@ public function ifNotInArray(array $array) */ public function castToArray() { - $this->ifPart = function ($v) { return !is_array($v); }; + $this->ifPart = function ($v) { return !\is_array($v); }; $this->thenPart = function ($v) { return array($v); }; return $this; @@ -174,7 +174,7 @@ public function thenEmptyArray() } /** - * Sets a closure marking the value as invalid at validation time. + * Sets a closure marking the value as invalid at processing time. * * if you want to add the value of the node in your message just use a %s placeholder. * @@ -192,7 +192,7 @@ public function thenInvalid($message) } /** - * Sets a closure unsetting this key of the array at validation time. + * Sets a closure unsetting this key of the array at processing time. * * @return $this * diff --git a/vendor/symfony/config/Definition/Builder/NodeBuilder.php b/vendor/symfony/config/Definition/Builder/NodeBuilder.php index 1fac66fd3..95863d68f 100644 --- a/vendor/symfony/config/Definition/Builder/NodeBuilder.php +++ b/vendor/symfony/config/Definition/Builder/NodeBuilder.php @@ -133,7 +133,7 @@ public function variableNode($name) /** * Returns the parent node. * - * @return ParentNodeDefinitionInterface|NodeDefinition The parent node + * @return NodeDefinition&ParentNodeDefinitionInterface The parent node */ public function end() { diff --git a/vendor/symfony/config/Definition/Builder/NodeDefinition.php b/vendor/symfony/config/Definition/Builder/NodeDefinition.php index 7dcfd5164..3a4d2cdf0 100644 --- a/vendor/symfony/config/Definition/Builder/NodeDefinition.php +++ b/vendor/symfony/config/Definition/Builder/NodeDefinition.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Config\Definition\Builder; -use Symfony\Component\Config\Definition\NodeInterface; use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; +use Symfony\Component\Config\Definition\NodeInterface; /** * This class provides a fluent interface for defining a node. @@ -345,7 +345,7 @@ protected function normalization() /** * Instantiate and configure the node according to this definition. * - * @return NodeInterface $node The node instance + * @return NodeInterface The node instance * * @throws InvalidDefinitionException When the definition is invalid */ diff --git a/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php b/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php index f78bc7c3a..881457c92 100644 --- a/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php +++ b/vendor/symfony/config/Definition/Dumper/XmlReferenceDumper.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Config\Definition\Dumper; -use Symfony\Component\Config\Definition\ConfigurationInterface; -use Symfony\Component\Config\Definition\NodeInterface; use Symfony\Component\Config\Definition\ArrayNode; +use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Definition\EnumNode; +use Symfony\Component\Config\Definition\NodeInterface; use Symfony\Component\Config\Definition\PrototypedArrayNode; /** @@ -58,7 +58,7 @@ private function writeNode(NodeInterface $node, $depth = 0, $root = false, $name return $rootName === $mapping[1]; }); - if (count($remapping)) { + if (\count($remapping)) { list($singular) = current($remapping); $rootName = $singular; } @@ -105,7 +105,7 @@ private function writeNode(NodeInterface $node, $depth = 0, $root = false, $name if ($prototype->hasDefaultValue()) { $prototypeValue = $prototype->getDefaultValue(); } else { - switch (get_class($prototype)) { + switch (\get_class($prototype)) { case 'Symfony\Component\Config\Definition\ScalarNode': $prototypeValue = 'scalar value'; break; @@ -161,7 +161,7 @@ private function writeNode(NodeInterface $node, $depth = 0, $root = false, $name $comments[] = 'One of '.implode('; ', array_map('json_encode', $child->getValues())); } - if (count($comments)) { + if (\count($comments)) { $rootAttributeComments[$name] = implode(";\n", $comments); } @@ -182,18 +182,18 @@ private function writeNode(NodeInterface $node, $depth = 0, $root = false, $name // render comments // root node comment - if (count($rootComments)) { + if (\count($rootComments)) { foreach ($rootComments as $comment) { $this->writeLine('', $depth); } } // attribute comments - if (count($rootAttributeComments)) { + if (\count($rootAttributeComments)) { foreach ($rootAttributeComments as $attrName => $comment) { - $commentDepth = $depth + 4 + strlen($attrName) + 2; + $commentDepth = $depth + 4 + \strlen($attrName) + 2; $commentLines = explode("\n", $comment); - $multiline = (count($commentLines) > 1); + $multiline = (\count($commentLines) > 1); $comment = implode(PHP_EOL.str_repeat(' ', $commentDepth), $commentLines); if ($multiline) { @@ -208,9 +208,9 @@ private function writeNode(NodeInterface $node, $depth = 0, $root = false, $name // render start tag + attributes $rootIsVariablePrototype = isset($prototypeValue); - $rootIsEmptyTag = (0 === count($rootChildren) && !$rootIsVariablePrototype); + $rootIsEmptyTag = (0 === \count($rootChildren) && !$rootIsVariablePrototype); $rootOpenTag = '<'.$rootName; - if (1 >= ($attributesCount = count($rootAttributes))) { + if (1 >= ($attributesCount = \count($rootAttributes))) { if (1 === $attributesCount) { $rootOpenTag .= sprintf(' %s="%s"', current(array_keys($rootAttributes)), $this->writeValue(current($rootAttributes))); } @@ -265,7 +265,7 @@ private function writeNode(NodeInterface $node, $depth = 0, $root = false, $name */ private function writeLine($text, $indent = 0) { - $indent = strlen($text) + $indent; + $indent = \strlen($text) + $indent; $format = '%'.$indent.'s'; $this->reference .= sprintf($format, $text).PHP_EOL; @@ -284,7 +284,7 @@ private function writeValue($value) return ''; } - if (is_string($value) || is_numeric($value)) { + if (\is_string($value) || is_numeric($value)) { return $value; } @@ -304,7 +304,7 @@ private function writeValue($value) return ''; } - if (is_array($value)) { + if (\is_array($value)) { return implode(',', $value); } } diff --git a/vendor/symfony/config/Definition/Dumper/YamlReferenceDumper.php b/vendor/symfony/config/Definition/Dumper/YamlReferenceDumper.php index 5a0e76c52..fc5d20a2e 100644 --- a/vendor/symfony/config/Definition/Dumper/YamlReferenceDumper.php +++ b/vendor/symfony/config/Definition/Dumper/YamlReferenceDumper.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Config\Definition\Dumper; -use Symfony\Component\Config\Definition\ConfigurationInterface; -use Symfony\Component\Config\Definition\NodeInterface; use Symfony\Component\Config\Definition\ArrayNode; +use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Definition\EnumNode; +use Symfony\Component\Config\Definition\NodeInterface; use Symfony\Component\Config\Definition\PrototypedArrayNode; use Symfony\Component\Config\Definition\ScalarNode; use Symfony\Component\Yaml\Inline; @@ -92,9 +92,9 @@ private function writeNode(NodeInterface $node, NodeInterface $parentNode = null } if (!$children) { - if ($node->hasDefaultValue() && count($defaultArray = $node->getDefaultValue())) { + if ($node->hasDefaultValue() && \count($defaultArray = $node->getDefaultValue())) { $default = ''; - } elseif (!is_array($example)) { + } elseif (!\is_array($example)) { $default = '[]'; } } @@ -107,10 +107,10 @@ private function writeNode(NodeInterface $node, NodeInterface $parentNode = null if ($node->hasDefaultValue()) { $default = $node->getDefaultValue(); - if (is_array($default)) { - if (count($defaultArray = $node->getDefaultValue())) { + if (\is_array($default)) { + if (\count($defaultArray = $node->getDefaultValue())) { $default = ''; - } elseif (!is_array($example)) { + } elseif (!\is_array($example)) { $default = '[]'; } } else { @@ -130,12 +130,12 @@ private function writeNode(NodeInterface $node, NodeInterface $parentNode = null } // example - if ($example && !is_array($example)) { + if ($example && !\is_array($example)) { $comments[] = 'Example: '.$example; } $default = '' != (string) $default ? ' '.$default : ''; - $comments = count($comments) ? '# '.implode(', ', $comments) : ''; + $comments = \count($comments) ? '# '.implode(', ', $comments) : ''; $key = $prototypedArray ? '-' : $node->getName().':'; $text = rtrim(sprintf('%-21s%s %s', $key, $default, $comments), ' '); @@ -153,17 +153,17 @@ private function writeNode(NodeInterface $node, NodeInterface $parentNode = null if ($defaultArray) { $this->writeLine(''); - $message = count($defaultArray) > 1 ? 'Defaults' : 'Default'; + $message = \count($defaultArray) > 1 ? 'Defaults' : 'Default'; $this->writeLine('# '.$message.':', $depth * 4 + 4); $this->writeArray($defaultArray, $depth + 1); } - if (is_array($example)) { + if (\is_array($example)) { $this->writeLine(''); - $message = count($example) > 1 ? 'Examples' : 'Example'; + $message = \count($example) > 1 ? 'Examples' : 'Example'; $this->writeLine('# '.$message.':', $depth * 4 + 4); @@ -185,7 +185,7 @@ private function writeNode(NodeInterface $node, NodeInterface $parentNode = null */ private function writeLine($text, $indent = 0) { - $indent = strlen($text) + $indent; + $indent = \strlen($text) + $indent; $format = '%'.$indent.'s'; $this->reference .= sprintf($format, $text)."\n"; @@ -196,7 +196,7 @@ private function writeArray(array $array, $depth) $isIndexed = array_values($array) === $array; foreach ($array as $key => $value) { - if (is_array($value)) { + if (\is_array($value)) { $val = ''; } else { $val = $value; @@ -208,7 +208,7 @@ private function writeArray(array $array, $depth) $this->writeLine(sprintf('%-20s %s', $key.':', $val), $depth * 4); } - if (is_array($value)) { + if (\is_array($value)) { $this->writeArray($value, $depth + 1); } } diff --git a/vendor/symfony/config/Definition/EnumNode.php b/vendor/symfony/config/Definition/EnumNode.php index 9b4c4156e..a214a854b 100644 --- a/vendor/symfony/config/Definition/EnumNode.php +++ b/vendor/symfony/config/Definition/EnumNode.php @@ -42,12 +42,8 @@ protected function finalizeValue($value) { $value = parent::finalizeValue($value); - if (!in_array($value, $this->values, true)) { - $ex = new InvalidConfigurationException(sprintf( - 'The value %s is not allowed for path "%s". Permissible values: %s', - json_encode($value), - $this->getPath(), - implode(', ', array_map('json_encode', $this->values)))); + if (!\in_array($value, $this->values, true)) { + $ex = new InvalidConfigurationException(sprintf('The value %s is not allowed for path "%s". Permissible values: %s', json_encode($value), $this->getPath(), implode(', ', array_map('json_encode', $this->values)))); $ex->setPath($this->getPath()); throw $ex; diff --git a/vendor/symfony/config/Definition/FloatNode.php b/vendor/symfony/config/Definition/FloatNode.php index 5e1af17ad..9eb878995 100644 --- a/vendor/symfony/config/Definition/FloatNode.php +++ b/vendor/symfony/config/Definition/FloatNode.php @@ -26,12 +26,12 @@ class FloatNode extends NumericNode protected function validateType($value) { // Integers are also accepted, we just cast them - if (is_int($value)) { + if (\is_int($value)) { $value = (float) $value; } - if (!is_float($value)) { - $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected float, but got %s.', $this->getPath(), gettype($value))); + if (!\is_float($value)) { + $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected float, but got %s.', $this->getPath(), \gettype($value))); if ($hint = $this->getInfo()) { $ex->addHint($hint); } diff --git a/vendor/symfony/config/Definition/IntegerNode.php b/vendor/symfony/config/Definition/IntegerNode.php index ba2307024..8ec068a84 100644 --- a/vendor/symfony/config/Definition/IntegerNode.php +++ b/vendor/symfony/config/Definition/IntegerNode.php @@ -25,8 +25,8 @@ class IntegerNode extends NumericNode */ protected function validateType($value) { - if (!is_int($value)) { - $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected int, but got %s.', $this->getPath(), gettype($value))); + if (!\is_int($value)) { + $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected int, but got %s.', $this->getPath(), \gettype($value))); if ($hint = $this->getInfo()) { $ex->addHint($hint); } diff --git a/vendor/symfony/config/Definition/Processor.php b/vendor/symfony/config/Definition/Processor.php index 025e69378..3e0feab86 100644 --- a/vendor/symfony/config/Definition/Processor.php +++ b/vendor/symfony/config/Definition/Processor.php @@ -84,7 +84,7 @@ public static function normalizeConfig($config, $key, $plural = null) } if (isset($config[$key])) { - if (is_string($config[$key]) || !is_int(key($config[$key]))) { + if (\is_string($config[$key]) || !\is_int(key($config[$key]))) { // only one return array($config[$key]); } diff --git a/vendor/symfony/config/Definition/PrototypedArrayNode.php b/vendor/symfony/config/Definition/PrototypedArrayNode.php index d377b73e6..eddcb32a7 100644 --- a/vendor/symfony/config/Definition/PrototypedArrayNode.php +++ b/vendor/symfony/config/Definition/PrototypedArrayNode.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Config\Definition; -use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; use Symfony\Component\Config\Definition\Exception\DuplicateKeyException; -use Symfony\Component\Config\Definition\Exception\UnsetKeyException; use Symfony\Component\Config\Definition\Exception\Exception; +use Symfony\Component\Config\Definition\Exception\InvalidConfigurationException; +use Symfony\Component\Config\Definition\Exception\UnsetKeyException; /** * Represents a prototyped Array node in the config tree. @@ -94,7 +94,7 @@ public function getKeyAttribute() */ public function setDefaultValue($value) { - if (!is_array($value)) { + if (!\is_array($value)) { throw new \InvalidArgumentException($this->getPath().': the default value of an array node has to be an array.'); } @@ -119,7 +119,7 @@ public function setAddChildrenIfNoneSet($children = array('defaults')) if (null === $children) { $this->defaultChildren = array('defaults'); } else { - $this->defaultChildren = is_int($children) && $children > 0 ? range(1, $children) : (array) $children; + $this->defaultChildren = \is_int($children) && $children > 0 ? range(1, $children) : (array) $children; } } @@ -185,8 +185,7 @@ public function addChild(NodeInterface $node) protected function finalizeValue($value) { if (false === $value) { - $msg = sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value)); - throw new UnsetKeyException($msg); + throw new UnsetKeyException(sprintf('Unsetting key for path "%s", value: %s', $this->getPath(), json_encode($value))); } foreach ($value as $k => $v) { @@ -198,9 +197,8 @@ protected function finalizeValue($value) } } - if (count($value) < $this->minNumberOfElements) { - $msg = sprintf('The path "%s" should have at least %d element(s) defined.', $this->getPath(), $this->minNumberOfElements); - $ex = new InvalidConfigurationException($msg); + if (\count($value) < $this->minNumberOfElements) { + $ex = new InvalidConfigurationException(sprintf('The path "%s" should have at least %d element(s) defined.', $this->getPath(), $this->minNumberOfElements)); $ex->setPath($this->getPath()); throw $ex; @@ -227,13 +225,12 @@ protected function normalizeValue($value) $value = $this->remapXml($value); - $isAssoc = array_keys($value) !== range(0, count($value) - 1); + $isAssoc = array_keys($value) !== range(0, \count($value) - 1); $normalized = array(); foreach ($value as $k => $v) { - if (null !== $this->keyAttribute && is_array($v)) { - if (!isset($v[$this->keyAttribute]) && is_int($k) && !$isAssoc) { - $msg = sprintf('The attribute "%s" must be set for path "%s".', $this->keyAttribute, $this->getPath()); - $ex = new InvalidConfigurationException($msg); + if (null !== $this->keyAttribute && \is_array($v)) { + if (!isset($v[$this->keyAttribute]) && \is_int($k) && !$isAssoc) { + $ex = new InvalidConfigurationException(sprintf('The attribute "%s" must be set for path "%s".', $this->keyAttribute, $this->getPath())); $ex->setPath($this->getPath()); throw $ex; @@ -252,9 +249,9 @@ protected function normalizeValue($value) $valuePrototype = current($this->valuePrototypes) ?: clone $children['value']; $valuePrototype->parent = $this; $originalClosures = $this->prototype->normalizationClosures; - if (is_array($originalClosures)) { + if (\is_array($originalClosures)) { $valuePrototypeClosures = $valuePrototype->normalizationClosures; - $valuePrototype->normalizationClosures = is_array($valuePrototypeClosures) ? array_merge($originalClosures, $valuePrototypeClosures) : $originalClosures; + $valuePrototype->normalizationClosures = \is_array($valuePrototypeClosures) ? array_merge($originalClosures, $valuePrototypeClosures) : $originalClosures; } $this->valuePrototypes[$k] = $valuePrototype; } @@ -262,8 +259,7 @@ protected function normalizeValue($value) } if (array_key_exists($k, $normalized)) { - $msg = sprintf('Duplicate key "%s" for path "%s".', $k, $this->getPath()); - $ex = new DuplicateKeyException($msg); + $ex = new DuplicateKeyException(sprintf('Duplicate key "%s" for path "%s".', $k, $this->getPath())); $ex->setPath($this->getPath()); throw $ex; @@ -314,11 +310,7 @@ protected function mergeValues($leftSide, $rightSide) // no conflict if (!array_key_exists($k, $leftSide)) { if (!$this->allowNewKeys) { - $ex = new InvalidConfigurationException(sprintf( - 'You are not allowed to define new elements for path "%s". '. - 'Please define all elements for this path in one config file.', - $this->getPath() - )); + $ex = new InvalidConfigurationException(sprintf('You are not allowed to define new elements for path "%s". Please define all elements for this path in one config file.', $this->getPath())); $ex->setPath($this->getPath()); throw $ex; @@ -342,27 +334,31 @@ protected function mergeValues($leftSide, $rightSide) * one is same as this->keyAttribute and the other is 'value', then the prototype will be different. * * For example, assume $this->keyAttribute is 'name' and the value array is as follows: - * array( + * * array( - * 'name' => 'name001', - * 'value' => 'value001' + * array( + * 'name' => 'name001', + * 'value' => 'value001' + * ) * ) - * ) * * Now, the key is 0 and the child node is: - * array( - * 'name' => 'name001', - * 'value' => 'value001' - * ) + * + * array( + * 'name' => 'name001', + * 'value' => 'value001' + * ) * * When normalizing the value array, the 'name' element will removed from the child node * and its value becomes the new key of the child node: - * array( - * 'name001' => array('value' => 'value001') - * ) + * + * array( + * 'name001' => array('value' => 'value001') + * ) * * Now only 'value' element is left in the child node which can be further simplified into a string: - * array('name001' => 'value001') + * + * array('name001' => 'value001') * * Now, the key becomes 'name001' and the child node becomes 'value001' and * the prototype of child node 'name001' should be a ScalarNode instead of an ArrayNode instance. diff --git a/vendor/symfony/config/Definition/ScalarNode.php b/vendor/symfony/config/Definition/ScalarNode.php index 6b3fd0b68..53c1ed29c 100644 --- a/vendor/symfony/config/Definition/ScalarNode.php +++ b/vendor/symfony/config/Definition/ScalarNode.php @@ -33,11 +33,7 @@ class ScalarNode extends VariableNode protected function validateType($value) { if (!is_scalar($value) && null !== $value) { - $ex = new InvalidTypeException(sprintf( - 'Invalid type for path "%s". Expected scalar, but got %s.', - $this->getPath(), - gettype($value) - )); + $ex = new InvalidTypeException(sprintf('Invalid type for path "%s". Expected scalar, but got %s.', $this->getPath(), \gettype($value))); if ($hint = $this->getInfo()) { $ex->addHint($hint); } diff --git a/vendor/symfony/config/Definition/VariableNode.php b/vendor/symfony/config/Definition/VariableNode.php index 0cd84c72b..1a3442d96 100644 --- a/vendor/symfony/config/Definition/VariableNode.php +++ b/vendor/symfony/config/Definition/VariableNode.php @@ -82,11 +82,7 @@ protected function validateType($value) protected function finalizeValue($value) { if (!$this->allowEmptyValue && $this->isValueEmpty($value)) { - $ex = new InvalidConfigurationException(sprintf( - 'The path "%s" cannot contain an empty value, but got %s.', - $this->getPath(), - json_encode($value) - )); + $ex = new InvalidConfigurationException(sprintf('The path "%s" cannot contain an empty value, but got %s.', $this->getPath(), json_encode($value))); if ($hint = $this->getInfo()) { $ex->addHint($hint); } diff --git a/vendor/symfony/config/Exception/FileLoaderLoadException.php b/vendor/symfony/config/Exception/FileLoaderLoadException.php index a19069a6a..e74bd673d 100644 --- a/vendor/symfony/config/Exception/FileLoaderLoadException.php +++ b/vendor/symfony/config/Exception/FileLoaderLoadException.php @@ -57,7 +57,7 @@ public function __construct($resource, $sourceResource = null, $code = null, $pr // Is the resource located inside a bundle? if ('@' === $resource[0]) { - $parts = explode(DIRECTORY_SEPARATOR, $resource); + $parts = explode(\DIRECTORY_SEPARATOR, $resource); $bundle = substr($parts[0], 1); $message .= sprintf(' Make sure the "%s" bundle is correctly registered and loaded in the application kernel class.', $bundle); $message .= sprintf(' If the bundle is registered, make sure the bundle path "%s" is not empty.', $resource); @@ -75,11 +75,11 @@ public function __construct($resource, $sourceResource = null, $code = null, $pr protected function varToString($var) { - if (is_object($var)) { - return sprintf('Object(%s)', get_class($var)); + if (\is_object($var)) { + return sprintf('Object(%s)', \get_class($var)); } - if (is_array($var)) { + if (\is_array($var)) { $a = array(); foreach ($var as $k => $v) { $a[] = sprintf('%s => %s', $k, $this->varToString($v)); @@ -88,7 +88,7 @@ protected function varToString($var) return sprintf('Array(%s)', implode(', ', $a)); } - if (is_resource($var)) { + if (\is_resource($var)) { return sprintf('Resource(%s)', get_resource_type($var)); } diff --git a/vendor/symfony/config/FileLocator.php b/vendor/symfony/config/FileLocator.php index f5593cbbe..2c9cea047 100644 --- a/vendor/symfony/config/FileLocator.php +++ b/vendor/symfony/config/FileLocator.php @@ -57,7 +57,7 @@ public function locate($name, $currentPath = null, $first = true) $filepaths = $notfound = array(); foreach ($paths as $path) { - if (@file_exists($file = $path.DIRECTORY_SEPARATOR.$name)) { + if (@file_exists($file = $path.\DIRECTORY_SEPARATOR.$name)) { if (true === $first) { return $file; } @@ -84,7 +84,7 @@ public function locate($name, $currentPath = null, $first = true) private function isAbsolutePath($file) { if ('/' === $file[0] || '\\' === $file[0] - || (strlen($file) > 3 && ctype_alpha($file[0]) + || (\strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] && ('\\' === $file[2] || '/' === $file[2]) ) diff --git a/vendor/symfony/config/Loader/FileLoader.php b/vendor/symfony/config/Loader/FileLoader.php index 0dfd30ba9..016ac4120 100644 --- a/vendor/symfony/config/Loader/FileLoader.php +++ b/vendor/symfony/config/Loader/FileLoader.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Config\Loader; -use Symfony\Component\Config\FileLocatorInterface; -use Symfony\Component\Config\Exception\FileLoaderLoadException; use Symfony\Component\Config\Exception\FileLoaderImportCircularReferenceException; +use Symfony\Component\Config\Exception\FileLoaderLoadException; use Symfony\Component\Config\Exception\FileLocatorFileNotFoundException; +use Symfony\Component\Config\FileLocatorInterface; use Symfony\Component\Config\Resource\FileExistenceResource; use Symfony\Component\Config\Resource\GlobResource; @@ -72,7 +72,7 @@ public function getLocator() */ public function import($resource, $type = null, $ignoreErrors = false, $sourceResource = null) { - if (is_string($resource) && strlen($resource) !== $i = strcspn($resource, '*?{[')) { + if (\is_string($resource) && \strlen($resource) !== $i = strcspn($resource, '*?{[')) { $ret = array(); $isSubpath = 0 !== $i && false !== strpos(substr($resource, 0, $i), '/'); foreach ($this->glob($resource, false, $_, $ignoreErrors || !$isSubpath) as $path => $info) { @@ -95,15 +95,15 @@ public function import($resource, $type = null, $ignoreErrors = false, $sourceRe */ protected function glob($pattern, $recursive, &$resource = null, $ignoreErrors = false) { - if (strlen($pattern) === $i = strcspn($pattern, '*?{[')) { + if (\strlen($pattern) === $i = strcspn($pattern, '*?{[')) { $prefix = $pattern; $pattern = ''; } elseif (0 === $i || false === strpos(substr($pattern, 0, $i), '/')) { $prefix = '.'; $pattern = '/'.$pattern; } else { - $prefix = dirname(substr($pattern, 0, 1 + $i)); - $pattern = substr($pattern, strlen($prefix)); + $prefix = \dirname(substr($pattern, 0, 1 + $i)); + $pattern = substr($pattern, \strlen($prefix)); } try { @@ -136,8 +136,8 @@ private function doImport($resource, $type = null, $ignoreErrors = false, $sourc $resource = $loader->getLocator()->locate($resource, $this->currentDir, false); } - $resources = is_array($resource) ? $resource : array($resource); - for ($i = 0; $i < $resourcesCount = count($resources); ++$i) { + $resources = \is_array($resource) ? $resource : array($resource); + for ($i = 0; $i < $resourcesCount = \count($resources); ++$i) { if (isset(self::$loading[$resources[$i]])) { if ($i == $resourcesCount - 1) { throw new FileLoaderImportCircularReferenceException(array_keys(self::$loading)); diff --git a/vendor/symfony/config/Resource/ClassExistenceResource.php b/vendor/symfony/config/Resource/ClassExistenceResource.php index e3fd095b6..9a1d7ba57 100644 --- a/vendor/symfony/config/Resource/ClassExistenceResource.php +++ b/vendor/symfony/config/Resource/ClassExistenceResource.php @@ -154,7 +154,7 @@ private static function throwOnRequiredClass($class) $props = array( 'file' => $trace[$i]['file'], 'line' => $trace[$i]['line'], - 'trace' => array_slice($trace, 1 + $i), + 'trace' => \array_slice($trace, 1 + $i), ); foreach ($props as $p => $v) { diff --git a/vendor/symfony/config/Resource/ComposerResource.php b/vendor/symfony/config/Resource/ComposerResource.php index 64288ea1d..9c170c077 100644 --- a/vendor/symfony/config/Resource/ComposerResource.php +++ b/vendor/symfony/config/Resource/ComposerResource.php @@ -68,7 +68,7 @@ private static function refresh() foreach (get_declared_classes() as $class) { if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) { $r = new \ReflectionClass($class); - $v = dirname(dirname($r->getFileName())); + $v = \dirname(\dirname($r->getFileName())); if (file_exists($v.'/composer/installed.json')) { self::$runtimeVendors[$v] = @filemtime($v.'/composer/installed.json'); } diff --git a/vendor/symfony/config/Resource/GlobResource.php b/vendor/symfony/config/Resource/GlobResource.php index 1edd7cd22..e3c3be12c 100644 --- a/vendor/symfony/config/Resource/GlobResource.php +++ b/vendor/symfony/config/Resource/GlobResource.php @@ -93,8 +93,8 @@ public function getIterator() return; } - if (false === strpos($this->pattern, '/**/') && (defined('GLOB_BRACE') || false === strpos($this->pattern, '{'))) { - foreach (glob($this->prefix.$this->pattern, defined('GLOB_BRACE') ? GLOB_BRACE : 0) as $path) { + if (0 !== strpos($this->prefix, 'phar://') && false === strpos($this->pattern, '/**/') && (\defined('GLOB_BRACE') || false === strpos($this->pattern, '{'))) { + foreach (glob($this->prefix.$this->pattern, \defined('GLOB_BRACE') ? GLOB_BRACE : 0) as $path) { if ($this->recursive && is_dir($path)) { $files = iterator_to_array(new \RecursiveIteratorIterator( new \RecursiveCallbackFilterIterator( @@ -130,7 +130,7 @@ function (\SplFileInfo $file) { return '.' !== $file->getBasename()[0]; } $regex = substr_replace($regex, '(/|$)', -2, 1); } - $prefixLen = strlen($this->prefix); + $prefixLen = \strlen($this->prefix); foreach ($finder->followLinks()->sortByName()->in($this->prefix) as $path => $info) { if (preg_match($regex, substr('\\' === \DIRECTORY_SEPARATOR ? str_replace('\\', '/', $path) : $path, $prefixLen)) && $info->isFile()) { yield $path => $info; diff --git a/vendor/symfony/config/Resource/ReflectionClassResource.php b/vendor/symfony/config/Resource/ReflectionClassResource.php index 822b78568..65156a06d 100644 --- a/vendor/symfony/config/Resource/ReflectionClassResource.php +++ b/vendor/symfony/config/Resource/ReflectionClassResource.php @@ -81,7 +81,7 @@ private function loadFiles(\ReflectionClass $class) $file = $class->getFileName(); if (false !== $file && file_exists($file)) { foreach ($this->excludedVendors as $vendor) { - if (0 === strpos($file, $vendor) && false !== strpbrk(substr($file, strlen($vendor), 1), '/'.DIRECTORY_SEPARATOR)) { + if (0 === strpos($file, $vendor) && false !== strpbrk(substr($file, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) { $file = false; break; } @@ -138,7 +138,7 @@ private function generateSignature(\ReflectionClass $class) } } - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { foreach ($class->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $m) { // workaround HHVM bug with variadics, see https://github.com/facebook/hhvm/issues/5762 yield preg_replace('/^ @@.*/m', '', new ReflectionMethodHhvmWrapper($m->class, $m->name)); diff --git a/vendor/symfony/config/ResourceCheckerConfigCache.php b/vendor/symfony/config/ResourceCheckerConfigCache.php index 0a79b84c1..91feed622 100644 --- a/vendor/symfony/config/ResourceCheckerConfigCache.php +++ b/vendor/symfony/config/ResourceCheckerConfigCache.php @@ -72,7 +72,7 @@ public function isFresh() $this->resourceCheckers = iterator_to_array($this->resourceCheckers); } - if (!count($this->resourceCheckers)) { + if (!\count($this->resourceCheckers)) { return true; // shortcut - if we don't have any checkers we don't need to bother with the meta file at all } @@ -137,7 +137,7 @@ public function write($content, array $metadata = null) } } - if (\function_exists('opcache_invalidate') && ini_get('opcache.enable')) { + if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) { @opcache_invalidate($this->file, true); } } diff --git a/vendor/symfony/config/ResourceCheckerConfigCacheFactory.php b/vendor/symfony/config/ResourceCheckerConfigCacheFactory.php index 2493f3466..2e27eab71 100644 --- a/vendor/symfony/config/ResourceCheckerConfigCacheFactory.php +++ b/vendor/symfony/config/ResourceCheckerConfigCacheFactory.php @@ -34,13 +34,13 @@ public function __construct($resourceCheckers = array()) */ public function cache($file, $callback) { - if (!is_callable($callback)) { - throw new \InvalidArgumentException(sprintf('Invalid type for callback argument. Expected callable, but got "%s".', gettype($callback))); + if (!\is_callable($callback)) { + throw new \InvalidArgumentException(sprintf('Invalid type for callback argument. Expected callable, but got "%s".', \gettype($callback))); } $cache = new ResourceCheckerConfigCache($file, $this->resourceCheckers); if (!$cache->isFresh()) { - call_user_func($callback, $cache); + \call_user_func($callback, $cache); } return $cache; diff --git a/vendor/symfony/config/Tests/Definition/ArrayNodeTest.php b/vendor/symfony/config/Tests/Definition/ArrayNodeTest.php index 58d293930..089cb5663 100644 --- a/vendor/symfony/config/Tests/Definition/ArrayNodeTest.php +++ b/vendor/symfony/config/Tests/Definition/ArrayNodeTest.php @@ -56,10 +56,10 @@ public function testIgnoreAndRemoveBehaviors($ignore, $remove, $expected, $messa { if ($expected instanceof \Exception) { if (method_exists($this, 'expectException')) { - $this->expectException(get_class($expected)); + $this->expectException(\get_class($expected)); $this->expectExceptionMessage($expected->getMessage()); } else { - $this->setExpectedException(get_class($expected), $expected->getMessage()); + $this->setExpectedException(\get_class($expected), $expected->getMessage()); } } $node = new ArrayNode('root'); diff --git a/vendor/symfony/config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php b/vendor/symfony/config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php index 0fd4af976..ae3fd0678 100644 --- a/vendor/symfony/config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php +++ b/vendor/symfony/config/Tests/Definition/Builder/ArrayNodeDefinitionTest.php @@ -13,9 +13,9 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; -use Symfony\Component\Config\Definition\Processor; use Symfony\Component\Config\Definition\Builder\ScalarNodeDefinition; use Symfony\Component\Config\Definition\Exception\InvalidDefinitionException; +use Symfony\Component\Config\Definition\Processor; class ArrayNodeDefinitionTest extends TestCase { @@ -43,7 +43,7 @@ public function testPrototypeNodeSpecificOption($method, $args) { $node = new ArrayNodeDefinition('root'); - call_user_func_array(array($node, $method), $args); + \call_user_func_array(array($node, $method), $args); $node->getNode(); } @@ -231,6 +231,25 @@ public function testNormalizeKeys() $this->assertFalse($this->getField($node, 'normalizeKeys')); } + public function testUnsetChild() + { + $node = new ArrayNodeDefinition('root'); + $node + ->children() + ->scalarNode('value') + ->beforeNormalization() + ->ifTrue(function ($value) { + return empty($value); + }) + ->thenUnset() + ->end() + ->end() + ->end() + ; + + $this->assertSame(array(), $node->getNode()->normalize(array('value' => null))); + } + public function testPrototypeVariable() { $node = new ArrayNodeDefinition('root'); diff --git a/vendor/symfony/config/Tests/Definition/Builder/NodeBuilderTest.php b/vendor/symfony/config/Tests/Definition/Builder/NodeBuilderTest.php index 887756567..cd77dd702 100644 --- a/vendor/symfony/config/Tests/Definition/Builder/NodeBuilderTest.php +++ b/vendor/symfony/config/Tests/Definition/Builder/NodeBuilderTest.php @@ -68,14 +68,14 @@ public function testNodeTypesAreNotCaseSensitive() $node1 = $builder->node('', 'VaRiAbLe'); $node2 = $builder->node('', 'variable'); - $this->assertInstanceOf(get_class($node1), $node2); + $this->assertInstanceOf(\get_class($node1), $node2); $builder->setNodeClass('CuStOm', __NAMESPACE__.'\\SomeNodeDefinition'); $node1 = $builder->node('', 'CUSTOM'); $node2 = $builder->node('', 'custom'); - $this->assertInstanceOf(get_class($node1), $node2); + $this->assertInstanceOf(\get_class($node1), $node2); } public function testNumericNodeCreation() diff --git a/vendor/symfony/config/Tests/Definition/Builder/NumericNodeDefinitionTest.php b/vendor/symfony/config/Tests/Definition/Builder/NumericNodeDefinitionTest.php index 5a86e1ef6..31342503d 100644 --- a/vendor/symfony/config/Tests/Definition/Builder/NumericNodeDefinitionTest.php +++ b/vendor/symfony/config/Tests/Definition/Builder/NumericNodeDefinitionTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\Config\Tests\Definition\Builder; use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition as NumericNodeDefinition; -use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition; use Symfony\Component\Config\Definition\Builder\FloatNodeDefinition; +use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition; +use Symfony\Component\Config\Definition\Builder\IntegerNodeDefinition as NumericNodeDefinition; class NumericNodeDefinitionTest extends TestCase { diff --git a/vendor/symfony/config/Tests/Definition/Builder/TreeBuilderTest.php b/vendor/symfony/config/Tests/Definition/Builder/TreeBuilderTest.php index 0a9312346..c425f0ed3 100644 --- a/vendor/symfony/config/Tests/Definition/Builder/TreeBuilderTest.php +++ b/vendor/symfony/config/Tests/Definition/Builder/TreeBuilderTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Config\Tests\Definition\Builder; use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder as CustomNodeBuilder; use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Tests\Fixtures\Builder\NodeBuilder as CustomNodeBuilder; class TreeBuilderTest extends TestCase { diff --git a/vendor/symfony/config/Tests/Definition/FinalizationTest.php b/vendor/symfony/config/Tests/Definition/FinalizationTest.php index 733f60085..d19fbd69a 100644 --- a/vendor/symfony/config/Tests/Definition/FinalizationTest.php +++ b/vendor/symfony/config/Tests/Definition/FinalizationTest.php @@ -13,8 +13,8 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Config\Definition\Builder\TreeBuilder; -use Symfony\Component\Config\Definition\Processor; use Symfony\Component\Config\Definition\NodeInterface; +use Symfony\Component\Config\Definition\Processor; class FinalizationTest extends TestCase { diff --git a/vendor/symfony/config/Tests/Definition/NormalizationTest.php b/vendor/symfony/config/Tests/Definition/NormalizationTest.php index f011f5422..3273c7866 100644 --- a/vendor/symfony/config/Tests/Definition/NormalizationTest.php +++ b/vendor/symfony/config/Tests/Definition/NormalizationTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Config\Tests\Definition; use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Definition\NodeInterface; use Symfony\Component\Config\Definition\Builder\TreeBuilder; +use Symfony\Component\Config\Definition\NodeInterface; class NormalizationTest extends TestCase { diff --git a/vendor/symfony/config/Tests/Definition/PrototypedArrayNodeTest.php b/vendor/symfony/config/Tests/Definition/PrototypedArrayNodeTest.php index 1a5de41cc..731d7af25 100644 --- a/vendor/symfony/config/Tests/Definition/PrototypedArrayNodeTest.php +++ b/vendor/symfony/config/Tests/Definition/PrototypedArrayNodeTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Config\Tests\Definition; use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Definition\PrototypedArrayNode; use Symfony\Component\Config\Definition\ArrayNode; +use Symfony\Component\Config\Definition\PrototypedArrayNode; use Symfony\Component\Config\Definition\ScalarNode; use Symfony\Component\Config\Definition\VariableNode; diff --git a/vendor/symfony/config/Tests/DependencyInjection/ConfigCachePassTest.php b/vendor/symfony/config/Tests/DependencyInjection/ConfigCachePassTest.php index c0a064a7a..58aeda682 100644 --- a/vendor/symfony/config/Tests/DependencyInjection/ConfigCachePassTest.php +++ b/vendor/symfony/config/Tests/DependencyInjection/ConfigCachePassTest.php @@ -12,10 +12,10 @@ namespace Symfony\Component\Config\Tests\DependencyInjection; use PHPUnit\Framework\TestCase; +use Symfony\Component\Config\DependencyInjection\ConfigCachePass; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\Config\DependencyInjection\ConfigCachePass; /** * @group legacy @@ -46,8 +46,8 @@ public function testThatCheckersCanBeMissing() { $container = new ContainerBuilder(); - $definitionsBefore = count($container->getDefinitions()); - $aliasesBefore = count($container->getAliases()); + $definitionsBefore = \count($container->getDefinitions()); + $aliasesBefore = \count($container->getAliases()); $pass = new ConfigCachePass(); $pass->process($container); diff --git a/vendor/symfony/config/Tests/FileLocatorTest.php b/vendor/symfony/config/Tests/FileLocatorTest.php index 049c00905..712050413 100644 --- a/vendor/symfony/config/Tests/FileLocatorTest.php +++ b/vendor/symfony/config/Tests/FileLocatorTest.php @@ -46,33 +46,33 @@ public function testLocate() $loader = new FileLocator(__DIR__.'/Fixtures'); $this->assertEquals( - __DIR__.DIRECTORY_SEPARATOR.'FileLocatorTest.php', + __DIR__.\DIRECTORY_SEPARATOR.'FileLocatorTest.php', $loader->locate('FileLocatorTest.php', __DIR__), '->locate() returns the absolute filename if the file exists in the given path' ); $this->assertEquals( - __DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', + __DIR__.'/Fixtures'.\DIRECTORY_SEPARATOR.'foo.xml', $loader->locate('foo.xml', __DIR__), '->locate() returns the absolute filename if the file exists in one of the paths given in the constructor' ); $this->assertEquals( - __DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', - $loader->locate(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__), + __DIR__.'/Fixtures'.\DIRECTORY_SEPARATOR.'foo.xml', + $loader->locate(__DIR__.'/Fixtures'.\DIRECTORY_SEPARATOR.'foo.xml', __DIR__), '->locate() returns the absolute filename if the file exists in one of the paths given in the constructor' ); $loader = new FileLocator(array(__DIR__.'/Fixtures', __DIR__.'/Fixtures/Again')); $this->assertEquals( - array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'), + array(__DIR__.'/Fixtures'.\DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.\DIRECTORY_SEPARATOR.'foo.xml'), $loader->locate('foo.xml', __DIR__, false), '->locate() returns an array of absolute filenames' ); $this->assertEquals( - array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'), + array(__DIR__.'/Fixtures'.\DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.\DIRECTORY_SEPARATOR.'foo.xml'), $loader->locate('foo.xml', __DIR__.'/Fixtures', false), '->locate() returns an array of absolute filenames' ); @@ -80,7 +80,7 @@ public function testLocate() $loader = new FileLocator(__DIR__.'/Fixtures/Again'); $this->assertEquals( - array(__DIR__.'/Fixtures'.DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.DIRECTORY_SEPARATOR.'foo.xml'), + array(__DIR__.'/Fixtures'.\DIRECTORY_SEPARATOR.'foo.xml', __DIR__.'/Fixtures/Again'.\DIRECTORY_SEPARATOR.'foo.xml'), $loader->locate('foo.xml', __DIR__.'/Fixtures', false), '->locate() returns an array of absolute filenames' ); diff --git a/vendor/symfony/config/Tests/Loader/DelegatingLoaderTest.php b/vendor/symfony/config/Tests/Loader/DelegatingLoaderTest.php index 4a01d26ad..3f4b21f34 100644 --- a/vendor/symfony/config/Tests/Loader/DelegatingLoaderTest.php +++ b/vendor/symfony/config/Tests/Loader/DelegatingLoaderTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Config\Tests\Loader; use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Loader\LoaderResolver; use Symfony\Component\Config\Loader\DelegatingLoader; +use Symfony\Component\Config\Loader\LoaderResolver; class DelegatingLoaderTest extends TestCase { diff --git a/vendor/symfony/config/Tests/Loader/FileLoaderTest.php b/vendor/symfony/config/Tests/Loader/FileLoaderTest.php index c6e283c74..f8409df9d 100644 --- a/vendor/symfony/config/Tests/Loader/FileLoaderTest.php +++ b/vendor/symfony/config/Tests/Loader/FileLoaderTest.php @@ -88,7 +88,7 @@ public function testImportWithSimpleGlob() { $loader = new TestFileLoader(new FileLocator(__DIR__)); - $this->assertSame(__FILE__, strtr($loader->import('FileLoaderTest.*'), '/', DIRECTORY_SEPARATOR)); + $this->assertSame(__FILE__, strtr($loader->import('FileLoaderTest.*'), '/', \DIRECTORY_SEPARATOR)); } } diff --git a/vendor/symfony/config/Tests/Loader/LoaderTest.php b/vendor/symfony/config/Tests/Loader/LoaderTest.php index fefb1d728..30167e383 100644 --- a/vendor/symfony/config/Tests/Loader/LoaderTest.php +++ b/vendor/symfony/config/Tests/Loader/LoaderTest.php @@ -109,7 +109,7 @@ public function load($resource, $type = null) public function supports($resource, $type = null) { - return is_string($resource) && 'foo' === pathinfo($resource, PATHINFO_EXTENSION); + return \is_string($resource) && 'foo' === pathinfo($resource, PATHINFO_EXTENSION); } public function getType() diff --git a/vendor/symfony/config/Tests/Resource/ClassExistenceResourceTest.php b/vendor/symfony/config/Tests/Resource/ClassExistenceResourceTest.php index 010b6561a..79bc64d69 100644 --- a/vendor/symfony/config/Tests/Resource/ClassExistenceResourceTest.php +++ b/vendor/symfony/config/Tests/Resource/ClassExistenceResourceTest.php @@ -13,8 +13,8 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Config\Resource\ClassExistenceResource; -use Symfony\Component\Config\Tests\Fixtures\Resource\ConditionalClass; use Symfony\Component\Config\Tests\Fixtures\BadParent; +use Symfony\Component\Config\Tests\Fixtures\Resource\ConditionalClass; class ClassExistenceResourceTest extends TestCase { diff --git a/vendor/symfony/config/Tests/Resource/DirectoryResourceTest.php b/vendor/symfony/config/Tests/Resource/DirectoryResourceTest.php index c37c3e2fc..cf20e43b5 100644 --- a/vendor/symfony/config/Tests/Resource/DirectoryResourceTest.php +++ b/vendor/symfony/config/Tests/Resource/DirectoryResourceTest.php @@ -20,7 +20,7 @@ class DirectoryResourceTest extends TestCase protected function setUp() { - $this->directory = sys_get_temp_dir().DIRECTORY_SEPARATOR.'symfonyDirectoryIterator'; + $this->directory = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'symfonyDirectoryIterator'; if (!file_exists($this->directory)) { mkdir($this->directory); } diff --git a/vendor/symfony/config/Tests/Resource/GlobResourceTest.php b/vendor/symfony/config/Tests/Resource/GlobResourceTest.php index bf7291fdd..c66770c30 100644 --- a/vendor/symfony/config/Tests/Resource/GlobResourceTest.php +++ b/vendor/symfony/config/Tests/Resource/GlobResourceTest.php @@ -18,7 +18,7 @@ class GlobResourceTest extends TestCase { protected function tearDown() { - $dir = dirname(__DIR__).'/Fixtures'; + $dir = \dirname(__DIR__).'/Fixtures'; @rmdir($dir.'/TmpGlob'); @unlink($dir.'/TmpGlob'); @unlink($dir.'/Resource/TmpGlob'); @@ -27,12 +27,12 @@ protected function tearDown() public function testIterator() { - $dir = dirname(__DIR__).DIRECTORY_SEPARATOR.'Fixtures'; + $dir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'; $resource = new GlobResource($dir, '/Resource', true); $paths = iterator_to_array($resource); - $file = $dir.'/Resource'.DIRECTORY_SEPARATOR.'ConditionalClass.php'; + $file = $dir.'/Resource'.\DIRECTORY_SEPARATOR.'ConditionalClass.php'; $this->assertEquals(array($file => new \SplFileInfo($file)), $paths); $this->assertInstanceOf('SplFileInfo', current($paths)); $this->assertSame($dir, $resource->getPrefix()); @@ -41,7 +41,7 @@ public function testIterator() $paths = iterator_to_array($resource); - $file = $dir.DIRECTORY_SEPARATOR.'Resource'.DIRECTORY_SEPARATOR.'ConditionalClass.php'; + $file = $dir.\DIRECTORY_SEPARATOR.'Resource'.\DIRECTORY_SEPARATOR.'ConditionalClass.php'; $this->assertEquals(array($file => $file), $paths); $this->assertInstanceOf('SplFileInfo', current($paths)); $this->assertSame($dir, $resource->getPrefix()); @@ -49,7 +49,7 @@ public function testIterator() public function testIsFreshNonRecursiveDetectsNewFile() { - $dir = dirname(__DIR__).'/Fixtures'; + $dir = \dirname(__DIR__).'/Fixtures'; $resource = new GlobResource($dir, '/*', false); $this->assertTrue($resource->isFresh(0)); @@ -69,7 +69,7 @@ public function testIsFreshNonRecursiveDetectsNewFile() public function testIsFreshNonRecursiveDetectsRemovedFile() { - $dir = dirname(__DIR__).'/Fixtures'; + $dir = \dirname(__DIR__).'/Fixtures'; $resource = new GlobResource($dir, '/*', false); touch($dir.'/TmpGlob'); @@ -85,7 +85,7 @@ public function testIsFreshNonRecursiveDetectsRemovedFile() public function testIsFreshRecursiveDetectsRemovedFile() { - $dir = dirname(__DIR__).'/Fixtures'; + $dir = \dirname(__DIR__).'/Fixtures'; $resource = new GlobResource($dir, '/*', true); touch($dir.'/Resource/TmpGlob'); @@ -103,7 +103,7 @@ public function testIsFreshRecursiveDetectsRemovedFile() public function testIsFreshRecursiveDetectsNewFile() { - $dir = dirname(__DIR__).'/Fixtures'; + $dir = \dirname(__DIR__).'/Fixtures'; $resource = new GlobResource($dir, '/*', true); $this->assertTrue($resource->isFresh(0)); diff --git a/vendor/symfony/config/Tests/ResourceCheckerConfigCacheTest.php b/vendor/symfony/config/Tests/ResourceCheckerConfigCacheTest.php index 371c7baa1..bb29ac02a 100644 --- a/vendor/symfony/config/Tests/ResourceCheckerConfigCacheTest.php +++ b/vendor/symfony/config/Tests/ResourceCheckerConfigCacheTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\Config\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Tests\Resource\ResourceStub; use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Config\ResourceCheckerConfigCache; +use Symfony\Component\Config\Tests\Resource\ResourceStub; class ResourceCheckerConfigCacheTest extends TestCase { diff --git a/vendor/symfony/config/Tests/Util/XmlUtilsTest.php b/vendor/symfony/config/Tests/Util/XmlUtilsTest.php index 9d61c9cd8..10b4a7a9b 100644 --- a/vendor/symfony/config/Tests/Util/XmlUtilsTest.php +++ b/vendor/symfony/config/Tests/Util/XmlUtilsTest.php @@ -55,7 +55,7 @@ public function testLoadFile() XmlUtils::loadFile($fixtures.'valid.xml', array($mock, 'validate')); $this->fail(); } catch (\InvalidArgumentException $e) { - $this->assertRegExp('/The XML file "[\w:\/\\\.~+-]+" is not valid\./', $e->getMessage()); + $this->assertRegExp('/The XML file ".+" is not valid\./', $e->getMessage()); } $this->assertInstanceOf('DOMDocument', XmlUtils::loadFile($fixtures.'valid.xml', array($mock, 'validate'))); diff --git a/vendor/symfony/config/Util/XmlUtils.php b/vendor/symfony/config/Util/XmlUtils.php index e1c4a4ad3..8ad58d61e 100644 --- a/vendor/symfony/config/Util/XmlUtils.php +++ b/vendor/symfony/config/Util/XmlUtils.php @@ -46,7 +46,7 @@ private function __construct() */ public static function parse($content, $schemaOrCallable = null) { - if (!extension_loaded('dom')) { + if (!\extension_loaded('dom')) { throw new \RuntimeException('Extension DOM is required.'); } @@ -56,7 +56,7 @@ public static function parse($content, $schemaOrCallable = null) $dom = new \DOMDocument(); $dom->validateOnParse = true; - if (!$dom->loadXML($content, LIBXML_NONET | (defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) { + if (!$dom->loadXML($content, LIBXML_NONET | (\defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) { libxml_disable_entity_loader($disableEntities); throw new XmlParsingException(implode("\n", static::getXmlErrors($internalErrors))); @@ -78,13 +78,13 @@ public static function parse($content, $schemaOrCallable = null) libxml_clear_errors(); $e = null; - if (is_callable($schemaOrCallable)) { + if (\is_callable($schemaOrCallable)) { try { - $valid = call_user_func($schemaOrCallable, $dom, $internalErrors); + $valid = \call_user_func($schemaOrCallable, $dom, $internalErrors); } catch (\Exception $e) { $valid = false; } - } elseif (!is_array($schemaOrCallable) && is_file((string) $schemaOrCallable)) { + } elseif (!\is_array($schemaOrCallable) && is_file((string) $schemaOrCallable)) { $schemaSource = file_get_contents((string) $schemaOrCallable); $valid = @$dom->schemaValidateSource($schemaSource); } else { @@ -160,7 +160,7 @@ public static function convertDomElementToArray(\DOMElement $element, $checkPref $empty = true; $config = array(); foreach ($element->attributes as $name => $node) { - if ($checkPrefix && !in_array((string) $node->prefix, array('', $prefix), true)) { + if ($checkPrefix && !\in_array((string) $node->prefix, array('', $prefix), true)) { continue; } $config[$name] = static::phpize($node->value); @@ -181,7 +181,7 @@ public static function convertDomElementToArray(\DOMElement $element, $checkPref $key = $node->localName; if (isset($config[$key])) { - if (!is_array($config[$key]) || !is_int(key($config[$key]))) { + if (!\is_array($config[$key]) || !\is_int(key($config[$key]))) { $config[$key] = array($config[$key]); } $config[$key][] = $value; @@ -195,7 +195,7 @@ public static function convertDomElementToArray(\DOMElement $element, $checkPref if (false !== $nodeValue) { $value = static::phpize($nodeValue); - if (count($config)) { + if (\count($config)) { $config['value'] = $value; } else { $config = $value; @@ -240,7 +240,7 @@ public static function phpize($value) return '0x' === $value[0].$value[1] ? hexdec($value) : (float) $value; case preg_match('/^0x[0-9a-f]++$/i', $value): return hexdec($value); - case preg_match('/^(-|\+)?[0-9]+(\.[0-9]+)?$/', $value): + case preg_match('/^[+-]?[0-9]+(\.[0-9]+)?$/', $value): return (float) $value; default: return $value; diff --git a/vendor/symfony/config/composer.json b/vendor/symfony/config/composer.json index ab2640281..c04294dd4 100644 --- a/vendor/symfony/config/composer.json +++ b/vendor/symfony/config/composer.json @@ -17,7 +17,8 @@ ], "require": { "php": "^5.5.9|>=7.0.8", - "symfony/filesystem": "~2.8|~3.0|~4.0" + "symfony/filesystem": "~2.8|~3.0|~4.0", + "symfony/polyfill-ctype": "~1.8" }, "require-dev": { "symfony/finder": "~3.3|~4.0", diff --git a/vendor/symfony/config/phpunit.xml.dist b/vendor/symfony/config/phpunit.xml.dist index 36ef339fd..1cfdb3cdc 100644 --- a/vendor/symfony/config/phpunit.xml.dist +++ b/vendor/symfony/config/phpunit.xml.dist @@ -1,7 +1,7 @@ setExceptionHandler($renderException)) { $phpHandler[0]->setExceptionHandler($debugHandler); @@ -451,11 +451,11 @@ public function add(Command $command) } if (null === $command->getDefinition()) { - throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', get_class($command))); + throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($command))); } if (!$command->getName()) { - throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', get_class($command))); + throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($command))); } $this->commands[$command->getName()] = $command; @@ -552,7 +552,7 @@ public function findNamespace($namespace) $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace); if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) { - if (1 == count($alternatives)) { + if (1 == \count($alternatives)) { $message .= "\n\nDid you mean this?\n "; } else { $message .= "\n\nDid you mean one of these?\n "; @@ -564,8 +564,8 @@ public function findNamespace($namespace) throw new CommandNotFoundException($message, $alternatives); } - $exact = in_array($namespace, $namespaces, true); - if (count($namespaces) > 1 && !$exact) { + $exact = \in_array($namespace, $namespaces, true); + if (\count($namespaces) > 1 && !$exact) { throw new CommandNotFoundException(sprintf("The namespace \"%s\" is ambiguous.\nDid you mean one of these?\n%s", $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces)); } @@ -598,7 +598,7 @@ public function find($name) } // if no commands matched or we just matched namespaces - if (empty($commands) || count(preg_grep('{^'.$expr.'$}i', $commands)) < 1) { + if (empty($commands) || \count(preg_grep('{^'.$expr.'$}i', $commands)) < 1) { if (false !== $pos = strrpos($name, ':')) { // check if a namespace exists and contains commands $this->findNamespace(substr($name, 0, $pos)); @@ -607,7 +607,7 @@ public function find($name) $message = sprintf('Command "%s" is not defined.', $name); if ($alternatives = $this->findAlternatives($name, $allCommands)) { - if (1 == count($alternatives)) { + if (1 == \count($alternatives)) { $message .= "\n\nDid you mean this?\n "; } else { $message .= "\n\nDid you mean one of these?\n "; @@ -619,18 +619,18 @@ public function find($name) } // filter out aliases for commands which are already on the list - if (count($commands) > 1) { + if (\count($commands) > 1) { $commandList = $this->commandLoader ? array_merge(array_flip($this->commandLoader->getNames()), $this->commands) : $this->commands; $commands = array_unique(array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) { $commandName = $commandList[$nameOrAlias] instanceof Command ? $commandList[$nameOrAlias]->getName() : $nameOrAlias; $aliases[$nameOrAlias] = $commandName; - return $commandName === $nameOrAlias || !in_array($commandName, $commands); + return $commandName === $nameOrAlias || !\in_array($commandName, $commands); })); } - $exact = in_array($name, $commands, true) || isset($aliases[$name]); - if (count($commands) > 1 && !$exact) { + $exact = \in_array($name, $commands, true) || isset($aliases[$name]); + if (\count($commands) > 1 && !$exact) { $usableWidth = $this->terminal->getWidth() - 10; $abbrevs = array_values($commands); $maxLen = 0; @@ -710,7 +710,7 @@ public static function getAbbreviations($names) { $abbrevs = array(); foreach ($names as $name) { - for ($len = strlen($name); $len > 0; --$len) { + for ($len = \strlen($name); $len > 0; --$len) { $abbrev = substr($name, 0, $len); $abbrevs[$abbrev][] = $name; } @@ -739,7 +739,7 @@ protected function doRenderException(\Exception $e, OutputInterface $output) do { $message = trim($e->getMessage()); if ('' === $message || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) { - $title = sprintf(' [%s%s] ', get_class($e), 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : ''); + $title = sprintf(' [%s%s] ', \get_class($e), 0 !== ($code = $e->getCode()) ? ' ('.$code.')' : ''); $len = Helper::strlen($title); } else { $len = 0; @@ -747,7 +747,7 @@ protected function doRenderException(\Exception $e, OutputInterface $output) $width = $this->terminal->getWidth() ? $this->terminal->getWidth() - 1 : PHP_INT_MAX; // HHVM only accepts 32 bits integer in str_split, even when PHP_INT_MAX is a 64 bit integer: https://github.com/facebook/hhvm/issues/1327 - if (defined('HHVM_VERSION') && $width > 1 << 31) { + if (\defined('HHVM_VERSION') && $width > 1 << 31) { $width = 1 << 31; } $lines = array(); @@ -783,7 +783,14 @@ protected function doRenderException(\Exception $e, OutputInterface $output) // exception related properties $trace = $e->getTrace(); - for ($i = 0, $count = count($trace); $i < $count; ++$i) { + array_unshift($trace, array( + 'function' => '', + 'file' => $e->getFile() ?: 'n/a', + 'line' => $e->getLine() ?: 'n/a', + 'args' => array(), + )); + + for ($i = 0, $count = \count($trace); $i < $count; ++$i) { $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : ''; $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : ''; $function = $trace[$i]['function']; @@ -807,7 +814,7 @@ protected function doRenderException(\Exception $e, OutputInterface $output) */ protected function getTerminalWidth() { - @trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED); return $this->terminal->getWidth(); } @@ -821,7 +828,7 @@ protected function getTerminalWidth() */ protected function getTerminalHeight() { - @trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED); return $this->terminal->getHeight(); } @@ -835,7 +842,7 @@ protected function getTerminalHeight() */ public function getTerminalDimensions() { - @trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Create a Terminal instance instead.', __METHOD__), E_USER_DEPRECATED); return array($this->terminal->getWidth(), $this->terminal->getHeight()); } @@ -854,7 +861,7 @@ public function getTerminalDimensions() */ public function setTerminalDimensions($width, $height) { - @trigger_error(sprintf('%s is deprecated as of 3.2 and will be removed in 4.0. Set the COLUMNS and LINES env vars instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.2 and will be removed in 4.0. Set the COLUMNS and LINES env vars instead.', __METHOD__), E_USER_DEPRECATED); putenv('COLUMNS='.$width); putenv('LINES='.$height); @@ -875,7 +882,7 @@ protected function configureIO(InputInterface $input, OutputInterface $output) if (true === $input->hasParameterOption(array('--no-interaction', '-n'), true)) { $input->setInteractive(false); - } elseif (function_exists('posix_isatty')) { + } elseif (\function_exists('posix_isatty')) { $inputStream = null; if ($input instanceof StreamableInputInterface) { @@ -1079,7 +1086,7 @@ public function extractNamespace($name, $limit = null) $parts = explode(':', $name); array_pop($parts); - return implode(':', null === $limit ? $parts : array_slice($parts, 0, $limit)); + return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit)); } /** @@ -1112,7 +1119,7 @@ private function findAlternatives($name, $collection) } $lev = levenshtein($subname, $parts[$i]); - if ($lev <= strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) { + if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) { $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev; } elseif ($exists) { $alternatives[$collectionName] += $threshold; @@ -1122,7 +1129,7 @@ private function findAlternatives($name, $collection) foreach ($collection as $item) { $lev = levenshtein($name, $item); - if ($lev <= strlen($name) / 3 || false !== strpos($item, $name)) { + if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) { $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev; } } @@ -1178,7 +1185,7 @@ private function splitStringByWidth($string, $width) $line = $char; } - $lines[] = count($lines) ? str_pad($line, $width) : $line; + $lines[] = \count($lines) ? str_pad($line, $width) : $line; mb_convert_variables($encoding, 'utf8', $lines); @@ -1199,7 +1206,7 @@ private function extractAllNamespaces($name) $namespaces = array(); foreach ($parts as $part) { - if (count($namespaces)) { + if (\count($namespaces)) { $namespaces[] = end($namespaces).':'.$part; } else { $namespaces[] = $part; diff --git a/vendor/symfony/console/Command/Command.php b/vendor/symfony/console/Command/Command.php index 069304251..c8dcf3bef 100644 --- a/vendor/symfony/console/Command/Command.php +++ b/vendor/symfony/console/Command/Command.php @@ -11,16 +11,16 @@ namespace Symfony\Component\Console\Command; +use Symfony\Component\Console\Application; use Symfony\Component\Console\Exception\ExceptionInterface; -use Symfony\Component\Console\Input\InputDefinition; -use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Exception\LogicException; +use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Application; -use Symfony\Component\Console\Helper\HelperSet; -use Symfony\Component\Console\Exception\InvalidArgumentException; -use Symfony\Component\Console\Exception\LogicException; /** * Base class for all commands. @@ -55,7 +55,7 @@ class Command */ public static function getDefaultName() { - $class = get_called_class(); + $class = \get_called_class(); $r = new \ReflectionProperty($class, 'defaultName'); return $class === $r->class ? static::$defaultName : null; @@ -150,7 +150,7 @@ protected function configure() * execute() method, you set the code to execute by passing * a Closure to the setCode() method. * - * @return null|int null or 0 if everything went fine, or an error code + * @return int|null null or 0 if everything went fine, or an error code * * @throws LogicException When this abstract method is not implemented * @@ -173,10 +173,14 @@ protected function interact(InputInterface $input, OutputInterface $output) } /** - * Initializes the command just after the input has been validated. + * Initializes the command after the input has been bound and before the input + * is validated. * * This is mainly useful when a lot of commands extends one main command * where some things need to be initialized based on the input arguments and options. + * + * @see InputInterface::bind() + * @see InputInterface::validate() */ protected function initialize(InputInterface $input, OutputInterface $output) { @@ -217,16 +221,15 @@ public function run(InputInterface $input, OutputInterface $output) $this->initialize($input, $output); if (null !== $this->processTitle) { - if (function_exists('cli_set_process_title')) { - if (false === @cli_set_process_title($this->processTitle)) { + if (\function_exists('cli_set_process_title')) { + if (!@cli_set_process_title($this->processTitle)) { if ('Darwin' === PHP_OS) { - $output->writeln('Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.'); + $output->writeln('Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.', OutputInterface::VERBOSITY_VERY_VERBOSE); } else { - $error = error_get_last(); - trigger_error($error['message'], E_USER_WARNING); + cli_set_process_title($this->processTitle); } } - } elseif (function_exists('setproctitle')) { + } elseif (\function_exists('setproctitle')) { setproctitle($this->processTitle); } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) { $output->writeln('Install the proctitle PECL to be able to change the process title.'); @@ -247,7 +250,7 @@ public function run(InputInterface $input, OutputInterface $output) $input->validate(); if ($this->code) { - $statusCode = call_user_func($this->code, $input, $output); + $statusCode = \call_user_func($this->code, $input, $output); } else { $statusCode = $this->execute($input, $output); } @@ -306,14 +309,13 @@ public function mergeApplicationDefinition($mergeArgs = true) $this->definition->addOptions($this->application->getDefinition()->getOptions()); + $this->applicationDefinitionMerged = true; + if ($mergeArgs) { $currentArguments = $this->definition->getArguments(); $this->definition->setArguments($this->application->getDefinition()->getArguments()); $this->definition->addArguments($currentArguments); - } - $this->applicationDefinitionMerged = true; - if ($mergeArgs) { $this->applicationDefinitionMergedWithArgs = true; } } @@ -366,10 +368,12 @@ public function getNativeDefinition() /** * Adds an argument. * - * @param string $name The argument name - * @param int $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL - * @param string $description A description text - * @param mixed $default The default value (for InputArgument::OPTIONAL mode only) + * @param string $name The argument name + * @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL + * @param string $description A description text + * @param string|string[]|null $default The default value (for self::OPTIONAL mode only) + * + * @throws InvalidArgumentException When argument mode is not valid * * @return $this */ @@ -383,11 +387,13 @@ public function addArgument($name, $mode = null, $description = '', $default = n /** * Adds an option. * - * @param string $name The option name - * @param string $shortcut The shortcut (can be null) - * @param int $mode The option mode: One of the InputOption::VALUE_* constants - * @param string $description A description text - * @param mixed $default The default value (must be null for InputOption::VALUE_NONE) + * @param string $name The option name + * @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the VALUE_* constants + * @param string $description A description text + * @param string|string[]|int|bool|null $default The default value (must be null for self::VALUE_NONE) + * + * @throws InvalidArgumentException If option mode is invalid or incompatible * * @return $this */ @@ -551,7 +557,7 @@ public function getProcessedHelp() */ public function setAliases($aliases) { - if (!is_array($aliases) && !$aliases instanceof \Traversable) { + if (!\is_array($aliases) && !$aliases instanceof \Traversable) { throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable'); } diff --git a/vendor/symfony/console/Command/HelpCommand.php b/vendor/symfony/console/Command/HelpCommand.php index 112679b34..1e20b008a 100644 --- a/vendor/symfony/console/Command/HelpCommand.php +++ b/vendor/symfony/console/Command/HelpCommand.php @@ -13,8 +13,8 @@ use Symfony\Component\Console\Helper\DescriptorHelper; use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; /** diff --git a/vendor/symfony/console/Command/ListCommand.php b/vendor/symfony/console/Command/ListCommand.php index 179ddea5d..5d932338c 100644 --- a/vendor/symfony/console/Command/ListCommand.php +++ b/vendor/symfony/console/Command/ListCommand.php @@ -13,10 +13,10 @@ use Symfony\Component\Console\Helper\DescriptorHelper; use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Input\InputDefinition; /** * ListCommand displays the list of all available commands for the application. diff --git a/vendor/symfony/console/Descriptor/Descriptor.php b/vendor/symfony/console/Descriptor/Descriptor.php index fe169cb48..151d84f72 100644 --- a/vendor/symfony/console/Descriptor/Descriptor.php +++ b/vendor/symfony/console/Descriptor/Descriptor.php @@ -13,11 +13,11 @@ use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Exception\InvalidArgumentException; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Exception\InvalidArgumentException; /** * @author Jean-François Simon @@ -55,7 +55,7 @@ public function describe(OutputInterface $output, $object, array $options = arra $this->describeApplication($object, $options); break; default: - throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', get_class($object))); + throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object))); } } diff --git a/vendor/symfony/console/Descriptor/MarkdownDescriptor.php b/vendor/symfony/console/Descriptor/MarkdownDescriptor.php index d52ba5534..6d8399f92 100644 --- a/vendor/symfony/console/Descriptor/MarkdownDescriptor.php +++ b/vendor/symfony/console/Descriptor/MarkdownDescriptor.php @@ -88,7 +88,7 @@ protected function describeInputOption(InputOption $option, array $options = arr */ protected function describeInputDefinition(InputDefinition $definition, array $options = array()) { - if ($showArguments = count($definition->getArguments()) > 0) { + if ($showArguments = \count($definition->getArguments()) > 0) { $this->write('### Arguments'); foreach ($definition->getArguments() as $argument) { $this->write("\n\n"); @@ -96,7 +96,7 @@ protected function describeInputDefinition(InputDefinition $definition, array $o } } - if (count($definition->getOptions()) > 0) { + if (\count($definition->getOptions()) > 0) { if ($showArguments) { $this->write("\n\n"); } diff --git a/vendor/symfony/console/Descriptor/TextDescriptor.php b/vendor/symfony/console/Descriptor/TextDescriptor.php index a79df7e23..04dd22598 100644 --- a/vendor/symfony/console/Descriptor/TextDescriptor.php +++ b/vendor/symfony/console/Descriptor/TextDescriptor.php @@ -33,14 +33,14 @@ class TextDescriptor extends Descriptor */ protected function describeInputArgument(InputArgument $argument, array $options = array()) { - if (null !== $argument->getDefault() && (!is_array($argument->getDefault()) || count($argument->getDefault()))) { + if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) { $default = sprintf(' [default: %s]', $this->formatDefaultValue($argument->getDefault())); } else { $default = ''; } $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName()); - $spacingWidth = $totalWidth - strlen($argument->getName()); + $spacingWidth = $totalWidth - \strlen($argument->getName()); $this->writeText(sprintf(' %s %s%s%s', $argument->getName(), @@ -56,7 +56,7 @@ protected function describeInputArgument(InputArgument $argument, array $options */ protected function describeInputOption(InputOption $option, array $options = array()) { - if ($option->acceptValue() && null !== $option->getDefault() && (!is_array($option->getDefault()) || count($option->getDefault()))) { + if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) { $default = sprintf(' [default: %s]', $this->formatDefaultValue($option->getDefault())); } else { $default = ''; @@ -117,7 +117,7 @@ protected function describeInputDefinition(InputDefinition $definition, array $o $this->writeText('Options:', $options); foreach ($definition->getOptions() as $option) { - if (strlen($option->getShortcut()) > 1) { + if (\strlen($option->getShortcut()) > 1) { $laterOptions[] = $option; continue; } @@ -202,7 +202,7 @@ protected function describeApplication(Application $application, array $options } // calculate max. width based on available commands per namespace - $width = $this->getColumnWidth(call_user_func_array('array_merge', array_map(function ($namespace) use ($commands) { + $width = $this->getColumnWidth(\call_user_func_array('array_merge', array_map(function ($namespace) use ($commands) { return array_intersect($namespace['commands'], array_keys($commands)); }, $namespaces))); @@ -280,11 +280,11 @@ private function formatDefaultValue($default) return 'INF'; } - if (is_string($default)) { + if (\is_string($default)) { $default = OutputFormatter::escape($default); - } elseif (is_array($default)) { + } elseif (\is_array($default)) { foreach ($default as $key => $value) { - if (is_string($value)) { + if (\is_string($value)) { $default[$key] = OutputFormatter::escape($value); } } diff --git a/vendor/symfony/console/Descriptor/XmlDescriptor.php b/vendor/symfony/console/Descriptor/XmlDescriptor.php index 1a105352f..1a12a1dd6 100644 --- a/vendor/symfony/console/Descriptor/XmlDescriptor.php +++ b/vendor/symfony/console/Descriptor/XmlDescriptor.php @@ -203,7 +203,7 @@ private function getInputArgumentDocument(InputArgument $argument) $descriptionXML->appendChild($dom->createTextNode($argument->getDescription())); $objectXML->appendChild($defaultsXML = $dom->createElement('defaults')); - $defaults = is_array($argument->getDefault()) ? $argument->getDefault() : (is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array())); + $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array())); foreach ($defaults as $default) { $defaultsXML->appendChild($defaultXML = $dom->createElement('default')); $defaultXML->appendChild($dom->createTextNode($default)); @@ -235,7 +235,7 @@ private function getInputOptionDocument(InputOption $option) $descriptionXML->appendChild($dom->createTextNode($option->getDescription())); if ($option->acceptValue()) { - $defaults = is_array($option->getDefault()) ? $option->getDefault() : (is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array())); + $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array())); $objectXML->appendChild($defaultsXML = $dom->createElement('defaults')); if (!empty($defaults)) { diff --git a/vendor/symfony/console/Event/ConsoleErrorEvent.php b/vendor/symfony/console/Event/ConsoleErrorEvent.php index 0d05b9dad..51a5f56d5 100644 --- a/vendor/symfony/console/Event/ConsoleErrorEvent.php +++ b/vendor/symfony/console/Event/ConsoleErrorEvent.php @@ -51,7 +51,7 @@ public function getError() public function setError($error) { if (!$error instanceof \Throwable && !$error instanceof \Exception) { - throw new InvalidArgumentException(sprintf('The error passed to ConsoleErrorEvent must be an instance of \Throwable or \Exception, "%s" was passed instead.', is_object($error) ? get_class($error) : gettype($error))); + throw new InvalidArgumentException(sprintf('The error passed to ConsoleErrorEvent must be an instance of \Throwable or \Exception, "%s" was passed instead.', \is_object($error) ? \get_class($error) : \gettype($error))); } $this->error = $error; @@ -78,6 +78,6 @@ public function setExitCode($exitCode) */ public function getExitCode() { - return null !== $this->exitCode ? $this->exitCode : (is_int($this->error->getCode()) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1); + return null !== $this->exitCode ? $this->exitCode : (\is_int($this->error->getCode()) && 0 !== $this->error->getCode() ? $this->error->getCode() : 1); } } diff --git a/vendor/symfony/console/Formatter/OutputFormatter.php b/vendor/symfony/console/Formatter/OutputFormatter.php index 6ece9e906..57b95eb14 100644 --- a/vendor/symfony/console/Formatter/OutputFormatter.php +++ b/vendor/symfony/console/Formatter/OutputFormatter.php @@ -50,10 +50,10 @@ public static function escape($text) public static function escapeTrailingBackslash($text) { if ('\\' === substr($text, -1)) { - $len = strlen($text); + $len = \strlen($text); $text = rtrim($text, '\\'); $text = str_replace("\0", '', $text); - $text .= str_repeat("\0", $len - strlen($text)); + $text .= str_repeat("\0", $len - \strlen($text)); } return $text; @@ -145,7 +145,7 @@ public function format($message) // add the text up to the next tag $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset)); - $offset = $pos + strlen($text); + $offset = $pos + \strlen($text); // opening tag? if ($open = '/' != $text[1]) { @@ -237,6 +237,6 @@ private function createStyleFromString($string) */ private function applyCurrentStyle($text) { - return $this->isDecorated() && strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text; + return $this->isDecorated() && \strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text; } } diff --git a/vendor/symfony/console/Formatter/OutputFormatterStyle.php b/vendor/symfony/console/Formatter/OutputFormatterStyle.php index 7ada54f4c..b884d7134 100644 --- a/vendor/symfony/console/Formatter/OutputFormatterStyle.php +++ b/vendor/symfony/console/Formatter/OutputFormatterStyle.php @@ -69,7 +69,7 @@ public function __construct($foreground = null, $background = null, array $optio if (null !== $background) { $this->setBackground($background); } - if (count($options)) { + if (\count($options)) { $this->setOptions($options); } } @@ -90,11 +90,7 @@ public function setForeground($color = null) } if (!isset(static::$availableForegroundColors[$color])) { - throw new InvalidArgumentException(sprintf( - 'Invalid foreground color specified: "%s". Expected one of (%s)', - $color, - implode(', ', array_keys(static::$availableForegroundColors)) - )); + throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors)))); } $this->foreground = static::$availableForegroundColors[$color]; @@ -116,11 +112,7 @@ public function setBackground($color = null) } if (!isset(static::$availableBackgroundColors[$color])) { - throw new InvalidArgumentException(sprintf( - 'Invalid background color specified: "%s". Expected one of (%s)', - $color, - implode(', ', array_keys(static::$availableBackgroundColors)) - )); + throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors)))); } $this->background = static::$availableBackgroundColors[$color]; @@ -136,14 +128,10 @@ public function setBackground($color = null) public function setOption($option) { if (!isset(static::$availableOptions[$option])) { - throw new InvalidArgumentException(sprintf( - 'Invalid option specified: "%s". Expected one of (%s)', - $option, - implode(', ', array_keys(static::$availableOptions)) - )); + throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); } - if (!in_array(static::$availableOptions[$option], $this->options)) { + if (!\in_array(static::$availableOptions[$option], $this->options)) { $this->options[] = static::$availableOptions[$option]; } } @@ -158,11 +146,7 @@ public function setOption($option) public function unsetOption($option) { if (!isset(static::$availableOptions[$option])) { - throw new InvalidArgumentException(sprintf( - 'Invalid option specified: "%s". Expected one of (%s)', - $option, - implode(', ', array_keys(static::$availableOptions)) - )); + throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions)))); } $pos = array_search(static::$availableOptions[$option], $this->options); @@ -203,14 +187,14 @@ public function apply($text) $setCodes[] = $this->background['set']; $unsetCodes[] = $this->background['unset']; } - if (count($this->options)) { + if (\count($this->options)) { foreach ($this->options as $option) { $setCodes[] = $option['set']; $unsetCodes[] = $option['unset']; } } - if (0 === count($setCodes)) { + if (0 === \count($setCodes)) { return $text; } diff --git a/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php b/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php index bf0beb709..9e7283c2f 100644 --- a/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php +++ b/vendor/symfony/console/Formatter/OutputFormatterStyleStack.php @@ -66,7 +66,7 @@ public function pop(OutputFormatterStyleInterface $style = null) foreach (array_reverse($this->styles, true) as $index => $stackedStyle) { if ($style->apply('') === $stackedStyle->apply('')) { - $this->styles = array_slice($this->styles, 0, $index); + $this->styles = \array_slice($this->styles, 0, $index); return $stackedStyle; } @@ -86,7 +86,7 @@ public function getCurrent() return $this->emptyStyle; } - return $this->styles[count($this->styles) - 1]; + return $this->styles[\count($this->styles) - 1]; } /** diff --git a/vendor/symfony/console/Helper/DebugFormatterHelper.php b/vendor/symfony/console/Helper/DebugFormatterHelper.php index 1119b795c..f5393edee 100644 --- a/vendor/symfony/console/Helper/DebugFormatterHelper.php +++ b/vendor/symfony/console/Helper/DebugFormatterHelper.php @@ -35,7 +35,7 @@ class DebugFormatterHelper extends Helper */ public function start($id, $message, $prefix = 'RUN') { - $this->started[$id] = array('border' => ++$this->count % count($this->colors)); + $this->started[$id] = array('border' => ++$this->count % \count($this->colors)); return sprintf("%s %s %s\n", $this->getBorder($id), $prefix, $message); } diff --git a/vendor/symfony/console/Helper/DescriptorHelper.php b/vendor/symfony/console/Helper/DescriptorHelper.php index 6f5c81834..54d3b1afc 100644 --- a/vendor/symfony/console/Helper/DescriptorHelper.php +++ b/vendor/symfony/console/Helper/DescriptorHelper.php @@ -16,8 +16,8 @@ use Symfony\Component\Console\Descriptor\MarkdownDescriptor; use Symfony\Component\Console\Descriptor\TextDescriptor; use Symfony\Component\Console\Descriptor\XmlDescriptor; -use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Output\OutputInterface; /** * This class adds helper method to describe objects in various formats. diff --git a/vendor/symfony/console/Helper/FormatterHelper.php b/vendor/symfony/console/Helper/FormatterHelper.php index 6a48a77f2..79ab2849e 100644 --- a/vendor/symfony/console/Helper/FormatterHelper.php +++ b/vendor/symfony/console/Helper/FormatterHelper.php @@ -45,7 +45,7 @@ public function formatSection($section, $message, $style = 'info') */ public function formatBlock($messages, $style, $large = false) { - if (!is_array($messages)) { + if (!\is_array($messages)) { $messages = array($messages); } diff --git a/vendor/symfony/console/Helper/Helper.php b/vendor/symfony/console/Helper/Helper.php index 0954bad6b..509018552 100644 --- a/vendor/symfony/console/Helper/Helper.php +++ b/vendor/symfony/console/Helper/Helper.php @@ -48,7 +48,7 @@ public function getHelperSet() public static function strlen($string) { if (false === $encoding = mb_detect_encoding($string, null, true)) { - return strlen($string); + return \strlen($string); } return mb_strwidth($string, $encoding); @@ -89,9 +89,9 @@ public static function formatTime($secs) foreach ($timeFormats as $index => $format) { if ($secs >= $format[0]) { if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0]) - || $index == count($timeFormats) - 1 + || $index == \count($timeFormats) - 1 ) { - if (2 == count($format)) { + if (2 == \count($format)) { return $format[1]; } diff --git a/vendor/symfony/console/Helper/HelperSet.php b/vendor/symfony/console/Helper/HelperSet.php index 24ce18fb4..4c44b05f5 100644 --- a/vendor/symfony/console/Helper/HelperSet.php +++ b/vendor/symfony/console/Helper/HelperSet.php @@ -33,7 +33,7 @@ class HelperSet implements \IteratorAggregate public function __construct(array $helpers = array()) { foreach ($helpers as $alias => $helper) { - $this->set($helper, is_int($alias) ? null : $alias); + $this->set($helper, \is_int($alias) ? null : $alias); } } diff --git a/vendor/symfony/console/Helper/InputAwareHelper.php b/vendor/symfony/console/Helper/InputAwareHelper.php index 426176742..0d0dba23e 100644 --- a/vendor/symfony/console/Helper/InputAwareHelper.php +++ b/vendor/symfony/console/Helper/InputAwareHelper.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Console\Helper; -use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputAwareInterface; +use Symfony\Component\Console\Input\InputInterface; /** * An implementation of InputAwareInterface for Helpers. diff --git a/vendor/symfony/console/Helper/ProcessHelper.php b/vendor/symfony/console/Helper/ProcessHelper.php index 82935baea..666f114a2 100644 --- a/vendor/symfony/console/Helper/ProcessHelper.php +++ b/vendor/symfony/console/Helper/ProcessHelper.php @@ -121,7 +121,7 @@ public function wrapCallback(OutputInterface $output, Process $process, callable $output->write($formatter->progress(spl_object_hash($process), $this->escapeString($buffer), Process::ERR === $type)); if (null !== $callback) { - call_user_func($callback, $type, $buffer); + \call_user_func($callback, $type, $buffer); } }; } diff --git a/vendor/symfony/console/Helper/ProgressBar.php b/vendor/symfony/console/Helper/ProgressBar.php index 247b59133..bea03e31b 100644 --- a/vendor/symfony/console/Helper/ProgressBar.php +++ b/vendor/symfony/console/Helper/ProgressBar.php @@ -11,9 +11,9 @@ namespace Symfony\Component\Console\Helper; +use Symfony\Component\Console\Exception\LogicException; use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Exception\LogicException; use Symfony\Component\Console\Terminal; /** @@ -583,7 +583,7 @@ private function buildLine() $regex = "{%([a-z\-_]+)(?:\:([^%]+))?%}i"; $callback = function ($matches) { if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) { - $text = call_user_func($formatter, $this, $this->output); + $text = \call_user_func($formatter, $this, $this->output); } elseif (isset($this->messages[$matches[1]])) { $text = $this->messages[$matches[1]]; } else { diff --git a/vendor/symfony/console/Helper/ProgressIndicator.php b/vendor/symfony/console/Helper/ProgressIndicator.php index d441accd4..9de766a24 100644 --- a/vendor/symfony/console/Helper/ProgressIndicator.php +++ b/vendor/symfony/console/Helper/ProgressIndicator.php @@ -53,7 +53,7 @@ public function __construct(OutputInterface $output, $format = null, $indicatorC $indicatorValues = array_values($indicatorValues); - if (2 > count($indicatorValues)) { + if (2 > \count($indicatorValues)) { throw new InvalidArgumentException('Must have at least 2 indicator value characters.'); } @@ -196,7 +196,7 @@ private function display() $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) { if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) { - return call_user_func($formatter, $self); + return \call_user_func($formatter, $self); } return $matches[0]; @@ -241,7 +241,7 @@ private static function initPlaceholderFormatters() { return array( 'indicator' => function (ProgressIndicator $indicator) { - return $indicator->indicatorValues[$indicator->indicatorCurrent % count($indicator->indicatorValues)]; + return $indicator->indicatorValues[$indicator->indicatorCurrent % \count($indicator->indicatorValues)]; }, 'message' => function (ProgressIndicator $indicator) { return $indicator->message; diff --git a/vendor/symfony/console/Helper/QuestionHelper.php b/vendor/symfony/console/Helper/QuestionHelper.php index e793256fe..bdf10f0ce 100644 --- a/vendor/symfony/console/Helper/QuestionHelper.php +++ b/vendor/symfony/console/Helper/QuestionHelper.php @@ -19,8 +19,8 @@ use Symfony\Component\Console\Input\StreamableInputInterface; use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Question\ChoiceQuestion; +use Symfony\Component\Console\Question\Question; /** * The QuestionHelper class provides helpers to interact with the user. @@ -47,13 +47,23 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu } if (!$input->isInteractive()) { - if ($question instanceof ChoiceQuestion) { + $default = $question->getDefault(); + + if (null !== $default && $question instanceof ChoiceQuestion) { $choices = $question->getChoices(); - return $choices[$question->getDefault()]; + if (!$question->isMultiselect()) { + return isset($choices[$default]) ? $choices[$default] : $default; + } + + $default = explode(',', $default); + foreach ($default as $k => $v) { + $v = trim($v); + $default[$k] = isset($choices[$v]) ? $choices[$v] : $v; + } } - return $question->getDefault(); + return $default; } if ($input instanceof StreamableInputInterface && $stream = $input->getStream()) { @@ -87,7 +97,7 @@ public function setInputStream($stream) { @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::setStream() instead.', __METHOD__, StreamableInputInterface::class), E_USER_DEPRECATED); - if (!is_resource($stream)) { + if (!\is_resource($stream)) { throw new InvalidArgumentException('Input stream must be a valid resource.'); } @@ -104,7 +114,7 @@ public function setInputStream($stream) */ public function getInputStream() { - if (0 === func_num_args() || func_get_arg(0)) { + if (0 === \func_num_args() || func_get_arg(0)) { @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.2 and will be removed in 4.0. Use %s::getStream() instead.', __METHOD__, StreamableInputInterface::class), E_USER_DEPRECATED); } @@ -130,7 +140,7 @@ public static function disableStty() /** * Asks the question to the user. * - * @return bool|mixed|null|string + * @return bool|mixed|string|null * * @throws RuntimeException In case the fallback is deactivated and the response cannot be hidden */ @@ -161,10 +171,10 @@ private function doAsk(OutputInterface $output, Question $question) $ret = trim($ret); } } else { - $ret = trim($this->autocomplete($output, $question, $inputStream, is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false))); + $ret = trim($this->autocomplete($output, $question, $inputStream, \is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false))); } - $ret = strlen($ret) > 0 ? $ret : $question->getDefault(); + $ret = \strlen($ret) > 0 ? $ret : $question->getDefault(); if ($normalizer = $question->getNormalizer()) { return $normalizer($ret); @@ -228,7 +238,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu $i = 0; $ofs = -1; $matches = $autocomplete; - $numMatches = count($matches); + $numMatches = \count($matches); $sttyMode = shell_exec('stty -g'); @@ -253,7 +263,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu if (0 === $i) { $ofs = -1; $matches = $autocomplete; - $numMatches = count($matches); + $numMatches = \count($matches); } else { $numMatches = 0; } @@ -277,13 +287,13 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu $ofs += ('A' === $c[2]) ? -1 : 1; $ofs = ($numMatches + $ofs) % $numMatches; } - } elseif (ord($c) < 32) { + } elseif (\ord($c) < 32) { if ("\t" === $c || "\n" === $c) { if ($numMatches > 0 && -1 !== $ofs) { $ret = $matches[$ofs]; // Echo out remaining chars for current match $output->write(substr($ret, $i)); - $i = strlen($ret); + $i = \strlen($ret); } if ("\n" === $c) { @@ -342,7 +352,7 @@ private function autocomplete(OutputInterface $output, Question $question, $inpu */ private function getHiddenResponse(OutputInterface $output, $inputStream) { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $exe = __DIR__.'/../Resources/bin/hiddeninput.exe'; // handle code running from a phar @@ -412,7 +422,7 @@ private function validateAttempts(callable $interviewer, OutputInterface $output } try { - return call_user_func($question->getValidator(), $interviewer()); + return \call_user_func($question->getValidator(), $interviewer()); } catch (RuntimeException $e) { throw $e; } catch (\Exception $error) { diff --git a/vendor/symfony/console/Helper/SymfonyQuestionHelper.php b/vendor/symfony/console/Helper/SymfonyQuestionHelper.php index cf071d594..5937741a2 100644 --- a/vendor/symfony/console/Helper/SymfonyQuestionHelper.php +++ b/vendor/symfony/console/Helper/SymfonyQuestionHelper.php @@ -12,13 +12,13 @@ namespace Symfony\Component\Console\Helper; use Symfony\Component\Console\Exception\LogicException; +use Symfony\Component\Console\Formatter\OutputFormatter; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Question\ChoiceQuestion; use Symfony\Component\Console\Question\ConfirmationQuestion; use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Style\SymfonyStyle; -use Symfony\Component\Console\Formatter\OutputFormatter; /** * Symfony Style Guide compliant question helper. @@ -40,7 +40,7 @@ public function ask(InputInterface $input, OutputInterface $output, Question $qu $value = $validator($value); } else { // make required - if (!is_array($value) && !is_bool($value) && 0 === strlen($value)) { + if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) { @trigger_error('The default question validator is deprecated since Symfony 3.3 and will not be used anymore in version 4.0. Set a custom question validator if needed.', E_USER_DEPRECATED); throw new LogicException('A value is required.'); @@ -86,7 +86,7 @@ protected function writePrompt(OutputInterface $output, Question $question) case $question instanceof ChoiceQuestion: $choices = $question->getChoices(); - $text = sprintf(' %s [%s]:', $text, OutputFormatter::escape($choices[$default])); + $text = sprintf(' %s [%s]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default)); break; diff --git a/vendor/symfony/console/Helper/Table.php b/vendor/symfony/console/Helper/Table.php index 81d0e427f..c15e5ab23 100644 --- a/vendor/symfony/console/Helper/Table.php +++ b/vendor/symfony/console/Helper/Table.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Console\Helper; -use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Output\OutputInterface; /** * Provides helpers to display a table. @@ -210,7 +210,7 @@ public function setColumnWidths(array $widths) public function setHeaders(array $headers) { $headers = array_values($headers); - if (!empty($headers) && !is_array($headers[0])) { + if (!empty($headers) && !\is_array($headers[0])) { $headers = array($headers); } @@ -243,7 +243,7 @@ public function addRow($row) return $this; } - if (!is_array($row)) { + if (!\is_array($row)) { throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.'); } @@ -263,15 +263,14 @@ public function setRow($column, array $row) * Renders table to output. * * Example: - * - * +---------------+-----------------------+------------------+ - * | ISBN | Title | Author | - * +---------------+-----------------------+------------------+ - * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | - * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | - * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | - * +---------------+-----------------------+------------------+ - * + * + * +---------------+-----------------------+------------------+ + * | ISBN | Title | Author | + * +---------------+-----------------------+------------------+ + * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | + * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | + * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | + * +---------------+-----------------------+------------------+ */ public function render() { @@ -305,7 +304,9 @@ public function render() /** * Renders horizontal header separator. * - * Example: +-----+-----------+-------+ + * Example: + * + * +-----+-----------+-------+ */ private function renderRowSeparator() { @@ -336,7 +337,9 @@ private function renderColumnSeparator() /** * Renders table row. * - * Example: | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | + * Example: + * + * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | * * @param array $row * @param string $cellFormat @@ -375,7 +378,7 @@ private function renderCell(array $row, $column, $cellFormat) // str_pad won't work properly with multi-byte strings, we need to fix the padding if (false !== $encoding = mb_detect_encoding($cell, null, true)) { - $width += strlen($cell) - mb_strwidth($cell, $encoding); + $width += \strlen($cell) - mb_strwidth($cell, $encoding); } $style = $this->getColumnStyle($column); @@ -414,7 +417,7 @@ private function calculateNumberOfColumns() private function buildTableRows($rows) { $unmergedRows = array(); - for ($rowKey = 0; $rowKey < count($rows); ++$rowKey) { + for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) { $rows = $this->fillNextRows($rows, $rowKey); // Remove any new line breaks and replace it with a new line @@ -461,15 +464,15 @@ private function fillNextRows(array $rows, $line) { $unmergedRows = array(); foreach ($rows[$line] as $column => $cell) { - if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(is_object($cell) && method_exists($cell, '__toString'))) { - throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing __toString, %s given.', gettype($cell))); + if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(\is_object($cell) && method_exists($cell, '__toString'))) { + throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing __toString, %s given.', \gettype($cell))); } if ($cell instanceof TableCell && $cell->getRowspan() > 1) { $nbLines = $cell->getRowspan() - 1; $lines = array($cell); if (strstr($cell, "\n")) { $lines = explode("\n", str_replace("\n", "\n", $cell)); - $nbLines = count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines; + $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines; $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan())); unset($lines[0]); @@ -489,7 +492,7 @@ private function fillNextRows(array $rows, $line) foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) { // we need to know if $unmergedRow will be merged or inserted into $rows - if (isset($rows[$unmergedRowKey]) && is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) { + if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) { foreach ($unmergedRow as $cellKey => $cell) { // insert cell into row at cellKey position array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell)); @@ -555,7 +558,7 @@ private function copyRow(array $rows, $line) */ private function getNumberOfColumns(array $row) { - $columns = count($row); + $columns = \count($row); foreach ($row as $column) { $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0; } @@ -609,7 +612,7 @@ private function calculateColumnsWidth(array $rows) $lengths[] = $this->getCellWidth($row, $column); } - $this->effectiveColumnWidths[$column] = max($lengths) + strlen($this->style->getCellRowContentFormat()) - 2; + $this->effectiveColumnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2; } } @@ -620,7 +623,7 @@ private function calculateColumnsWidth(array $rows) */ private function getColumnSeparatorWidth() { - return strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar())); + return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar())); } /** diff --git a/vendor/symfony/console/Helper/TableCell.php b/vendor/symfony/console/Helper/TableCell.php index 6fc7d3b91..fb6c9fd37 100644 --- a/vendor/symfony/console/Helper/TableCell.php +++ b/vendor/symfony/console/Helper/TableCell.php @@ -30,7 +30,7 @@ class TableCell */ public function __construct($value = '', array $options = array()) { - if (is_numeric($value) && !is_string($value)) { + if (is_numeric($value) && !\is_string($value)) { $value = (string) $value; } diff --git a/vendor/symfony/console/Helper/TableStyle.php b/vendor/symfony/console/Helper/TableStyle.php index 2999c76f8..0ee9dd167 100644 --- a/vendor/symfony/console/Helper/TableStyle.php +++ b/vendor/symfony/console/Helper/TableStyle.php @@ -125,7 +125,7 @@ public function setCrossingChar($crossingChar) /** * Gets crossing character. * - * @return string $crossingChar + * @return string */ public function getCrossingChar() { @@ -237,7 +237,7 @@ public function getBorderFormat() */ public function setPadType($padType) { - if (!in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) { + if (!\in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) { throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).'); } diff --git a/vendor/symfony/console/Input/ArgvInput.php b/vendor/symfony/console/Input/ArgvInput.php index fd8198107..516fd87fd 100644 --- a/vendor/symfony/console/Input/ArgvInput.php +++ b/vendor/symfony/console/Input/ArgvInput.php @@ -97,7 +97,7 @@ private function parseShortOption($token) { $name = substr($token, 1); - if (strlen($name) > 1) { + if (\strlen($name) > 1) { if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) { // an option with a value (with no space) $this->addShortOption($name[0], substr($name, 1)); @@ -118,10 +118,11 @@ private function parseShortOption($token) */ private function parseShortOptionSet($name) { - $len = strlen($name); + $len = \strlen($name); for ($i = 0; $i < $len; ++$i) { if (!$this->definition->hasShortcut($name[$i])) { - throw new RuntimeException(sprintf('The "-%s" option does not exist.', $name[$i])); + $encoding = mb_detect_encoding($name, null, true); + throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding))); } $option = $this->definition->getOptionForShortcut($name[$i]); @@ -145,7 +146,7 @@ private function parseLongOption($token) $name = substr($token, 2); if (false !== $pos = strpos($name, '=')) { - if (0 === strlen($value = substr($name, $pos + 1))) { + if (0 === \strlen($value = substr($name, $pos + 1))) { // if no value after "=" then substr() returns "" since php7 only, false before // see http://php.net/manual/fr/migration70.incompatible.php#119151 if (\PHP_VERSION_ID < 70000 && false === $value) { @@ -168,7 +169,7 @@ private function parseLongOption($token) */ private function parseArgument($token) { - $c = count($this->arguments); + $c = \count($this->arguments); // if input is expecting another argument, add it if ($this->definition->hasArgument($c)) { @@ -183,7 +184,7 @@ private function parseArgument($token) // unexpected argument } else { $all = $this->definition->getArguments(); - if (count($all)) { + if (\count($all)) { throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all)))); } @@ -228,11 +229,11 @@ private function addLongOption($name, $value) throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name)); } - if (in_array($value, array('', null), true) && $option->acceptValue() && count($this->parsed)) { + if (\in_array($value, array('', null), true) && $option->acceptValue() && \count($this->parsed)) { // if option accepts an optional or mandatory argument // let's see if there is one provided $next = array_shift($this->parsed); - if ((isset($next[0]) && '-' !== $next[0]) || in_array($next, array('', null), true)) { + if ((isset($next[0]) && '-' !== $next[0]) || \in_array($next, array('', null), true)) { $value = $next; } else { array_unshift($this->parsed, $next); @@ -303,10 +304,10 @@ public function getParameterOption($values, $default = false, $onlyParams = fals $values = (array) $values; $tokens = $this->tokens; - while (0 < count($tokens)) { + while (0 < \count($tokens)) { $token = array_shift($tokens); if ($onlyParams && '--' === $token) { - return false; + return $default; } foreach ($values as $value) { @@ -318,7 +319,7 @@ public function getParameterOption($values, $default = false, $onlyParams = fals // For short options, test for '-o' at beginning $leading = 0 === strpos($value, '--') ? $value.'=' : $value; if ('' !== $leading && 0 === strpos($token, $leading)) { - return substr($token, strlen($leading)); + return substr($token, \strlen($leading)); } } } diff --git a/vendor/symfony/console/Input/ArrayInput.php b/vendor/symfony/console/Input/ArrayInput.php index 4d9797ba1..8b6917fc7 100644 --- a/vendor/symfony/console/Input/ArrayInput.php +++ b/vendor/symfony/console/Input/ArrayInput.php @@ -56,7 +56,7 @@ public function hasParameterOption($values, $onlyParams = false) $values = (array) $values; foreach ($this->parameters as $k => $v) { - if (!is_int($k)) { + if (!\is_int($k)) { $v = $k; } @@ -64,7 +64,7 @@ public function hasParameterOption($values, $onlyParams = false) return false; } - if (in_array($v, $values)) { + if (\in_array($v, $values)) { return true; } } @@ -80,15 +80,15 @@ public function getParameterOption($values, $default = false, $onlyParams = fals $values = (array) $values; foreach ($this->parameters as $k => $v) { - if ($onlyParams && ('--' === $k || (is_int($k) && '--' === $v))) { - return false; + if ($onlyParams && ('--' === $k || (\is_int($k) && '--' === $v))) { + return $default; } - if (is_int($k)) { - if (in_array($v, $values)) { + if (\is_int($k)) { + if (\in_array($v, $values)) { return true; } - } elseif (in_array($k, $values)) { + } elseif (\in_array($k, $values)) { return $v; } } @@ -106,7 +106,7 @@ public function __toString() $params = array(); foreach ($this->parameters as $param => $val) { if ($param && '-' === $param[0]) { - if (is_array($val)) { + if (\is_array($val)) { foreach ($val as $v) { $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : ''); } @@ -114,7 +114,7 @@ public function __toString() $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : ''); } } else { - $params[] = is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val); + $params[] = \is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val); } } diff --git a/vendor/symfony/console/Input/Input.php b/vendor/symfony/console/Input/Input.php index 414132521..fa5644d1f 100644 --- a/vendor/symfony/console/Input/Input.php +++ b/vendor/symfony/console/Input/Input.php @@ -72,7 +72,7 @@ public function validate() return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired(); }); - if (count($missingArguments) > 0) { + if (\count($missingArguments) > 0) { throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments))); } } diff --git a/vendor/symfony/console/Input/InputArgument.php b/vendor/symfony/console/Input/InputArgument.php index a969d2c5a..5b3b98ba7 100644 --- a/vendor/symfony/console/Input/InputArgument.php +++ b/vendor/symfony/console/Input/InputArgument.php @@ -31,10 +31,10 @@ class InputArgument private $description; /** - * @param string $name The argument name - * @param int $mode The argument mode: self::REQUIRED or self::OPTIONAL - * @param string $description A description text - * @param mixed $default The default value (for self::OPTIONAL mode only) + * @param string $name The argument name + * @param int|null $mode The argument mode: self::REQUIRED or self::OPTIONAL + * @param string $description A description text + * @param string|string[]|null $default The default value (for self::OPTIONAL mode only) * * @throws InvalidArgumentException When argument mode is not valid */ @@ -42,7 +42,7 @@ public function __construct($name, $mode = null, $description = '', $default = n { if (null === $mode) { $mode = self::OPTIONAL; - } elseif (!is_int($mode) || $mode > 7 || $mode < 1) { + } elseif (!\is_int($mode) || $mode > 7 || $mode < 1) { throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode)); } @@ -86,7 +86,7 @@ public function isArray() /** * Sets the default value. * - * @param mixed $default The default value + * @param string|string[]|null $default The default value * * @throws LogicException When incorrect default value is given */ @@ -99,7 +99,7 @@ public function setDefault($default = null) if ($this->isArray()) { if (null === $default) { $default = array(); - } elseif (!is_array($default)) { + } elseif (!\is_array($default)) { throw new LogicException('A default value for an array argument must be an array.'); } } @@ -110,7 +110,7 @@ public function setDefault($default = null) /** * Returns the default value. * - * @return mixed The default value + * @return string|string[]|null The default value */ public function getDefault() { diff --git a/vendor/symfony/console/Input/InputAwareInterface.php b/vendor/symfony/console/Input/InputAwareInterface.php index d0f11e986..5a288de5d 100644 --- a/vendor/symfony/console/Input/InputAwareInterface.php +++ b/vendor/symfony/console/Input/InputAwareInterface.php @@ -21,8 +21,6 @@ interface InputAwareInterface { /** * Sets the Console Input. - * - * @param InputInterface */ public function setInput(InputInterface $input); } diff --git a/vendor/symfony/console/Input/InputDefinition.php b/vendor/symfony/console/Input/InputDefinition.php index d5b99ab39..19f8db33d 100644 --- a/vendor/symfony/console/Input/InputDefinition.php +++ b/vendor/symfony/console/Input/InputDefinition.php @@ -20,8 +20,8 @@ * Usage: * * $definition = new InputDefinition(array( - * new InputArgument('name', InputArgument::REQUIRED), - * new InputOption('foo', 'f', InputOption::VALUE_REQUIRED), + * new InputArgument('name', InputArgument::REQUIRED), + * new InputOption('foo', 'f', InputOption::VALUE_REQUIRED), * )); * * @author Fabien Potencier @@ -135,7 +135,7 @@ public function getArgument($name) throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name)); } - $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments; + $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments; return $arguments[$name]; } @@ -149,7 +149,7 @@ public function getArgument($name) */ public function hasArgument($name) { - $arguments = is_int($name) ? array_values($this->arguments) : $this->arguments; + $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments; return isset($arguments[$name]); } @@ -171,7 +171,7 @@ public function getArguments() */ public function getArgumentCount() { - return $this->hasAnArrayArgument ? PHP_INT_MAX : count($this->arguments); + return $this->hasAnArrayArgument ? PHP_INT_MAX : \count($this->arguments); } /** @@ -378,7 +378,7 @@ public function getSynopsis($short = false) } } - if (count($elements) && $this->getArguments()) { + if (\count($elements) && $this->getArguments()) { $elements[] = '[--]'; } @@ -387,7 +387,7 @@ public function getSynopsis($short = false) if (!$argument->isRequired()) { $element = '['.$element.']'; } elseif ($argument->isArray()) { - $element = $element.' ('.$element.')'; + $element .= ' ('.$element.')'; } if ($argument->isArray()) { diff --git a/vendor/symfony/console/Input/InputInterface.php b/vendor/symfony/console/Input/InputInterface.php index 43810f7ac..b9bcf3bbc 100644 --- a/vendor/symfony/console/Input/InputInterface.php +++ b/vendor/symfony/console/Input/InputInterface.php @@ -61,6 +61,8 @@ public function getParameterOption($values, $default = false, $onlyParams = fals /** * Binds the current Input instance with the given arguments and options. + * + * @throws RuntimeException */ public function bind(InputDefinition $definition); @@ -83,7 +85,7 @@ public function getArguments(); * * @param string $name The argument name * - * @return mixed The argument value + * @return string|string[]|null The argument value * * @throws InvalidArgumentException When argument given doesn't exist */ @@ -92,8 +94,8 @@ public function getArgument($name); /** * Sets an argument value by name. * - * @param string $name The argument name - * @param string $value The argument value + * @param string $name The argument name + * @param string|string[]|null $value The argument value * * @throws InvalidArgumentException When argument given doesn't exist */ @@ -120,7 +122,7 @@ public function getOptions(); * * @param string $name The option name * - * @return mixed The option value + * @return string|string[]|bool|null The option value * * @throws InvalidArgumentException When option given doesn't exist */ @@ -129,8 +131,8 @@ public function getOption($name); /** * Sets an option value by name. * - * @param string $name The option name - * @param string|bool $value The option value + * @param string $name The option name + * @param string|string[]|bool|null $value The option value * * @throws InvalidArgumentException When option given doesn't exist */ diff --git a/vendor/symfony/console/Input/InputOption.php b/vendor/symfony/console/Input/InputOption.php index c9da966a2..20c9d2ea5 100644 --- a/vendor/symfony/console/Input/InputOption.php +++ b/vendor/symfony/console/Input/InputOption.php @@ -33,11 +33,11 @@ class InputOption private $description; /** - * @param string $name The option name - * @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts - * @param int $mode The option mode: One of the VALUE_* constants - * @param string $description A description text - * @param mixed $default The default value (must be null for self::VALUE_NONE) + * @param string $name The option name + * @param string|array $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the VALUE_* constants + * @param string $description A description text + * @param string|string[]|int|bool|null $default The default value (must be null for self::VALUE_NONE) * * @throws InvalidArgumentException If option mode is invalid or incompatible */ @@ -56,7 +56,7 @@ public function __construct($name, $shortcut = null, $mode = null, $description } if (null !== $shortcut) { - if (is_array($shortcut)) { + if (\is_array($shortcut)) { $shortcut = implode('|', $shortcut); } $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-')); @@ -70,7 +70,7 @@ public function __construct($name, $shortcut = null, $mode = null, $description if (null === $mode) { $mode = self::VALUE_NONE; - } elseif (!is_int($mode) || $mode > 15 || $mode < 1) { + } elseif (!\is_int($mode) || $mode > 15 || $mode < 1) { throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode)); } @@ -149,7 +149,7 @@ public function isArray() /** * Sets the default value. * - * @param mixed $default The default value + * @param string|string[]|int|bool|null $default The default value * * @throws LogicException When incorrect default value is given */ @@ -162,7 +162,7 @@ public function setDefault($default = null) if ($this->isArray()) { if (null === $default) { $default = array(); - } elseif (!is_array($default)) { + } elseif (!\is_array($default)) { throw new LogicException('A default value for an array option must be an array.'); } } @@ -173,7 +173,7 @@ public function setDefault($default = null) /** * Returns the default value. * - * @return mixed The default value + * @return string|string[]|int|bool|null The default value */ public function getDefault() { diff --git a/vendor/symfony/console/Input/StringInput.php b/vendor/symfony/console/Input/StringInput.php index 969b9da74..eb39ad692 100644 --- a/vendor/symfony/console/Input/StringInput.php +++ b/vendor/symfony/console/Input/StringInput.php @@ -49,14 +49,14 @@ public function __construct($input) private function tokenize($input) { $tokens = array(); - $length = strlen($input); + $length = \strlen($input); $cursor = 0; while ($cursor < $length) { if (preg_match('/\s+/A', $input, $match, null, $cursor)) { } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) { - $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, strlen($match[3]) - 2))); + $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, \strlen($match[3]) - 2))); } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) { - $tokens[] = stripcslashes(substr($match[0], 1, strlen($match[0]) - 2)); + $tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2)); } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) { $tokens[] = stripcslashes($match[1]); } else { @@ -64,7 +64,7 @@ private function tokenize($input) throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10))); } - $cursor += strlen($match[0]); + $cursor += \strlen($match[0]); } return $tokens; diff --git a/vendor/symfony/console/Logger/ConsoleLogger.php b/vendor/symfony/console/Logger/ConsoleLogger.php index 05dd3b966..ea7f9bf25 100644 --- a/vendor/symfony/console/Logger/ConsoleLogger.php +++ b/vendor/symfony/console/Logger/ConsoleLogger.php @@ -14,8 +14,8 @@ use Psr\Log\AbstractLogger; use Psr\Log\InvalidArgumentException; use Psr\Log\LogLevel; -use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\ConsoleOutputInterface; +use Symfony\Component\Console\Output\OutputInterface; /** * PSR-3 compliant console logger. diff --git a/vendor/symfony/console/Output/ConsoleOutput.php b/vendor/symfony/console/Output/ConsoleOutput.php index edef356c4..3cb0fb1ae 100644 --- a/vendor/symfony/console/Output/ConsoleOutput.php +++ b/vendor/symfony/console/Output/ConsoleOutput.php @@ -122,7 +122,7 @@ protected function hasStderrSupport() private function isRunningOS400() { $checks = array( - function_exists('php_uname') ? php_uname('s') : '', + \function_exists('php_uname') ? php_uname('s') : '', getenv('OSTYPE'), PHP_OS, ); diff --git a/vendor/symfony/console/Output/Output.php b/vendor/symfony/console/Output/Output.php index 371735e14..c3856cc57 100644 --- a/vendor/symfony/console/Output/Output.php +++ b/vendor/symfony/console/Output/Output.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Console\Output; -use Symfony\Component\Console\Formatter\OutputFormatterInterface; use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Formatter\OutputFormatterInterface; /** * Base class for output classes. diff --git a/vendor/symfony/console/Output/OutputInterface.php b/vendor/symfony/console/Output/OutputInterface.php index cddfbb49e..ad785a4ce 100644 --- a/vendor/symfony/console/Output/OutputInterface.php +++ b/vendor/symfony/console/Output/OutputInterface.php @@ -33,7 +33,7 @@ interface OutputInterface /** * Writes a message to the output. * - * @param string|array $messages The message as an array of lines or a single string + * @param string|array $messages The message as an array of strings or a single string * @param bool $newline Whether to add a newline * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL */ @@ -42,7 +42,7 @@ public function write($messages, $newline = false, $options = 0); /** * Writes a message to the output and adds a newline at the end. * - * @param string|array $messages The message as an array of lines of a single string + * @param string|array $messages The message as an array of strings or a single string * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL */ public function writeln($messages, $options = 0); diff --git a/vendor/symfony/console/Output/StreamOutput.php b/vendor/symfony/console/Output/StreamOutput.php index 5fc5d01e1..7ff602763 100644 --- a/vendor/symfony/console/Output/StreamOutput.php +++ b/vendor/symfony/console/Output/StreamOutput.php @@ -20,11 +20,11 @@ * * Usage: * - * $output = new StreamOutput(fopen('php://stdout', 'w')); + * $output = new StreamOutput(fopen('php://stdout', 'w')); * * As `StreamOutput` can use any stream, you can also use a file: * - * $output = new StreamOutput(fopen('/path/to/output.log', 'a', false)); + * $output = new StreamOutput(fopen('/path/to/output.log', 'a', false)); * * @author Fabien Potencier */ @@ -42,7 +42,7 @@ class StreamOutput extends Output */ public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null) { - if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) { + if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) { throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.'); } @@ -70,7 +70,11 @@ public function getStream() */ protected function doWrite($message, $newline) { - if (false === @fwrite($this->stream, $message) || ($newline && (false === @fwrite($this->stream, PHP_EOL)))) { + if ($newline) { + $message .= PHP_EOL; + } + + if (false === @fwrite($this->stream, $message)) { // should never happen throw new RuntimeException('Unable to write output.'); } @@ -93,19 +97,23 @@ protected function doWrite($message, $newline) */ protected function hasColorSupport() { - if (DIRECTORY_SEPARATOR === '\\') { - return (function_exists('sapi_windows_vt100_support') + if ('Hyper' === getenv('TERM_PROGRAM')) { + return true; + } + + if (\DIRECTORY_SEPARATOR === '\\') { + return (\function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support($this->stream)) || false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM'); } - if (function_exists('stream_isatty')) { + if (\function_exists('stream_isatty')) { return @stream_isatty($this->stream); } - if (function_exists('posix_isatty')) { + if (\function_exists('posix_isatty')) { return @posix_isatty($this->stream); } diff --git a/vendor/symfony/console/Question/ChoiceQuestion.php b/vendor/symfony/console/Question/ChoiceQuestion.php index 46cc72a36..0a45d7493 100644 --- a/vendor/symfony/console/Question/ChoiceQuestion.php +++ b/vendor/symfony/console/Question/ChoiceQuestion.php @@ -156,7 +156,7 @@ private function getDefaultValidator() } } - if (count($results) > 1) { + if (\count($results) > 1) { throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results))); } diff --git a/vendor/symfony/console/Question/ConfirmationQuestion.php b/vendor/symfony/console/Question/ConfirmationQuestion.php index 40f54b4e9..150ab27f3 100644 --- a/vendor/symfony/console/Question/ConfirmationQuestion.php +++ b/vendor/symfony/console/Question/ConfirmationQuestion.php @@ -44,7 +44,7 @@ private function getDefaultNormalizer() $regex = $this->trueAnswerRegex; return function ($answer) use ($default, $regex) { - if (is_bool($answer)) { + if (\is_bool($answer)) { return $answer; } diff --git a/vendor/symfony/console/Question/Question.php b/vendor/symfony/console/Question/Question.php index 63afbc4c0..92b9b6936 100644 --- a/vendor/symfony/console/Question/Question.php +++ b/vendor/symfony/console/Question/Question.php @@ -117,7 +117,7 @@ public function setHiddenFallback($fallback) /** * Gets values for the autocompleter. * - * @return null|iterable + * @return iterable|null */ public function getAutocompleterValues() { @@ -127,7 +127,7 @@ public function getAutocompleterValues() /** * Sets values for the autocompleter. * - * @param null|iterable $values + * @param iterable|null $values * * @return $this * @@ -136,11 +136,11 @@ public function getAutocompleterValues() */ public function setAutocompleterValues($values) { - if (is_array($values)) { + if (\is_array($values)) { $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values); } - if (null !== $values && !is_array($values) && !$values instanceof \Traversable) { + if (null !== $values && !\is_array($values) && !$values instanceof \Traversable) { throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.'); } @@ -156,7 +156,7 @@ public function setAutocompleterValues($values) /** * Sets a validator for the question. * - * @param null|callable $validator + * @param callable|null $validator * * @return $this */ @@ -170,7 +170,7 @@ public function setValidator(callable $validator = null) /** * Gets the validator for the question. * - * @return null|callable + * @return callable|null */ public function getValidator() { @@ -182,7 +182,7 @@ public function getValidator() * * Null means an unlimited number of attempts. * - * @param null|int $attempts + * @param int|null $attempts * * @return $this * @@ -204,7 +204,7 @@ public function setMaxAttempts($attempts) * * Null means an unlimited number of attempts. * - * @return null|int + * @return int|null */ public function getMaxAttempts() { @@ -241,6 +241,6 @@ public function getNormalizer() protected function isAssoc($array) { - return (bool) count(array_filter(array_keys($array), 'is_string')); + return (bool) \count(array_filter(array_keys($array), 'is_string')); } } diff --git a/vendor/symfony/console/Style/OutputStyle.php b/vendor/symfony/console/Style/OutputStyle.php index ad8864110..b1262b55d 100644 --- a/vendor/symfony/console/Style/OutputStyle.php +++ b/vendor/symfony/console/Style/OutputStyle.php @@ -13,8 +13,8 @@ use Symfony\Component\Console\Formatter\OutputFormatterInterface; use Symfony\Component\Console\Helper\ProgressBar; -use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\ConsoleOutputInterface; +use Symfony\Component\Console\Output\OutputInterface; /** * Decorates output to add console style guide helpers. diff --git a/vendor/symfony/console/Style/SymfonyStyle.php b/vendor/symfony/console/Style/SymfonyStyle.php index 6cf53cd92..e74ab6627 100644 --- a/vendor/symfony/console/Style/SymfonyStyle.php +++ b/vendor/symfony/console/Style/SymfonyStyle.php @@ -46,7 +46,7 @@ public function __construct(InputInterface $input, OutputInterface $output) $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter()); // Windows cmd wraps lines as soon as the terminal width is reached, whether there are following chars or not. $width = (new Terminal())->getWidth() ?: self::MAX_LINE_LENGTH; - $this->lineLength = min($width - (int) (DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH); + $this->lineLength = min($width - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH); parent::__construct($output); } @@ -63,7 +63,7 @@ public function __construct(InputInterface $input, OutputInterface $output) */ public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = true) { - $messages = is_array($messages) ? array_values($messages) : array($messages); + $messages = \is_array($messages) ? array_values($messages) : array($messages); $this->autoPrependBlock(); $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, $escape)); @@ -117,7 +117,7 @@ public function text($message) { $this->autoPrependText(); - $messages = is_array($message) ? array_values($message) : array($message); + $messages = \is_array($message) ? array_values($message) : array($message); foreach ($messages as $message) { $this->writeln(sprintf(' %s', $message)); } @@ -269,7 +269,7 @@ public function createProgressBar($max = 0) { $progressBar = parent::createProgressBar($max); - if ('\\' !== DIRECTORY_SEPARATOR) { + if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) { $progressBar->setEmptyBarCharacter('░'); // light shade character \u2591 $progressBar->setProgressCharacter(''); $progressBar->setBarCharacter('▓'); // dark shade character \u2593 @@ -387,7 +387,7 @@ private function createBlock($messages, $type = null, $style = null, $prefix = ' if (null !== $type) { $type = sprintf('[%s] ', $type); - $indentLength = strlen($type); + $indentLength = \strlen($type); $lineIndentation = str_repeat(' ', $indentLength); } @@ -399,7 +399,7 @@ private function createBlock($messages, $type = null, $style = null, $prefix = ' $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true))); - if (count($messages) > 1 && $key < count($messages) - 1) { + if (\count($messages) > 1 && $key < \count($messages) - 1) { $lines[] = ''; } } diff --git a/vendor/symfony/console/Terminal.php b/vendor/symfony/console/Terminal.php index 927dfc4d7..3930ca0cd 100644 --- a/vendor/symfony/console/Terminal.php +++ b/vendor/symfony/console/Terminal.php @@ -56,7 +56,7 @@ public function getHeight() private static function initDimensions() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { if (preg_match('/^(\d+)x(\d+)(?: \((\d+)x(\d+)\))?$/', trim(getenv('ANSICON')), $matches)) { // extract [w, H] from "wxh (WxH)" // or [w, h] from "wxh" @@ -87,7 +87,7 @@ private static function initDimensions() */ private static function getConsoleMode() { - if (!function_exists('proc_open')) { + if (!\function_exists('proc_open')) { return; } @@ -96,7 +96,7 @@ private static function getConsoleMode() 2 => array('pipe', 'w'), ); $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true)); - if (is_resource($process)) { + if (\is_resource($process)) { $info = stream_get_contents($pipes[1]); fclose($pipes[1]); fclose($pipes[2]); @@ -115,7 +115,7 @@ private static function getConsoleMode() */ private static function getSttyColumns() { - if (!function_exists('proc_open')) { + if (!\function_exists('proc_open')) { return; } @@ -125,7 +125,7 @@ private static function getSttyColumns() ); $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true)); - if (is_resource($process)) { + if (\is_resource($process)) { $info = stream_get_contents($pipes[1]); fclose($pipes[1]); fclose($pipes[2]); diff --git a/vendor/symfony/console/Tester/CommandTester.php b/vendor/symfony/console/Tester/CommandTester.php index 39723b261..131ca9b16 100644 --- a/vendor/symfony/console/Tester/CommandTester.php +++ b/vendor/symfony/console/Tester/CommandTester.php @@ -13,9 +13,9 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\ArrayInput; -use Symfony\Component\Console\Output\StreamOutput; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Output\StreamOutput; /** * Eases the testing of console commands. diff --git a/vendor/symfony/console/Tests/ApplicationTest.php b/vendor/symfony/console/Tests/ApplicationTest.php index 38389b1b4..7922ce273 100644 --- a/vendor/symfony/console/Tests/ApplicationTest.php +++ b/vendor/symfony/console/Tests/ApplicationTest.php @@ -16,24 +16,24 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\CommandLoader\FactoryCommandLoader; use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass; -use Symfony\Component\Console\Helper\HelperSet; +use Symfony\Component\Console\Event\ConsoleCommandEvent; +use Symfony\Component\Console\Event\ConsoleErrorEvent; +use Symfony\Component\Console\Event\ConsoleExceptionEvent; +use Symfony\Component\Console\Event\ConsoleTerminateEvent; +use Symfony\Component\Console\Exception\CommandNotFoundException; use Symfony\Component\Console\Helper\FormatterHelper; +use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\ArrayInput; -use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputDefinition; +use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\NullOutput; use Symfony\Component\Console\Output\Output; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\StreamOutput; use Symfony\Component\Console\Tester\ApplicationTester; -use Symfony\Component\Console\Event\ConsoleCommandEvent; -use Symfony\Component\Console\Event\ConsoleErrorEvent; -use Symfony\Component\Console\Event\ConsoleExceptionEvent; -use Symfony\Component\Console\Event\ConsoleTerminateEvent; -use Symfony\Component\Console\Exception\CommandNotFoundException; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\EventDispatcher\EventDispatcher; @@ -776,6 +776,20 @@ public function testRenderExceptionLineBreaks() $this->assertStringMatchesFormatFile(self::$fixturesPath.'/application_renderexception_linebreaks.txt', $tester->getDisplay(true), '->renderException() keep multiple line breaks'); } + public function testRenderExceptionStackTraceContainsRootException() + { + $application = new Application(); + $application->setAutoExit(false); + $application->register('foo')->setCode(function () { + throw new \Exception('Verbose exception'); + }); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'foo'), array('decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE)); + + $this->assertContains(sprintf('() at %s:', __FILE__), $tester->getDisplay()); + } + public function testRun() { $application = new Application(); @@ -912,6 +926,30 @@ public function testRunReturnsIntegerExitCode() $this->assertSame(4, $exitCode, '->run() returns integer exit code extracted from raised exception'); } + public function testRunDispatchesIntegerExitCode() + { + $passedRightValue = false; + + // We can assume here that some other test asserts that the event is dispatched at all + $dispatcher = new EventDispatcher(); + $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use (&$passedRightValue) { + $passedRightValue = (4 === $event->getExitCode()); + }); + + $application = new Application(); + $application->setDispatcher($dispatcher); + $application->setAutoExit(false); + + $application->register('test')->setCode(function (InputInterface $input, OutputInterface $output) { + throw new \Exception('', 4); + }); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'test')); + + $this->assertTrue($passedRightValue, '-> exit code 4 was passed in the console.terminate event'); + } + public function testRunReturnsExitCodeOneForExceptionCodeZero() { $exception = new \Exception('', 0); @@ -927,6 +965,30 @@ public function testRunReturnsExitCodeOneForExceptionCodeZero() $this->assertSame(1, $exitCode, '->run() returns exit code 1 when exception code is 0'); } + public function testRunDispatchesExitCodeOneForExceptionCodeZero() + { + $passedRightValue = false; + + // We can assume here that some other test asserts that the event is dispatched at all + $dispatcher = new EventDispatcher(); + $dispatcher->addListener('console.terminate', function (ConsoleTerminateEvent $event) use (&$passedRightValue) { + $passedRightValue = (1 === $event->getExitCode()); + }); + + $application = new Application(); + $application->setDispatcher($dispatcher); + $application->setAutoExit(false); + + $application->register('test')->setCode(function (InputInterface $input, OutputInterface $output) { + throw new \Exception(); + }); + + $tester = new ApplicationTester($application); + $tester->run(array('command' => 'test')); + + $this->assertTrue($passedRightValue, '-> exit code 1 was passed in the console.terminate event'); + } + /** * @expectedException \LogicException * @expectedExceptionMessage An option with shortcut "e" already exists. diff --git a/vendor/symfony/console/Tests/Command/CommandTest.php b/vendor/symfony/console/Tests/Command/CommandTest.php index 4fcbf9575..6bc3f75b9 100644 --- a/vendor/symfony/console/Tests/Command/CommandTest.php +++ b/vendor/symfony/console/Tests/Command/CommandTest.php @@ -12,16 +12,16 @@ namespace Symfony\Component\Console\Tests\Command; use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Helper\FormatterHelper; -use Symfony\Component\Console\Application; -use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputArgument; -use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\StringInput; -use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Output\NullOutput; +use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Tester\CommandTester; class CommandTest extends TestCase @@ -340,7 +340,7 @@ public function testRunWithProcessTitle() $command->setApplication(new Application()); $command->setProcessTitle('foo'); $this->assertSame(0, $command->run(new StringInput(''), new NullOutput())); - if (function_exists('cli_set_process_title')) { + if (\function_exists('cli_set_process_title')) { if (null === @cli_get_process_title() && 'Darwin' === PHP_OS) { $this->markTestSkipped('Running "cli_get_process_title" as an unprivileged user is not supported on MacOS.'); } diff --git a/vendor/symfony/console/Tests/Command/HelpCommandTest.php b/vendor/symfony/console/Tests/Command/HelpCommandTest.php index 4d618ac16..30fe2b6e7 100644 --- a/vendor/symfony/console/Tests/Command/HelpCommandTest.php +++ b/vendor/symfony/console/Tests/Command/HelpCommandTest.php @@ -12,10 +12,10 @@ namespace Symfony\Component\Console\Tests\Command; use PHPUnit\Framework\TestCase; -use Symfony\Component\Console\Tester\CommandTester; +use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\HelpCommand; use Symfony\Component\Console\Command\ListCommand; -use Symfony\Component\Console\Application; +use Symfony\Component\Console\Tester\CommandTester; class HelpCommandTest extends TestCase { diff --git a/vendor/symfony/console/Tests/Command/ListCommandTest.php b/vendor/symfony/console/Tests/Command/ListCommandTest.php index 64478ecc0..b39f7ec54 100644 --- a/vendor/symfony/console/Tests/Command/ListCommandTest.php +++ b/vendor/symfony/console/Tests/Command/ListCommandTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Console\Tests\Command; use PHPUnit\Framework\TestCase; -use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Console\Application; +use Symfony\Component\Console\Tester\CommandTester; class ListCommandTest extends TestCase { diff --git a/vendor/symfony/console/Tests/DependencyInjection/AddConsoleCommandPassTest.php b/vendor/symfony/console/Tests/DependencyInjection/AddConsoleCommandPassTest.php index 34f648610..67fbb9864 100644 --- a/vendor/symfony/console/Tests/DependencyInjection/AddConsoleCommandPassTest.php +++ b/vendor/symfony/console/Tests/DependencyInjection/AddConsoleCommandPassTest.php @@ -12,10 +12,12 @@ namespace Symfony\Component\Console\Tests\DependencyInjection; use PHPUnit\Framework\TestCase; +use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\CommandLoader\ContainerCommandLoader; use Symfony\Component\Console\DependencyInjection\AddConsoleCommandPass; -use Symfony\Component\Console\Command\Command; use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; +use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\Compiler\PassConfig; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\TypedReference; @@ -28,7 +30,7 @@ class AddConsoleCommandPassTest extends TestCase public function testProcess($public) { $container = new ContainerBuilder(); - $container->addCompilerPass(new AddConsoleCommandPass()); + $container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING); $container->setParameter('my-command.class', 'Symfony\Component\Console\Tests\DependencyInjection\MyCommand'); $definition = new Definition('%my-command.class%'); @@ -127,7 +129,7 @@ public function testProcessThrowAnExceptionIfTheServiceIsAbstract() { $container = new ContainerBuilder(); $container->setResourceTracking(false); - $container->addCompilerPass(new AddConsoleCommandPass()); + $container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING); $definition = new Definition('Symfony\Component\Console\Tests\DependencyInjection\MyCommand'); $definition->addTag('console.command'); @@ -145,7 +147,7 @@ public function testProcessThrowAnExceptionIfTheServiceIsNotASubclassOfCommand() { $container = new ContainerBuilder(); $container->setResourceTracking(false); - $container->addCompilerPass(new AddConsoleCommandPass()); + $container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING); $definition = new Definition('SplObjectStorage'); $definition->addTag('console.command'); @@ -175,6 +177,79 @@ public function testProcessPrivateServicesWithSameCommand() $this->assertTrue($container->hasAlias($alias1)); $this->assertTrue($container->hasAlias($alias2)); } + + public function testProcessOnChildDefinitionWithClass() + { + $container = new ContainerBuilder(); + $container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING); + $className = 'Symfony\Component\Console\Tests\DependencyInjection\MyCommand'; + + $parentId = 'my-parent-command'; + $childId = 'my-child-command'; + + $parentDefinition = new Definition(/* no class */); + $parentDefinition->setAbstract(true)->setPublic(false); + + $childDefinition = new ChildDefinition($parentId); + $childDefinition->addTag('console.command')->setPublic(true); + $childDefinition->setClass($className); + + $container->setDefinition($parentId, $parentDefinition); + $container->setDefinition($childId, $childDefinition); + + $container->compile(); + $command = $container->get($childId); + + $this->assertInstanceOf($className, $command); + } + + public function testProcessOnChildDefinitionWithParentClass() + { + $container = new ContainerBuilder(); + $container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING); + $className = 'Symfony\Component\Console\Tests\DependencyInjection\MyCommand'; + + $parentId = 'my-parent-command'; + $childId = 'my-child-command'; + + $parentDefinition = new Definition($className); + $parentDefinition->setAbstract(true)->setPublic(false); + + $childDefinition = new ChildDefinition($parentId); + $childDefinition->addTag('console.command')->setPublic(true); + + $container->setDefinition($parentId, $parentDefinition); + $container->setDefinition($childId, $childDefinition); + + $container->compile(); + $command = $container->get($childId); + + $this->assertInstanceOf($className, $command); + } + + /** + * @expectedException \RuntimeException + * @expectedExceptionMessage The definition for "my-child-command" has no class. + */ + public function testProcessOnChildDefinitionWithoutClass() + { + $container = new ContainerBuilder(); + $container->addCompilerPass(new AddConsoleCommandPass(), PassConfig::TYPE_BEFORE_REMOVING); + + $parentId = 'my-parent-command'; + $childId = 'my-child-command'; + + $parentDefinition = new Definition(); + $parentDefinition->setAbstract(true)->setPublic(false); + + $childDefinition = new ChildDefinition($parentId); + $childDefinition->addTag('console.command')->setPublic(true); + + $container->setDefinition($parentId, $parentDefinition); + $container->setDefinition($childId, $childDefinition); + + $container->compile(); + } } class MyCommand extends Command diff --git a/vendor/symfony/console/Tests/EventListener/ErrorListenerTest.php b/vendor/symfony/console/Tests/EventListener/ErrorListenerTest.php index 3794a2660..b3f3fb454 100644 --- a/vendor/symfony/console/Tests/EventListener/ErrorListenerTest.php +++ b/vendor/symfony/console/Tests/EventListener/ErrorListenerTest.php @@ -20,8 +20,8 @@ use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Input\ArrayInput; use Symfony\Component\Console\Input\Input; -use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\StringInput; use Symfony\Component\Console\Output\OutputInterface; class ErrorListenerTest extends TestCase diff --git a/vendor/symfony/console/Tests/Fixtures/Foo6Command.php b/vendor/symfony/console/Tests/Fixtures/Foo6Command.php index 6ae987e48..ef5bd7702 100644 --- a/vendor/symfony/console/Tests/Fixtures/Foo6Command.php +++ b/vendor/symfony/console/Tests/Fixtures/Foo6Command.php @@ -1,6 +1,5 @@ assertEquals('Superman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, true), $this->createOutputInterface(), $question)); } + public function testAskChoiceNonInteractive() + { + $questionHelper = new QuestionHelper(); + + $helperSet = new HelperSet(array(new FormatterHelper())); + $questionHelper->setHelperSet($helperSet); + $inputStream = $this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"); + + $heroes = array('Superman', 'Batman', 'Spiderman'); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0'); + + $this->assertSame('Superman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, 'Batman'); + $this->assertSame('Batman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null); + $this->assertNull($questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0'); + $question->setValidator(null); + $this->assertSame('Superman', $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + try { + $question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null); + $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question); + } catch (\InvalidArgumentException $e) { + $this->assertSame('Value "" is invalid', $e->getMessage()); + } + + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, '0, 1'); + $question->setMultiselect(true); + $this->assertSame(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, '0, 1'); + $question->setMultiselect(true); + $question->setValidator(null); + $this->assertSame(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, '0, Batman'); + $question->setMultiselect(true); + $this->assertSame(array('Superman', 'Batman'), $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, null); + $question->setMultiselect(true); + $this->assertNull($questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question)); + + try { + $question = new ChoiceQuestion('Who are your favorite superheros?', $heroes, ''); + $question->setMultiselect(true); + $questionHelper->ask($this->createStreamableInputInterfaceMock($inputStream, false), $this->createOutputInterface(), $question); + } catch (\InvalidArgumentException $e) { + $this->assertSame('Value "" is invalid', $e->getMessage()); + } + } + public function testAsk() { $dialog = new QuestionHelper(); @@ -221,7 +278,7 @@ public function testAutocompleteWithTrailingBackslash() public function testAskHiddenResponse() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('This test is not supported on Windows'); } @@ -276,7 +333,7 @@ public function testAskAndValidate() $error = 'This is not a color!'; $validator = function ($color) use ($error) { - if (!in_array($color, array('white', 'black'))) { + if (!\in_array($color, array('white', 'black'))) { throw new \InvalidArgumentException($error); } @@ -637,7 +694,7 @@ public function testLegacyAskWithAutocompleteWithNonSequentialKeys() */ public function testLegacyAskHiddenResponse() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('This test is not supported on Windows'); } @@ -688,7 +745,7 @@ public function testLegacyAskAndValidate() $error = 'This is not a color!'; $validator = function ($color) use ($error) { - if (!in_array($color, array('white', 'black'))) { + if (!\in_array($color, array('white', 'black'))) { throw new \InvalidArgumentException($error); } diff --git a/vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php b/vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php index ce946e5b6..9406e5b86 100644 --- a/vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php +++ b/vendor/symfony/console/Tests/Helper/SymfonyQuestionHelperTest.php @@ -6,8 +6,8 @@ use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\SymfonyQuestionHelper; use Symfony\Component\Console\Output\StreamOutput; -use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Question\ChoiceQuestion; +use Symfony\Component\Console\Question\Question; /** * @group tty @@ -74,6 +74,18 @@ public function testAskChoice() $this->assertOutputContains('What is your favorite superhero? [Superman, Batman]', $output); } + public function testAskChoiceWithChoiceValueAsDefault() + { + $questionHelper = new SymfonyQuestionHelper(); + $helperSet = new HelperSet(array(new FormatterHelper())); + $questionHelper->setHelperSet($helperSet); + $question = new ChoiceQuestion('What is your favorite superhero?', array('Superman', 'Batman', 'Spiderman'), 'Batman'); + $question->setMaxAttempts(1); + + $this->assertSame('Batman', $questionHelper->ask($this->createStreamableInputInterfaceMock($this->getInputStream("Batman\n")), $output = $this->createOutputInterface(), $question)); + $this->assertOutputContains('What is your favorite superhero? [Batman]', $output); + } + public function testAskReturnsNullIfValidatorAllowsIt() { $questionHelper = new SymfonyQuestionHelper(); diff --git a/vendor/symfony/console/Tests/Helper/TableTest.php b/vendor/symfony/console/Tests/Helper/TableTest.php index b195e09ac..b6a9d3b78 100644 --- a/vendor/symfony/console/Tests/Helper/TableTest.php +++ b/vendor/symfony/console/Tests/Helper/TableTest.php @@ -13,9 +13,9 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Helper\Table; -use Symfony\Component\Console\Helper\TableStyle; -use Symfony\Component\Console\Helper\TableSeparator; use Symfony\Component\Console\Helper\TableCell; +use Symfony\Component\Console\Helper\TableSeparator; +use Symfony\Component\Console\Helper\TableStyle; use Symfony\Component\Console\Output\StreamOutput; class TableTest extends TestCase @@ -742,7 +742,7 @@ public function testThrowsWhenTheCellInAnArray() $table->render(); } - public function testColumnWith() + public function testColumnWidth() { $table = new Table($output = $this->getOutputStream()); $table @@ -774,7 +774,7 @@ public function testColumnWith() $this->assertEquals($expected, $this->getOutputContent($output)); } - public function testColumnWiths() + public function testColumnWidths() { $table = new Table($output = $this->getOutputStream()); $table @@ -824,6 +824,42 @@ public function testGetStyleDefinition() Table::getStyleDefinition('absent'); } + public function testBoxedStyleWithColspan() + { + $boxed = new TableStyle(); + $boxed + ->setHorizontalBorderChar('─') + ->setVerticalBorderChar('│') + ->setCrossingChar('┼') + ; + + $table = new Table($output = $this->getOutputStream()); + $table->setStyle($boxed); + $table + ->setHeaders(array('ISBN', 'Title', 'Author')) + ->setRows(array( + array('99921-58-10-7', 'Divine Comedy', 'Dante Alighieri'), + new TableSeparator(), + array(new TableCell('This value spans 3 columns.', array('colspan' => 3))), + )) + ; + $table->render(); + + $expected = + <<assertSame($expected, $this->getOutputContent($output)); + } + protected function getOutputStream($decorated = false) { return new StreamOutput($this->stream, StreamOutput::VERBOSITY_NORMAL, $decorated); diff --git a/vendor/symfony/console/Tests/Input/ArgvInputTest.php b/vendor/symfony/console/Tests/Input/ArgvInputTest.php index 61d1723e0..b91b6d71d 100644 --- a/vendor/symfony/console/Tests/Input/ArgvInputTest.php +++ b/vendor/symfony/console/Tests/Input/ArgvInputTest.php @@ -13,8 +13,8 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\ArgvInput; -use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; class ArgvInputTest extends TestCase @@ -246,6 +246,11 @@ public function provideInvalidInput() new InputDefinition(array(new InputArgument('number'))), 'The "-1" option does not exist.', ), + array( + array('cli.php', '-fЩ'), + new InputDefinition(array(new InputOption('foo', 'f', InputOption::VALUE_NONE))), + 'The "-Щ" option does not exist.', + ), ); } @@ -395,25 +400,26 @@ public function testToString() /** * @dataProvider provideGetParameterOptionValues */ - public function testGetParameterOptionEqualSign($argv, $key, $onlyParams, $expected) + public function testGetParameterOptionEqualSign($argv, $key, $default, $onlyParams, $expected) { $input = new ArgvInput($argv); - $this->assertEquals($expected, $input->getParameterOption($key, false, $onlyParams), '->getParameterOption() returns the expected value'); + $this->assertEquals($expected, $input->getParameterOption($key, $default, $onlyParams), '->getParameterOption() returns the expected value'); } public function provideGetParameterOptionValues() { return array( - array(array('app/console', 'foo:bar', '-e', 'dev'), '-e', false, 'dev'), - array(array('app/console', 'foo:bar', '--env=dev'), '--env', false, 'dev'), - array(array('app/console', 'foo:bar', '-e', 'dev'), array('-e', '--env'), false, 'dev'), - array(array('app/console', 'foo:bar', '--env=dev'), array('-e', '--env'), false, 'dev'), - array(array('app/console', 'foo:bar', '--env=dev', '--en=1'), array('--en'), false, '1'), - array(array('app/console', 'foo:bar', '--env=dev', '', '--en=1'), array('--en'), false, '1'), - array(array('app/console', 'foo:bar', '--env', 'val'), '--env', false, 'val'), - array(array('app/console', 'foo:bar', '--env', 'val', '--dummy'), '--env', false, 'val'), - array(array('app/console', 'foo:bar', '--', '--env=dev'), '--env', false, 'dev'), - array(array('app/console', 'foo:bar', '--', '--env=dev'), '--env', true, false), + array(array('app/console', 'foo:bar'), '-e', 'default', false, 'default'), + array(array('app/console', 'foo:bar', '-e', 'dev'), '-e', 'default', false, 'dev'), + array(array('app/console', 'foo:bar', '--env=dev'), '--env', 'default', false, 'dev'), + array(array('app/console', 'foo:bar', '-e', 'dev'), array('-e', '--env'), 'default', false, 'dev'), + array(array('app/console', 'foo:bar', '--env=dev'), array('-e', '--env'), 'default', false, 'dev'), + array(array('app/console', 'foo:bar', '--env=dev', '--en=1'), array('--en'), 'default', false, '1'), + array(array('app/console', 'foo:bar', '--env=dev', '', '--en=1'), array('--en'), 'default', false, '1'), + array(array('app/console', 'foo:bar', '--env', 'val'), '--env', 'default', false, 'val'), + array(array('app/console', 'foo:bar', '--env', 'val', '--dummy'), '--env', 'default', false, 'val'), + array(array('app/console', 'foo:bar', '--', '--env=dev'), '--env', 'default', false, 'dev'), + array(array('app/console', 'foo:bar', '--', '--env=dev'), '--env', 'default', true, 'default'), ); } diff --git a/vendor/symfony/console/Tests/Input/ArrayInputTest.php b/vendor/symfony/console/Tests/Input/ArrayInputTest.php index 6b443e0b2..4bc83b3ca 100644 --- a/vendor/symfony/console/Tests/Input/ArrayInputTest.php +++ b/vendor/symfony/console/Tests/Input/ArrayInputTest.php @@ -13,8 +13,8 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\ArrayInput; -use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; class ArrayInputTest extends TestCase @@ -47,14 +47,14 @@ public function testGetParameterOption() { $input = new ArrayInput(array('name' => 'Fabien', '--foo' => 'bar')); $this->assertEquals('bar', $input->getParameterOption('--foo'), '->getParameterOption() returns the option of specified name'); - $this->assertFalse($input->getParameterOption('--bar'), '->getParameterOption() returns the default if an option is not present in the passed parameters'); + $this->assertEquals('default', $input->getParameterOption('--bar', 'default'), '->getParameterOption() returns the default value if an option is not present in the passed parameters'); $input = new ArrayInput(array('Fabien', '--foo' => 'bar')); $this->assertEquals('bar', $input->getParameterOption('--foo'), '->getParameterOption() returns the option of specified name'); $input = new ArrayInput(array('--foo', '--', '--bar' => 'woop')); $this->assertEquals('woop', $input->getParameterOption('--bar'), '->getParameterOption() returns the correct value if an option is present in the passed parameters'); - $this->assertFalse($input->getParameterOption('--bar', false, true), '->getParameterOption() returns false if an option is present in the passed parameters after an end of options signal'); + $this->assertEquals('default', $input->getParameterOption('--bar', 'default', true), '->getParameterOption() returns the default value if an option is present in the passed parameters after an end of options signal'); } public function testParseArguments() diff --git a/vendor/symfony/console/Tests/Input/InputDefinitionTest.php b/vendor/symfony/console/Tests/Input/InputDefinitionTest.php index 1374ddfdf..d9ff5435b 100644 --- a/vendor/symfony/console/Tests/Input/InputDefinitionTest.php +++ b/vendor/symfony/console/Tests/Input/InputDefinitionTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Console\Tests\Input; use PHPUnit\Framework\TestCase; -use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; class InputDefinitionTest extends TestCase diff --git a/vendor/symfony/console/Tests/Input/InputTest.php b/vendor/symfony/console/Tests/Input/InputTest.php index 4410d2f59..7cf1d244a 100644 --- a/vendor/symfony/console/Tests/Input/InputTest.php +++ b/vendor/symfony/console/Tests/Input/InputTest.php @@ -13,8 +13,8 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Input\ArrayInput; -use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputDefinition; use Symfony\Component\Console\Input\InputOption; class InputTest extends TestCase diff --git a/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php b/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php index 734a153e8..95e78fc29 100644 --- a/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php +++ b/vendor/symfony/console/Tests/Logger/ConsoleLoggerTest.php @@ -16,8 +16,8 @@ use Psr\Log\LogLevel; use Symfony\Component\Console\Logger\ConsoleLogger; use Symfony\Component\Console\Output\BufferedOutput; -use Symfony\Component\Console\Tests\Fixtures\DummyOutput; use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Tests\Fixtures\DummyOutput; /** * Console logger test. diff --git a/vendor/symfony/console/Tests/Output/OutputTest.php b/vendor/symfony/console/Tests/Output/OutputTest.php index d8330d0bd..fbd4e8498 100644 --- a/vendor/symfony/console/Tests/Output/OutputTest.php +++ b/vendor/symfony/console/Tests/Output/OutputTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Console\Tests\Output; use PHPUnit\Framework\TestCase; -use Symfony\Component\Console\Output\Output; use Symfony\Component\Console\Formatter\OutputFormatterStyle; +use Symfony\Component\Console\Output\Output; class OutputTest extends TestCase { diff --git a/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php b/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php index 865bb33f7..308030bbc 100644 --- a/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php +++ b/vendor/symfony/console/Tests/Style/SymfonyStyleTest.php @@ -13,12 +13,12 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Tester\CommandTester; use Symfony\Component\Console\Formatter\OutputFormatter; -use Symfony\Component\Console\Output\OutputInterface; -use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\ConsoleOutputInterface; +use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Console\Tester\CommandTester; class SymfonyStyleTest extends TestCase { diff --git a/vendor/symfony/console/Tests/Tester/CommandTesterTest.php b/vendor/symfony/console/Tests/Tester/CommandTesterTest.php index 8d86da436..58eb8103f 100644 --- a/vendor/symfony/console/Tests/Tester/CommandTesterTest.php +++ b/vendor/symfony/console/Tests/Tester/CommandTesterTest.php @@ -14,12 +14,12 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Console\Application; use Symfony\Component\Console\Command\Command; -use Symfony\Component\Console\Output\Output; -use Symfony\Component\Console\Tester\CommandTester; -use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Helper\QuestionHelper; +use Symfony\Component\Console\Output\Output; +use Symfony\Component\Console\Question\Question; use Symfony\Component\Console\Style\SymfonyStyle; +use Symfony\Component\Console\Tester\CommandTester; class CommandTesterTest extends TestCase { diff --git a/vendor/symfony/console/phpunit.xml.dist b/vendor/symfony/console/phpunit.xml.dist index 32569d63c..15e7e52a9 100644 --- a/vendor/symfony/console/phpunit.xml.dist +++ b/vendor/symfony/console/phpunit.xml.dist @@ -1,7 +1,7 @@ nodeName) { - $this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', get_called_class()); + $this->nodeName = preg_replace('~.*\\\\([^\\\\]+)Node$~', '$1', \get_called_class()); } return $this->nodeName; diff --git a/vendor/symfony/css-selector/Node/ElementNode.php b/vendor/symfony/css-selector/Node/ElementNode.php index bcdce7a7a..54869af6c 100644 --- a/vendor/symfony/css-selector/Node/ElementNode.php +++ b/vendor/symfony/css-selector/Node/ElementNode.php @@ -37,7 +37,7 @@ public function __construct($namespace = null, $element = null) } /** - * @return null|string + * @return string|null */ public function getNamespace() { @@ -45,7 +45,7 @@ public function getNamespace() } /** - * @return null|string + * @return string|null */ public function getElement() { diff --git a/vendor/symfony/css-selector/Node/SelectorNode.php b/vendor/symfony/css-selector/Node/SelectorNode.php index 5ef2be62a..057107f6f 100644 --- a/vendor/symfony/css-selector/Node/SelectorNode.php +++ b/vendor/symfony/css-selector/Node/SelectorNode.php @@ -28,7 +28,7 @@ class SelectorNode extends AbstractNode /** * @param NodeInterface $tree - * @param null|string $pseudoElement + * @param string|null $pseudoElement */ public function __construct(NodeInterface $tree, $pseudoElement = null) { @@ -45,7 +45,7 @@ public function getTree() } /** - * @return null|string + * @return string|null */ public function getPseudoElement() { diff --git a/vendor/symfony/css-selector/Node/Specificity.php b/vendor/symfony/css-selector/Node/Specificity.php index 6aa70d781..a11b7f73d 100644 --- a/vendor/symfony/css-selector/Node/Specificity.php +++ b/vendor/symfony/css-selector/Node/Specificity.php @@ -48,7 +48,7 @@ public function __construct($a, $b, $c) /** * @return self */ - public function plus(Specificity $specificity) + public function plus(self $specificity) { return new self($this->a + $specificity->a, $this->b + $specificity->b, $this->c + $specificity->c); } @@ -69,7 +69,7 @@ public function getValue() * * @return int */ - public function compareTo(Specificity $specificity) + public function compareTo(self $specificity) { if ($this->a !== $specificity->a) { return $this->a > $specificity->a ? 1 : -1; diff --git a/vendor/symfony/css-selector/Parser/Handler/HashHandler.php b/vendor/symfony/css-selector/Parser/Handler/HashHandler.php index 5f7f4d23b..e451328f1 100644 --- a/vendor/symfony/css-selector/Parser/Handler/HashHandler.php +++ b/vendor/symfony/css-selector/Parser/Handler/HashHandler.php @@ -13,9 +13,9 @@ use Symfony\Component\CssSelector\Parser\Reader; use Symfony\Component\CssSelector\Parser\Token; -use Symfony\Component\CssSelector\Parser\TokenStream; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; +use Symfony\Component\CssSelector\Parser\TokenStream; /** * CSS selector comment handler. @@ -51,7 +51,7 @@ public function handle(Reader $reader, TokenStream $stream) $value = $this->escaping->escapeUnicode($match[1]); $stream->push(new Token(Token::TYPE_HASH, $value, $reader->getPosition())); - $reader->moveForward(strlen($match[0])); + $reader->moveForward(\strlen($match[0])); return true; } diff --git a/vendor/symfony/css-selector/Parser/Handler/IdentifierHandler.php b/vendor/symfony/css-selector/Parser/Handler/IdentifierHandler.php index aa6804ed4..1591fcb54 100644 --- a/vendor/symfony/css-selector/Parser/Handler/IdentifierHandler.php +++ b/vendor/symfony/css-selector/Parser/Handler/IdentifierHandler.php @@ -13,9 +13,9 @@ use Symfony\Component\CssSelector\Parser\Reader; use Symfony\Component\CssSelector\Parser\Token; -use Symfony\Component\CssSelector\Parser\TokenStream; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; +use Symfony\Component\CssSelector\Parser\TokenStream; /** * CSS selector comment handler. @@ -51,7 +51,7 @@ public function handle(Reader $reader, TokenStream $stream) $value = $this->escaping->escapeUnicode($match[0]); $stream->push(new Token(Token::TYPE_IDENTIFIER, $value, $reader->getPosition())); - $reader->moveForward(strlen($match[0])); + $reader->moveForward(\strlen($match[0])); return true; } diff --git a/vendor/symfony/css-selector/Parser/Handler/NumberHandler.php b/vendor/symfony/css-selector/Parser/Handler/NumberHandler.php index 7e561d1dc..5955903cd 100644 --- a/vendor/symfony/css-selector/Parser/Handler/NumberHandler.php +++ b/vendor/symfony/css-selector/Parser/Handler/NumberHandler.php @@ -13,8 +13,8 @@ use Symfony\Component\CssSelector\Parser\Reader; use Symfony\Component\CssSelector\Parser\Token; -use Symfony\Component\CssSelector\Parser\TokenStream; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; +use Symfony\Component\CssSelector\Parser\TokenStream; /** * CSS selector comment handler. @@ -47,7 +47,7 @@ public function handle(Reader $reader, TokenStream $stream) } $stream->push(new Token(Token::TYPE_NUMBER, $match[0], $reader->getPosition())); - $reader->moveForward(strlen($match[0])); + $reader->moveForward(\strlen($match[0])); return true; } diff --git a/vendor/symfony/css-selector/Parser/Handler/StringHandler.php b/vendor/symfony/css-selector/Parser/Handler/StringHandler.php index f842e1ce2..00155b046 100644 --- a/vendor/symfony/css-selector/Parser/Handler/StringHandler.php +++ b/vendor/symfony/css-selector/Parser/Handler/StringHandler.php @@ -15,9 +15,9 @@ use Symfony\Component\CssSelector\Exception\SyntaxErrorException; use Symfony\Component\CssSelector\Parser\Reader; use Symfony\Component\CssSelector\Parser\Token; -use Symfony\Component\CssSelector\Parser\TokenStream; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; +use Symfony\Component\CssSelector\Parser\TokenStream; /** * CSS selector comment handler. @@ -47,7 +47,7 @@ public function handle(Reader $reader, TokenStream $stream) { $quote = $reader->getSubstring(1); - if (!in_array($quote, array("'", '"'))) { + if (!\in_array($quote, array("'", '"'))) { return false; } @@ -59,18 +59,18 @@ public function handle(Reader $reader, TokenStream $stream) } // check unclosed strings - if (strlen($match[0]) === $reader->getRemainingLength()) { + if (\strlen($match[0]) === $reader->getRemainingLength()) { throw SyntaxErrorException::unclosedString($reader->getPosition() - 1); } // check quotes pairs validity - if ($quote !== $reader->getSubstring(1, strlen($match[0]))) { + if ($quote !== $reader->getSubstring(1, \strlen($match[0]))) { throw SyntaxErrorException::unclosedString($reader->getPosition() - 1); } $string = $this->escaping->escapeUnicodeAndNewLine($match[0]); $stream->push(new Token(Token::TYPE_STRING, $string, $reader->getPosition())); - $reader->moveForward(strlen($match[0]) + 1); + $reader->moveForward(\strlen($match[0]) + 1); return true; } diff --git a/vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php b/vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php index 4c2d3354f..396467af0 100644 --- a/vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php +++ b/vendor/symfony/css-selector/Parser/Handler/WhitespaceHandler.php @@ -39,7 +39,7 @@ public function handle(Reader $reader, TokenStream $stream) } $stream->push(new Token(Token::TYPE_WHITESPACE, $match[0], $reader->getPosition())); - $reader->moveForward(strlen($match[0])); + $reader->moveForward(\strlen($match[0])); return true; } diff --git a/vendor/symfony/css-selector/Parser/Parser.php b/vendor/symfony/css-selector/Parser/Parser.php index 195e10715..87c05a74b 100644 --- a/vendor/symfony/css-selector/Parser/Parser.php +++ b/vendor/symfony/css-selector/Parser/Parser.php @@ -169,7 +169,7 @@ private function parseSimpleSelector(TokenStream $stream, $insideNegation = fals { $stream->skipWhitespace(); - $selectorStart = count($stream->getUsed()); + $selectorStart = \count($stream->getUsed()); $result = $this->parseElementNode($stream); $pseudoElement = null; @@ -206,7 +206,7 @@ private function parseSimpleSelector(TokenStream $stream, $insideNegation = fals } $identifier = $stream->getNextIdentifier(); - if (in_array(strtolower($identifier), array('first-line', 'first-letter', 'before', 'after'))) { + if (\in_array(strtolower($identifier), array('first-line', 'first-letter', 'before', 'after'))) { // Special case: CSS 2.1 pseudo-elements can have a single ':'. // Any new pseudo-element must have two. $pseudoElement = $identifier; @@ -272,7 +272,7 @@ private function parseSimpleSelector(TokenStream $stream, $insideNegation = fals } } - if (count($stream->getUsed()) === $selectorStart) { + if (\count($stream->getUsed()) === $selectorStart) { throw SyntaxErrorException::unexpectedToken('selector', $stream->getPeek()); } diff --git a/vendor/symfony/css-selector/Parser/Reader.php b/vendor/symfony/css-selector/Parser/Reader.php index 5a1be30cd..076cb711c 100644 --- a/vendor/symfony/css-selector/Parser/Reader.php +++ b/vendor/symfony/css-selector/Parser/Reader.php @@ -33,7 +33,7 @@ class Reader public function __construct($source) { $this->source = $source; - $this->length = strlen($source); + $this->length = \strlen($source); } /** diff --git a/vendor/symfony/css-selector/Parser/Token.php b/vendor/symfony/css-selector/Parser/Token.php index 9baaa6dd8..72baae776 100644 --- a/vendor/symfony/css-selector/Parser/Token.php +++ b/vendor/symfony/css-selector/Parser/Token.php @@ -92,7 +92,7 @@ public function isDelimiter(array $values = array()) return true; } - return in_array($this->value, $values); + return \in_array($this->value, $values); } /** diff --git a/vendor/symfony/css-selector/Parser/TokenStream.php b/vendor/symfony/css-selector/Parser/TokenStream.php index 24e8634ad..d2aee541c 100644 --- a/vendor/symfony/css-selector/Parser/TokenStream.php +++ b/vendor/symfony/css-selector/Parser/TokenStream.php @@ -142,7 +142,7 @@ public function getNextIdentifier() /** * Returns nex identifier or star delimiter token. * - * @return null|string The identifier token value or null if star found + * @return string|null The identifier token value or null if star found * * @throws SyntaxErrorException If next token is not an identifier or a star delimiter */ diff --git a/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php b/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php index c6f289aa1..55ea42149 100644 --- a/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php +++ b/vendor/symfony/css-selector/Parser/Tokenizer/TokenizerEscaping.php @@ -65,13 +65,13 @@ private function replaceUnicodeSequences($value) $c = hexdec($match[1]); if (0x80 > $c %= 0x200000) { - return chr($c); + return \chr($c); } if (0x800 > $c) { - return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F); + return \chr(0xC0 | $c >> 6).\chr(0x80 | $c & 0x3F); } if (0x10000 > $c) { - return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F); + return \chr(0xE0 | $c >> 12).\chr(0x80 | $c >> 6 & 0x3F).\chr(0x80 | $c & 0x3F); } }, $value); } diff --git a/vendor/symfony/css-selector/Tests/Node/HashNodeTest.php b/vendor/symfony/css-selector/Tests/Node/HashNodeTest.php index 8554b226d..3bc74da94 100644 --- a/vendor/symfony/css-selector/Tests/Node/HashNodeTest.php +++ b/vendor/symfony/css-selector/Tests/Node/HashNodeTest.php @@ -11,8 +11,8 @@ namespace Symfony\Component\CssSelector\Tests\Node; -use Symfony\Component\CssSelector\Node\HashNode; use Symfony\Component\CssSelector\Node\ElementNode; +use Symfony\Component\CssSelector\Node\HashNode; class HashNodeTest extends AbstractNodeTest { diff --git a/vendor/symfony/css-selector/Tests/Node/NegationNodeTest.php b/vendor/symfony/css-selector/Tests/Node/NegationNodeTest.php index edf4552ba..ed4d2482c 100644 --- a/vendor/symfony/css-selector/Tests/Node/NegationNodeTest.php +++ b/vendor/symfony/css-selector/Tests/Node/NegationNodeTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\CssSelector\Tests\Node; use Symfony\Component\CssSelector\Node\ClassNode; -use Symfony\Component\CssSelector\Node\NegationNode; use Symfony\Component\CssSelector\Node\ElementNode; +use Symfony\Component\CssSelector\Node\NegationNode; class NegationNodeTest extends AbstractNodeTest { diff --git a/vendor/symfony/css-selector/Tests/Parser/Handler/AbstractHandlerTest.php b/vendor/symfony/css-selector/Tests/Parser/Handler/AbstractHandlerTest.php index 8005616a9..f5c9dc8bf 100644 --- a/vendor/symfony/css-selector/Tests/Parser/Handler/AbstractHandlerTest.php +++ b/vendor/symfony/css-selector/Tests/Parser/Handler/AbstractHandlerTest.php @@ -63,7 +63,7 @@ protected function assertRemainingContent(Reader $reader, $remainingContent) $this->assertEquals(0, $reader->getRemainingLength()); $this->assertTrue($reader->isEOF()); } else { - $this->assertEquals(strlen($remainingContent), $reader->getRemainingLength()); + $this->assertEquals(\strlen($remainingContent), $reader->getRemainingLength()); $this->assertEquals(0, $reader->getOffset($remainingContent)); } } diff --git a/vendor/symfony/css-selector/Tests/Parser/Handler/HashHandlerTest.php b/vendor/symfony/css-selector/Tests/Parser/Handler/HashHandlerTest.php index b7fa00a22..5730120bf 100644 --- a/vendor/symfony/css-selector/Tests/Parser/Handler/HashHandlerTest.php +++ b/vendor/symfony/css-selector/Tests/Parser/Handler/HashHandlerTest.php @@ -13,8 +13,8 @@ use Symfony\Component\CssSelector\Parser\Handler\HashHandler; use Symfony\Component\CssSelector\Parser\Token; -use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; class HashHandlerTest extends AbstractHandlerTest { diff --git a/vendor/symfony/css-selector/Tests/Parser/Handler/IdentifierHandlerTest.php b/vendor/symfony/css-selector/Tests/Parser/Handler/IdentifierHandlerTest.php index 44d357498..f56430c7e 100644 --- a/vendor/symfony/css-selector/Tests/Parser/Handler/IdentifierHandlerTest.php +++ b/vendor/symfony/css-selector/Tests/Parser/Handler/IdentifierHandlerTest.php @@ -13,8 +13,8 @@ use Symfony\Component\CssSelector\Parser\Handler\IdentifierHandler; use Symfony\Component\CssSelector\Parser\Token; -use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; class IdentifierHandlerTest extends AbstractHandlerTest { diff --git a/vendor/symfony/css-selector/Tests/Parser/Handler/StringHandlerTest.php b/vendor/symfony/css-selector/Tests/Parser/Handler/StringHandlerTest.php index 89eff8bd2..8ea5d4d58 100644 --- a/vendor/symfony/css-selector/Tests/Parser/Handler/StringHandlerTest.php +++ b/vendor/symfony/css-selector/Tests/Parser/Handler/StringHandlerTest.php @@ -13,8 +13,8 @@ use Symfony\Component\CssSelector\Parser\Handler\StringHandler; use Symfony\Component\CssSelector\Parser\Token; -use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerEscaping; +use Symfony\Component\CssSelector\Parser\Tokenizer\TokenizerPatterns; class StringHandlerTest extends AbstractHandlerTest { diff --git a/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php b/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php index 519417835..610458297 100644 --- a/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php +++ b/vendor/symfony/css-selector/Tests/XPath/TranslatorTest.php @@ -37,9 +37,9 @@ public function testXmlLang($css, array $elementsId) $translator = new Translator(); $document = new \SimpleXMLElement(file_get_contents(__DIR__.'/Fixtures/lang.xml')); $elements = $document->xpath($translator->cssToXPath($css)); - $this->assertCount(count($elementsId), $elements); + $this->assertCount(\count($elementsId), $elements); foreach ($elements as $element) { - $this->assertTrue(in_array($element->attributes()->id, $elementsId)); + $this->assertTrue(\in_array($element->attributes()->id, $elementsId)); } } @@ -54,10 +54,10 @@ public function testHtmlIds($css, array $elementsId) $document->loadHTMLFile(__DIR__.'/Fixtures/ids.html'); $document = simplexml_import_dom($document); $elements = $document->xpath($translator->cssToXPath($css)); - $this->assertCount(count($elementsId), $elementsId); + $this->assertCount(\count($elementsId), $elementsId); foreach ($elements as $element) { if (null !== $element->attributes()->id) { - $this->assertTrue(in_array($element->attributes()->id, $elementsId)); + $this->assertTrue(\in_array($element->attributes()->id, $elementsId)); } } libxml_clear_errors(); diff --git a/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php b/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php index 6ace8b592..2078dca61 100644 --- a/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php +++ b/vendor/symfony/css-selector/XPath/Extension/AttributeMatchingExtension.php @@ -128,7 +128,7 @@ public function translateSuffixMatch(XPathExpr $xpath, $attribute, $value) return $xpath->addCondition($value ? sprintf( '%1$s and substring(%1$s, string-length(%1$s)-%2$s) = %3$s', $attribute, - strlen($value) - 1, + \strlen($value) - 1, Translator::getXpathLiteral($value) ) : '0'); } diff --git a/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php b/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php index c2606b5ad..4d34d0ef2 100644 --- a/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php +++ b/vendor/symfony/css-selector/XPath/Extension/FunctionExtension.php @@ -150,10 +150,7 @@ public function translateContains(XPathExpr $xpath, FunctionNode $function) $arguments = $function->getArguments(); foreach ($arguments as $token) { if (!($token->isString() || $token->isIdentifier())) { - throw new ExpressionErrorException( - 'Expected a single string or identifier for :contains(), got ' - .implode(', ', $arguments) - ); + throw new ExpressionErrorException('Expected a single string or identifier for :contains(), got '.implode(', ', $arguments)); } } @@ -173,10 +170,7 @@ public function translateLang(XPathExpr $xpath, FunctionNode $function) $arguments = $function->getArguments(); foreach ($arguments as $token) { if (!($token->isString() || $token->isIdentifier())) { - throw new ExpressionErrorException( - 'Expected a single string or identifier for :lang(), got ' - .implode(', ', $arguments) - ); + throw new ExpressionErrorException('Expected a single string or identifier for :lang(), got '.implode(', ', $arguments)); } } diff --git a/vendor/symfony/css-selector/XPath/Extension/HtmlExtension.php b/vendor/symfony/css-selector/XPath/Extension/HtmlExtension.php index 625ffa5ca..cd8e0d5fd 100644 --- a/vendor/symfony/css-selector/XPath/Extension/HtmlExtension.php +++ b/vendor/symfony/css-selector/XPath/Extension/HtmlExtension.php @@ -158,10 +158,7 @@ public function translateLang(XPathExpr $xpath, FunctionNode $function) $arguments = $function->getArguments(); foreach ($arguments as $token) { if (!($token->isString() || $token->isIdentifier())) { - throw new ExpressionErrorException( - 'Expected a single string or identifier for :lang(), got ' - .implode(', ', $arguments) - ); + throw new ExpressionErrorException('Expected a single string or identifier for :lang(), got '.implode(', ', $arguments)); } } diff --git a/vendor/symfony/css-selector/XPath/Translator.php b/vendor/symfony/css-selector/XPath/Translator.php index d20ad7dc3..f8585a057 100644 --- a/vendor/symfony/css-selector/XPath/Translator.php +++ b/vendor/symfony/css-selector/XPath/Translator.php @@ -89,7 +89,7 @@ public static function getXpathLiteral($element) } } - return sprintf('concat(%s)', implode($parts, ', ')); + return sprintf('concat(%s)', implode(', ', $parts)); } /** @@ -176,7 +176,7 @@ public function nodeToXPath(NodeInterface $node) throw new ExpressionErrorException(sprintf('Node "%s" not supported.', $node->getNodeName())); } - return call_user_func($this->nodeTranslators[$node->getNodeName()], $node, $this); + return \call_user_func($this->nodeTranslators[$node->getNodeName()], $node, $this); } /** @@ -194,7 +194,7 @@ public function addCombination($combiner, NodeInterface $xpath, NodeInterface $c throw new ExpressionErrorException(sprintf('Combiner "%s" not supported.', $combiner)); } - return call_user_func($this->combinationTranslators[$combiner], $this->nodeToXPath($xpath), $this->nodeToXPath($combinedXpath)); + return \call_user_func($this->combinationTranslators[$combiner], $this->nodeToXPath($xpath), $this->nodeToXPath($combinedXpath)); } /** @@ -208,7 +208,7 @@ public function addFunction(XPathExpr $xpath, FunctionNode $function) throw new ExpressionErrorException(sprintf('Function "%s" not supported.', $function->getName())); } - return call_user_func($this->functionTranslators[$function->getName()], $xpath, $function); + return \call_user_func($this->functionTranslators[$function->getName()], $xpath, $function); } /** @@ -225,7 +225,7 @@ public function addPseudoClass(XPathExpr $xpath, $pseudoClass) throw new ExpressionErrorException(sprintf('Pseudo-class "%s" not supported.', $pseudoClass)); } - return call_user_func($this->pseudoClassTranslators[$pseudoClass], $xpath); + return \call_user_func($this->pseudoClassTranslators[$pseudoClass], $xpath); } /** @@ -244,7 +244,7 @@ public function addAttributeMatching(XPathExpr $xpath, $operator, $attribute, $v throw new ExpressionErrorException(sprintf('Attribute matcher operator "%s" not supported.', $operator)); } - return call_user_func($this->attributeMatchingTranslators[$operator], $xpath, $attribute, $value); + return \call_user_func($this->attributeMatchingTranslators[$operator], $xpath, $attribute, $value); } /** diff --git a/vendor/symfony/css-selector/XPath/XPathExpr.php b/vendor/symfony/css-selector/XPath/XPathExpr.php index 63e3ac36b..a1e244c9e 100644 --- a/vendor/symfony/css-selector/XPath/XPathExpr.php +++ b/vendor/symfony/css-selector/XPath/XPathExpr.php @@ -53,8 +53,6 @@ public function getElement() } /** - * @param $condition - * * @return $this */ public function addCondition($condition) diff --git a/vendor/symfony/css-selector/phpunit.xml.dist b/vendor/symfony/css-selector/phpunit.xml.dist index 65ff1827a..a8e537ef7 100644 --- a/vendor/symfony/css-selector/phpunit.xml.dist +++ b/vendor/symfony/css-selector/phpunit.xml.dist @@ -1,7 +1,7 @@ classLoader = $classLoader; - $this->isFinder = is_array($classLoader) && method_exists($classLoader[0], 'findFile'); + $this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile'); if (!isset(self::$caseCheck)) { - $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), DIRECTORY_SEPARATOR); - $i = strrpos($file, DIRECTORY_SEPARATOR); + $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR); + $i = strrpos($file, \DIRECTORY_SEPARATOR); $dir = substr($file, 0, 1 + $i); $file = substr($file, 1 + $i); $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file); @@ -53,7 +53,7 @@ public function __construct(callable $classLoader) if (false === $test || false === $i) { // filesystem is case sensitive self::$caseCheck = 0; - } elseif (substr($test, -strlen($file)) === $file) { + } elseif (substr($test, -\strlen($file)) === $file) { // filesystem is case insensitive and realpath() normalizes the case of characters self::$caseCheck = 1; } elseif (false !== stripos(PHP_OS, 'darwin')) { @@ -85,7 +85,7 @@ public static function enable() class_exists('Symfony\Component\Debug\ErrorHandler'); class_exists('Psr\Log\LogLevel'); - if (!is_array($functions = spl_autoload_functions())) { + if (!\is_array($functions = spl_autoload_functions())) { return; } @@ -94,7 +94,7 @@ class_exists('Psr\Log\LogLevel'); } foreach ($functions as $function) { - if (!is_array($function) || !$function[0] instanceof self) { + if (!\is_array($function) || !$function[0] instanceof self) { $function = array(new static($function), 'loadClass'); } @@ -107,7 +107,7 @@ class_exists('Psr\Log\LogLevel'); */ public static function disable() { - if (!is_array($functions = spl_autoload_functions())) { + if (!\is_array($functions = spl_autoload_functions())) { return; } @@ -116,7 +116,7 @@ public static function disable() } foreach ($functions as $function) { - if (is_array($function) && $function[0] instanceof self) { + if (\is_array($function) && $function[0] instanceof self) { $function = $function[0]->getClassLoader(); } @@ -129,8 +129,6 @@ public static function disable() * * @param string $class The name of the class * - * @return bool|null True, if loaded - * * @throws \RuntimeException */ public function loadClass($class) @@ -150,7 +148,7 @@ public function loadClass($class) } } } else { - call_user_func($this->classLoader, $class); + \call_user_func($this->classLoader, $class); $file = false; } } finally { @@ -184,200 +182,227 @@ private function checkClass($class, $file = null) throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: "%s" vs "%s".', $class, $name)); } - // Don't trigger deprecations for classes in the same vendor - if (2 > $len = 1 + (\strpos($name, '\\') ?: \strpos($name, '_'))) { - $len = 0; - $ns = ''; - } else { - $ns = \substr($name, 0, $len); + $deprecations = $this->checkAnnotations($refl, $name); + + if (isset(self::$php7Reserved[\strtolower($refl->getShortName())])) { + $deprecations[] = sprintf('The "%s" class uses the reserved name "%s", it will break on PHP 7 and higher', $name, $refl->getShortName()); } - // Detect annotations on the class - if (false !== $doc = $refl->getDocComment()) { - foreach (array('final', 'deprecated', 'internal') as $annotation) { - if (false !== \strpos($doc, $annotation) && preg_match('#\n \* @'.$annotation.'(?:( .+?)\.?)?\r?\n \*(?: @|/$)#s', $doc, $notice)) { - self::${$annotation}[$name] = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; - } - } + foreach ($deprecations as $message) { + @trigger_error($message, E_USER_DEPRECATED); } + } - $parentAndTraits = \class_uses($name, false); - if ($parent = \get_parent_class($class)) { - $parentAndTraits[] = $parent; + if (!$file) { + return; + } - if (!isset(self::$checkedClasses[$parent])) { - $this->checkClass($parent); - } + if (!$exists) { + if (false !== strpos($class, '/')) { + throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class)); + } + + throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file)); + } + + if (self::$caseCheck && $message = $this->checkCase($refl, $file, $class)) { + throw new \RuntimeException(sprintf('Case mismatch between class and real file names: "%s" vs "%s" in "%s".', $message[0], $message[1], $message[2])); + } + } - if (isset(self::$final[$parent])) { - @trigger_error(sprintf('The "%s" class is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $parent, self::$final[$parent], $name), E_USER_DEPRECATED); + public function checkAnnotations(\ReflectionClass $refl, $class) + { + $deprecations = array(); + + // Don't trigger deprecations for classes in the same vendor + if (2 > $len = 1 + (\strpos($class, '\\') ?: \strpos($class, '_'))) { + $len = 0; + $ns = ''; + } else { + $ns = \substr($class, 0, $len); + } + + // Detect annotations on the class + if (false !== $doc = $refl->getDocComment()) { + foreach (array('final', 'deprecated', 'internal') as $annotation) { + if (false !== \strpos($doc, $annotation) && preg_match('#\n \* @'.$annotation.'(?:( .+?)\.?)?\r?\n \*(?: @|/$)#s', $doc, $notice)) { + self::${$annotation}[$class] = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; } } + } - // Detect if the parent is annotated - foreach ($parentAndTraits + $this->getOwnInterfaces($name, $parent) as $use) { - if (!isset(self::$checkedClasses[$use])) { - $this->checkClass($use); - } - if (isset(self::$deprecated[$use]) && \strncmp($ns, $use, $len)) { - $type = class_exists($name, false) ? 'class' : (interface_exists($name, false) ? 'interface' : 'trait'); - $verb = class_exists($use, false) || interface_exists($name, false) ? 'extends' : (interface_exists($use, false) ? 'implements' : 'uses'); + $parent = \get_parent_class($class); + $parentAndOwnInterfaces = $this->getOwnInterfaces($class, $parent); + if ($parent) { + $parentAndOwnInterfaces[$parent] = $parent; - @trigger_error(sprintf('The "%s" %s %s "%s" that is deprecated%s.', $name, $type, $verb, $use, self::$deprecated[$use]), E_USER_DEPRECATED); - } - if (isset(self::$internal[$use]) && \strncmp($ns, $use, $len)) { - @trigger_error(sprintf('The "%s" %s is considered internal%s. It may change without further notice. You should not use it from "%s".', $use, class_exists($use, false) ? 'class' : (interface_exists($use, false) ? 'interface' : 'trait'), self::$internal[$use], $name), E_USER_DEPRECATED); - } + if (!isset(self::$checkedClasses[$parent])) { + $this->checkClass($parent); } - // Inherit @final and @internal annotations for methods - self::$finalMethods[$name] = array(); - self::$internalMethods[$name] = array(); - foreach ($parentAndTraits as $use) { - foreach (array('finalMethods', 'internalMethods') as $property) { - if (isset(self::${$property}[$use])) { - self::${$property}[$name] = self::${$property}[$name] ? self::${$property}[$use] + self::${$property}[$name] : self::${$property}[$use]; - } - } + if (isset(self::$final[$parent])) { + $deprecations[] = sprintf('The "%s" class is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $parent, self::$final[$parent], $class); } + } - $isClass = \class_exists($name, false); - foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $method) { - if ($method->class !== $name) { - continue; - } + // Detect if the parent is annotated + foreach ($parentAndOwnInterfaces + \class_uses($class, false) as $use) { + if (!isset(self::$checkedClasses[$use])) { + $this->checkClass($use); + } + if (isset(self::$deprecated[$use]) && \strncmp($ns, $use, $len)) { + $type = class_exists($class, false) ? 'class' : (interface_exists($class, false) ? 'interface' : 'trait'); + $verb = class_exists($use, false) || interface_exists($class, false) ? 'extends' : (interface_exists($use, false) ? 'implements' : 'uses'); - // Method from a trait - if ($method->getFilename() !== $refl->getFileName()) { - continue; - } + $deprecations[] = sprintf('The "%s" %s %s "%s" that is deprecated%s.', $class, $type, $verb, $use, self::$deprecated[$use]); + } + if (isset(self::$internal[$use]) && \strncmp($ns, $use, $len)) { + $deprecations[] = sprintf('The "%s" %s is considered internal%s. It may change without further notice. You should not use it from "%s".', $use, class_exists($use, false) ? 'class' : (interface_exists($use, false) ? 'interface' : 'trait'), self::$internal[$use], $class); + } + } - if ($isClass && $parent && isset(self::$finalMethods[$parent][$method->name])) { - list($declaringClass, $message) = self::$finalMethods[$parent][$method->name]; - @trigger_error(sprintf('The "%s::%s()" method is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $declaringClass, $method->name, $message, $name), E_USER_DEPRECATED); - } + if (\trait_exists($class)) { + return $deprecations; + } - foreach ($parentAndTraits as $use) { - if (isset(self::$internalMethods[$use][$method->name])) { - list($declaringClass, $message) = self::$internalMethods[$use][$method->name]; - if (\strncmp($ns, $declaringClass, $len)) { - @trigger_error(sprintf('The "%s::%s()" method is considered internal%s. It may change without further notice. You should not extend it from "%s".', $declaringClass, $method->name, $message, $name), E_USER_DEPRECATED); - } - } + // Inherit @final and @internal annotations for methods + self::$finalMethods[$class] = array(); + self::$internalMethods[$class] = array(); + foreach ($parentAndOwnInterfaces as $use) { + foreach (array('finalMethods', 'internalMethods') as $property) { + if (isset(self::${$property}[$use])) { + self::${$property}[$class] = self::${$property}[$class] ? self::${$property}[$use] + self::${$property}[$class] : self::${$property}[$use]; } + } + } - // Detect method annotations - if (false === $doc = $method->getDocComment()) { - continue; - } + foreach ($refl->getMethods(\ReflectionMethod::IS_PUBLIC | \ReflectionMethod::IS_PROTECTED) as $method) { + if ($method->class !== $class) { + continue; + } - foreach (array('final', 'internal') as $annotation) { - if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) { - $message = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; - self::${$annotation.'Methods'}[$name][$method->name] = array($name, $message); - } + if ($parent && isset(self::$finalMethods[$parent][$method->name])) { + list($declaringClass, $message) = self::$finalMethods[$parent][$method->name]; + $deprecations[] = sprintf('The "%s::%s()" method is considered final%s. It may change without further notice as of its next major version. You should not extend it from "%s".', $declaringClass, $method->name, $message, $class); + } + + if (isset(self::$internalMethods[$class][$method->name])) { + list($declaringClass, $message) = self::$internalMethods[$class][$method->name]; + if (\strncmp($ns, $declaringClass, $len)) { + $deprecations[] = sprintf('The "%s::%s()" method is considered internal%s. It may change without further notice. You should not extend it from "%s".', $declaringClass, $method->name, $message, $class); } } - if (isset(self::$php7Reserved[\strtolower($refl->getShortName())])) { - @trigger_error(sprintf('The "%s" class uses the reserved name "%s", it will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED); + // Detect method annotations + if (false === $doc = $method->getDocComment()) { + continue; } - } - if ($file) { - if (!$exists) { - if (false !== strpos($class, '/')) { - throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class)); + foreach (array('final', 'internal') as $annotation) { + if (false !== \strpos($doc, $annotation) && preg_match('#\n\s+\* @'.$annotation.'(?:( .+?)\.?)?\r?\n\s+\*(?: @|/$)#s', $doc, $notice)) { + $message = isset($notice[1]) ? preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]) : ''; + self::${$annotation.'Methods'}[$class][$method->name] = array($class, $message); } - - throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file)); } - if (self::$caseCheck) { - $real = explode('\\', $class.strrchr($file, '.')); - $tail = explode(DIRECTORY_SEPARATOR, str_replace('/', DIRECTORY_SEPARATOR, $file)); + } - $i = count($tail) - 1; - $j = count($real) - 1; + return $deprecations; + } - while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) { - --$i; - --$j; - } + public function checkCase(\ReflectionClass $refl, $file, $class) + { + $real = explode('\\', $class.strrchr($file, '.')); + $tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file)); - array_splice($tail, 0, $i + 1); - } - if (self::$caseCheck && $tail) { - $tail = DIRECTORY_SEPARATOR.implode(DIRECTORY_SEPARATOR, $tail); - $tailLen = strlen($tail); - $real = $refl->getFileName(); - - if (2 === self::$caseCheck) { - // realpath() on MacOSX doesn't normalize the case of characters - - $i = 1 + strrpos($real, '/'); - $file = substr($real, $i); - $real = substr($real, 0, $i); - - if (isset(self::$darwinCache[$real])) { - $kDir = $real; - } else { - $kDir = strtolower($real); - - if (isset(self::$darwinCache[$kDir])) { - $real = self::$darwinCache[$kDir][0]; - } else { - $dir = getcwd(); - chdir($real); - $real = getcwd().'/'; - chdir($dir); - - $dir = $real; - $k = $kDir; - $i = strlen($dir) - 1; - while (!isset(self::$darwinCache[$k])) { - self::$darwinCache[$k] = array($dir, array()); - self::$darwinCache[$dir] = &self::$darwinCache[$k]; - - while ('/' !== $dir[--$i]) { - } - $k = substr($k, 0, ++$i); - $dir = substr($dir, 0, $i--); - } - } - } + $i = \count($tail) - 1; + $j = \count($real) - 1; - $dirFiles = self::$darwinCache[$kDir][1]; - - if (isset($dirFiles[$file])) { - $kFile = $file; - } else { - $kFile = strtolower($file); - - if (!isset($dirFiles[$kFile])) { - foreach (scandir($real, 2) as $f) { - if ('.' !== $f[0]) { - $dirFiles[$f] = $f; - if ($f === $file) { - $kFile = $k = $file; - } elseif ($f !== $k = strtolower($f)) { - $dirFiles[$k] = $f; - } - } - } - self::$darwinCache[$kDir][1] = $dirFiles; - } - } + while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) { + --$i; + --$j; + } + + array_splice($tail, 0, $i + 1); - $real .= $dirFiles[$kFile]; + if (!$tail) { + return; + } + + $tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail); + $tailLen = \strlen($tail); + $real = $refl->getFileName(); + + if (2 === self::$caseCheck) { + $real = $this->darwinRealpath($real); + } + + if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true) + && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false) + ) { + return array(substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)); + } + } + + /** + * `realpath` on MacOSX doesn't normalize the case of characters. + */ + private function darwinRealpath($real) + { + $i = 1 + strrpos($real, '/'); + $file = substr($real, $i); + $real = substr($real, 0, $i); + + if (isset(self::$darwinCache[$real])) { + $kDir = $real; + } else { + $kDir = strtolower($real); + + if (isset(self::$darwinCache[$kDir])) { + $real = self::$darwinCache[$kDir][0]; + } else { + $dir = getcwd(); + chdir($real); + $real = getcwd().'/'; + chdir($dir); + + $dir = $real; + $k = $kDir; + $i = \strlen($dir) - 1; + while (!isset(self::$darwinCache[$k])) { + self::$darwinCache[$k] = array($dir, array()); + self::$darwinCache[$dir] = &self::$darwinCache[$k]; + + while ('/' !== $dir[--$i]) { + } + $k = substr($k, 0, ++$i); + $dir = substr($dir, 0, $i--); } + } + } - if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true) - && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false) - ) { - throw new \RuntimeException(sprintf('Case mismatch between class and real file names: "%s" vs "%s" in "%s".', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1))); + $dirFiles = self::$darwinCache[$kDir][1]; + + if (isset($dirFiles[$file])) { + return $real .= $dirFiles[$file]; + } + + $kFile = strtolower($file); + + if (!isset($dirFiles[$kFile])) { + foreach (scandir($real, 2) as $f) { + if ('.' !== $f[0]) { + $dirFiles[$f] = $f; + if ($f === $file) { + $kFile = $k = $file; + } elseif ($f !== $k = strtolower($f)) { + $dirFiles[$k] = $f; + } } } + self::$darwinCache[$kDir][1] = $dirFiles; } + + return $real .= $dirFiles[$kFile]; } /** diff --git a/vendor/symfony/debug/ErrorHandler.php b/vendor/symfony/debug/ErrorHandler.php index 9f886a6d5..69a728041 100644 --- a/vendor/symfony/debug/ErrorHandler.php +++ b/vendor/symfony/debug/ErrorHandler.php @@ -11,17 +11,17 @@ namespace Symfony\Component\Debug; -use Psr\Log\LogLevel; use Psr\Log\LoggerInterface; +use Psr\Log\LogLevel; use Symfony\Component\Debug\Exception\ContextErrorException; use Symfony\Component\Debug\Exception\FatalErrorException; use Symfony\Component\Debug\Exception\FatalThrowableError; use Symfony\Component\Debug\Exception\OutOfMemoryException; use Symfony\Component\Debug\Exception\SilencedErrorContext; -use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler; -use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler; use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler; use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface; +use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler; +use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler; /** * A generic ErrorHandler for the PHP engine. @@ -130,17 +130,17 @@ public static function register(self $handler = null, $replace = true) $handler->isRoot = true; } - if ($handlerIsNew && is_array($prev) && $prev[0] instanceof self) { + if ($handlerIsNew && \is_array($prev) && $prev[0] instanceof self) { $handler = $prev[0]; $replace = false; } if (!$replace && $prev) { restore_error_handler(); - $handlerIsRegistered = is_array($prev) && $handler === $prev[0]; + $handlerIsRegistered = \is_array($prev) && $handler === $prev[0]; } else { $handlerIsRegistered = true; } - if (is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) { + if (\is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) { restore_exception_handler(); if (!$handlerIsRegistered) { $handler = $prev[0]; @@ -180,7 +180,7 @@ public function setDefaultLogger(LoggerInterface $logger, $levels = E_ALL, $repl { $loggers = array(); - if (is_array($levels)) { + if (\is_array($levels)) { foreach ($levels as $type => $logLevel) { if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) { $loggers[$type] = array($logger, $logLevel); @@ -220,7 +220,7 @@ public function setLoggers(array $loggers) if (!isset($prev[$type])) { throw new \InvalidArgumentException('Unknown error type: '.$type); } - if (!is_array($log)) { + if (!\is_array($log)) { $log = array($log); } elseif (!array_key_exists(0, $log)) { throw new \InvalidArgumentException('No logger provided'); @@ -353,7 +353,7 @@ private function reRegister($prev) { if ($prev !== $this->thrownErrors | $this->loggedErrors) { $handler = set_error_handler('var_dump'); - $handler = is_array($handler) ? $handler[0] : null; + $handler = \is_array($handler) ? $handler[0] : null; restore_error_handler(); if ($handler === $this) { restore_error_handler(); @@ -383,18 +383,20 @@ private function reRegister($prev) public function handleError($type, $message, $file, $line) { // Level is the current error reporting level to manage silent error. + $level = error_reporting(); + $silenced = 0 === ($level & $type); // Strong errors are not authorized to be silenced. - $level = error_reporting() | E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED; + $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED; $log = $this->loggedErrors & $type; $throw = $this->thrownErrors & $type & $level; $type &= $level | $this->screamedErrors; if (!$type || (!$log && !$throw)) { - return $type && $log; + return !$silenced && $type && $log; } $scope = $this->scopedErrors & $type; - if (4 < $numArgs = func_num_args()) { + if (4 < $numArgs = \func_num_args()) { $context = $scope ? (func_get_arg(4) ?: array()) : array(); $backtrace = 5 < $numArgs ? func_get_arg(5) : null; // defined on HHVM } else { @@ -524,7 +526,7 @@ public function handleError($type, $message, $file, $line) } } - return $type && $log; + return !$silenced && $type && $log; } /** @@ -614,7 +616,7 @@ public static function handleFatalError(array $error = null) $previousHandler = null; $sameHandlerLimit = 10; - while (!is_array($handler) || !$handler[0] instanceof self) { + while (!\is_array($handler) || !$handler[0] instanceof self) { $handler = set_exception_handler('var_dump'); restore_exception_handler(); @@ -755,7 +757,7 @@ private function cleanTrace($backtrace, $type, $file, $line, $throw) for ($i = 0; isset($backtrace[$i]); ++$i) { if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) { - $lightTrace = array_slice($lightTrace, 1 + $i); + $lightTrace = \array_slice($lightTrace, 1 + $i); break; } } diff --git a/vendor/symfony/debug/Exception/ClassNotFoundException.php b/vendor/symfony/debug/Exception/ClassNotFoundException.php index b91bf4663..de5c45644 100644 --- a/vendor/symfony/debug/Exception/ClassNotFoundException.php +++ b/vendor/symfony/debug/Exception/ClassNotFoundException.php @@ -26,6 +26,9 @@ public function __construct($message, \ErrorException $previous) $previous->getSeverity(), $previous->getFile(), $previous->getLine(), + null, + true, + null, $previous->getPrevious() ); $this->setTrace($previous->getTrace()); diff --git a/vendor/symfony/debug/Exception/FatalErrorException.php b/vendor/symfony/debug/Exception/FatalErrorException.php index f24a54e77..8d996a422 100644 --- a/vendor/symfony/debug/Exception/FatalErrorException.php +++ b/vendor/symfony/debug/Exception/FatalErrorException.php @@ -18,9 +18,9 @@ */ class FatalErrorException extends \ErrorException { - public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null) + public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null) { - parent::__construct($message, $code, $severity, $filename, $lineno); + parent::__construct($message, $code, $severity, $filename, $lineno, $previous); if (null !== $trace) { if (!$traceArgs) { @@ -31,7 +31,7 @@ public function __construct($message, $code, $severity, $filename, $lineno, $tra $this->setTrace($trace); } elseif (null !== $traceOffset) { - if (function_exists('xdebug_get_function_stack')) { + if (\function_exists('xdebug_get_function_stack')) { $trace = xdebug_get_function_stack(); if (0 < $traceOffset) { array_splice($trace, -$traceOffset); @@ -60,7 +60,7 @@ public function __construct($message, $code, $severity, $filename, $lineno, $tra unset($frame); $trace = array_reverse($trace); - } elseif (function_exists('symfony_debug_backtrace')) { + } elseif (\function_exists('symfony_debug_backtrace')) { $trace = symfony_debug_backtrace(); if (0 < $traceOffset) { array_splice($trace, 0, $traceOffset); diff --git a/vendor/symfony/debug/Exception/FlattenException.php b/vendor/symfony/debug/Exception/FlattenException.php index 24679dcaa..f76cf23f3 100644 --- a/vendor/symfony/debug/Exception/FlattenException.php +++ b/vendor/symfony/debug/Exception/FlattenException.php @@ -53,7 +53,7 @@ public static function create(\Exception $exception, $statusCode = null, array $ $e->setStatusCode($statusCode); $e->setHeaders($headers); $e->setTraceFromException($exception); - $e->setClass(get_class($exception)); + $e->setClass(\get_class($exception)); $e->setFile($exception->getFile()); $e->setLine($exception->getLine()); @@ -157,7 +157,7 @@ public function getPrevious() return $this->previous; } - public function setPrevious(FlattenException $previous) + public function setPrevious(self $previous) { $this->previous = $previous; } @@ -228,9 +228,9 @@ private function flattenArgs($args, $level = 0, &$count = 0) if ($value instanceof \__PHP_Incomplete_Class) { // is_object() returns false on PHP<=7.1 $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value)); - } elseif (is_object($value)) { - $result[$key] = array('object', get_class($value)); - } elseif (is_array($value)) { + } elseif (\is_object($value)) { + $result[$key] = array('object', \get_class($value)); + } elseif (\is_array($value)) { if ($level > 10) { $result[$key] = array('array', '*DEEP NESTED ARRAY*'); } else { @@ -238,13 +238,13 @@ private function flattenArgs($args, $level = 0, &$count = 0) } } elseif (null === $value) { $result[$key] = array('null', null); - } elseif (is_bool($value)) { + } elseif (\is_bool($value)) { $result[$key] = array('boolean', $value); - } elseif (is_int($value)) { + } elseif (\is_int($value)) { $result[$key] = array('integer', $value); - } elseif (is_float($value)) { + } elseif (\is_float($value)) { $result[$key] = array('float', $value); - } elseif (is_resource($value)) { + } elseif (\is_resource($value)) { $result[$key] = array('resource', get_resource_type($value)); } else { $result[$key] = array('string', (string) $value); diff --git a/vendor/symfony/debug/Exception/UndefinedFunctionException.php b/vendor/symfony/debug/Exception/UndefinedFunctionException.php index a66ae2a38..8f5f454e5 100644 --- a/vendor/symfony/debug/Exception/UndefinedFunctionException.php +++ b/vendor/symfony/debug/Exception/UndefinedFunctionException.php @@ -26,6 +26,9 @@ public function __construct($message, \ErrorException $previous) $previous->getSeverity(), $previous->getFile(), $previous->getLine(), + null, + true, + null, $previous->getPrevious() ); $this->setTrace($previous->getTrace()); diff --git a/vendor/symfony/debug/Exception/UndefinedMethodException.php b/vendor/symfony/debug/Exception/UndefinedMethodException.php index 350dc3187..f7e340baf 100644 --- a/vendor/symfony/debug/Exception/UndefinedMethodException.php +++ b/vendor/symfony/debug/Exception/UndefinedMethodException.php @@ -26,6 +26,9 @@ public function __construct($message, \ErrorException $previous) $previous->getSeverity(), $previous->getFile(), $previous->getLine(), + null, + true, + null, $previous->getPrevious() ); $this->setTrace($previous->getTrace()); diff --git a/vendor/symfony/debug/ExceptionHandler.php b/vendor/symfony/debug/ExceptionHandler.php index f22b70f6e..f18ee2a9f 100644 --- a/vendor/symfony/debug/ExceptionHandler.php +++ b/vendor/symfony/debug/ExceptionHandler.php @@ -57,7 +57,7 @@ public static function register($debug = true, $charset = null, $fileLinkFormat $handler = new static($debug, $charset, $fileLinkFormat); $prev = set_exception_handler(array($handler, 'handle')); - if (is_array($prev) && $prev[0] instanceof ErrorHandler) { + if (\is_array($prev) && $prev[0] instanceof ErrorHandler) { restore_exception_handler(); $prev[0]->setExceptionHandler(array($handler, 'handle')); } @@ -142,7 +142,7 @@ public function handle(\Exception $exception) $this->caughtBuffer = null; try { - call_user_func($this->handler, $exception); + \call_user_func($this->handler, $exception); $this->caughtLength = $caughtLength; } catch (\Exception $e) { if (!$caughtLength) { @@ -208,48 +208,54 @@ public function getContent(FlattenException $exception) $title = 'Whoops, looks like something went wrong.'; } + if (!$this->debug) { + return << +

$title

+ +EOF; + } + $content = ''; - if ($this->debug) { - try { - $count = count($exception->getAllPrevious()); - $total = $count + 1; - foreach ($exception->toArray() as $position => $e) { - $ind = $count - $position + 1; - $class = $this->formatClass($e['class']); - $message = nl2br($this->escapeHtml($e['message'])); - $content .= sprintf(<<<'EOF' -
-
- - + try { + $count = \count($exception->getAllPrevious()); + $total = $count + 1; + foreach ($exception->toArray() as $position => $e) { + $ind = $count - $position + 1; + $class = $this->formatClass($e['class']); + $message = nl2br($this->escapeHtml($e['message'])); + $content .= sprintf(<<<'EOF' +
+
-

- (%d/%d) - %s -

-

%s

-
+ + EOF - , $ind, $total, $class, $message); - foreach ($e['trace'] as $trace) { - $content .= '\n"; + , $ind, $total, $class, $message); + foreach ($e['trace'] as $trace) { + $content .= '\n
+

+ (%d/%d) + %s +

+

%s

+
'; - if ($trace['function']) { - $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args'])); - } - if (isset($trace['file']) && isset($trace['line'])) { - $content .= $this->formatPath($trace['file'], $trace['line']); - } - $content .= "
'; + if ($trace['function']) { + $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args'])); } - - $content .= "
\n\n"; - } - } catch (\Exception $e) { - // something nasty happened and we cannot throw an exception anymore - if ($this->debug) { - $title = sprintf('Exception thrown when handling an exception (%s: %s)', get_class($e), $this->escapeHtml($e->getMessage())); - } else { - $title = 'Whoops, looks like something went wrong.'; + if (isset($trace['file']) && isset($trace['line'])) { + $content .= $this->formatPath($trace['file'], $trace['line']); + } + $content .= "\n"; } + + $content .= "\n\n\n"; + } + } catch (\Exception $e) { + // something nasty happened and we cannot throw an exception anymore + if ($this->debug) { + $title = sprintf('Exception thrown when handling an exception (%s: %s)', \get_class($e), $this->escapeHtml($e->getMessage())); + } else { + $title = 'Whoops, looks like something went wrong.'; } } @@ -278,6 +284,14 @@ public function getContent(FlattenException $exception) */ public function getStylesheet(FlattenException $exception) { + if (!$this->debug) { + return <<<'EOF' + body { background-color: #fff; color: #222; font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; margin: 0; } + .container { margin: 30px; max-width: 600px; } + h1 { color: #dc3545; font-size: 24px; } +EOF; + } + return <<<'EOF' body { background-color: #F9F9F9; color: #222; font: 14px/1.4 Helvetica, Arial, sans-serif; margin: 0; padding-bottom: 45px; } @@ -362,12 +376,12 @@ private function formatPath($path, $line) } if (\is_string($fmt)) { - $i = strpos($f = $fmt, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: strlen($f); + $i = strpos($f = $fmt, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: \strlen($f); $fmt = array(substr($f, 0, $i)) + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); for ($i = 1; isset($fmt[$i]); ++$i) { if (0 === strpos($path, $k = $fmt[$i++])) { - $path = substr_replace($path, $fmt[$i], 0, strlen($k)); + $path = substr_replace($path, $fmt[$i], 0, \strlen($k)); break; } } @@ -394,7 +408,7 @@ private function formatArgs(array $args) if ('object' === $item[0]) { $formattedValue = sprintf('object(%s)', $this->formatClass($item[1])); } elseif ('array' === $item[0]) { - $formattedValue = sprintf('array(%s)', is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); + $formattedValue = sprintf('array(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]); } elseif ('null' === $item[0]) { $formattedValue = 'null'; } elseif ('boolean' === $item[0]) { @@ -405,7 +419,7 @@ private function formatArgs(array $args) $formattedValue = str_replace("\n", '', $this->escapeHtml(var_export($item[1], true))); } - $result[] = is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue); + $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue); } return implode(', ', $result); diff --git a/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php index 32ba9a09c..2b59c1469 100644 --- a/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php +++ b/vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.php @@ -11,11 +11,11 @@ namespace Symfony\Component\Debug\FatalErrorHandler; -use Symfony\Component\Debug\Exception\ClassNotFoundException; -use Symfony\Component\Debug\Exception\FatalErrorException; -use Symfony\Component\Debug\DebugClassLoader; use Composer\Autoload\ClassLoader as ComposerClassLoader; use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader; +use Symfony\Component\Debug\DebugClassLoader; +use Symfony\Component\Debug\Exception\ClassNotFoundException; +use Symfony\Component\Debug\Exception\FatalErrorException; /** * ErrorHandler for classes that do not exist. @@ -29,9 +29,9 @@ class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface */ public function handleError(array $error, FatalErrorException $exception) { - $messageLen = strlen($error['message']); + $messageLen = \strlen($error['message']); $notFoundSuffix = '\' not found'; - $notFoundSuffixLen = strlen($notFoundSuffix); + $notFoundSuffixLen = \strlen($notFoundSuffix); if ($notFoundSuffixLen > $messageLen) { return; } @@ -42,7 +42,7 @@ public function handleError(array $error, FatalErrorException $exception) foreach (array('class', 'interface', 'trait') as $typeName) { $prefix = ucfirst($typeName).' \''; - $prefixLen = strlen($prefix); + $prefixLen = \strlen($prefix); if (0 !== strpos($error['message'], $prefix)) { continue; } @@ -85,7 +85,7 @@ public function handleError(array $error, FatalErrorException $exception) */ private function getClassCandidates($class) { - if (!is_array($functions = spl_autoload_functions())) { + if (!\is_array($functions = spl_autoload_functions())) { return array(); } @@ -93,14 +93,14 @@ private function getClassCandidates($class) $classes = array(); foreach ($functions as $function) { - if (!is_array($function)) { + if (!\is_array($function)) { continue; } // get class loaders wrapped by DebugClassLoader if ($function[0] instanceof DebugClassLoader) { $function = $function[0]->getClassLoader(); - if (!is_array($function)) { + if (!\is_array($function)) { continue; } } @@ -133,7 +133,7 @@ private function getClassCandidates($class) */ private function findClassInPath($path, $class, $prefix) { - if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) { + if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) { return array(); } @@ -159,7 +159,7 @@ private function convertFileToClass($path, $file, $prefix) { $candidates = array( // namespaced class - $namespacedClass = str_replace(array($path.DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file), + $namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file), // namespaced class (with target dir) $prefix.$namespacedClass, // namespaced class (with target dir and separator) diff --git a/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php index c6f391a79..db2418037 100644 --- a/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php +++ b/vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Debug\FatalErrorHandler; -use Symfony\Component\Debug\Exception\UndefinedFunctionException; use Symfony\Component\Debug\Exception\FatalErrorException; +use Symfony\Component\Debug\Exception\UndefinedFunctionException; /** * ErrorHandler for undefined functions. @@ -26,9 +26,9 @@ class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface */ public function handleError(array $error, FatalErrorException $exception) { - $messageLen = strlen($error['message']); + $messageLen = \strlen($error['message']); $notFoundSuffix = '()'; - $notFoundSuffixLen = strlen($notFoundSuffix); + $notFoundSuffixLen = \strlen($notFoundSuffix); if ($notFoundSuffixLen > $messageLen) { return; } @@ -38,7 +38,7 @@ public function handleError(array $error, FatalErrorException $exception) } $prefix = 'Call to undefined function '; - $prefixLen = strlen($prefix); + $prefixLen = \strlen($prefix); if (0 !== strpos($error['message'], $prefix)) { return; } diff --git a/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php b/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php index 6fa62b6f2..618a2c208 100644 --- a/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php +++ b/vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php @@ -44,7 +44,7 @@ public function handleError(array $error, FatalErrorException $exception) $candidates = array(); foreach ($methods as $definedMethodName) { $lev = levenshtein($methodName, $definedMethodName); - if ($lev <= strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) { + if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) { $candidates[] = $definedMethodName; } } diff --git a/vendor/symfony/debug/Resources/ext/tests/003.phpt b/vendor/symfony/debug/Resources/ext/tests/003.phpt index ce3c4e0ab..4e7645031 100644 --- a/vendor/symfony/debug/Resources/ext/tests/003.phpt +++ b/vendor/symfony/debug/Resources/ext/tests/003.phpt @@ -45,7 +45,7 @@ function foo() $handler = ErrorHandler::register(); $handler->setExceptionHandler('print_r'); -if (function_exists('xdebug_disable')) { +if (\function_exists('xdebug_disable')) { xdebug_disable(); } diff --git a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php b/vendor/symfony/debug/Tests/DebugClassLoaderTest.php index 0219f5335..e9ce535ee 100644 --- a/vendor/symfony/debug/Tests/DebugClassLoaderTest.php +++ b/vendor/symfony/debug/Tests/DebugClassLoaderTest.php @@ -312,24 +312,21 @@ class_exists('Test\\'.__NAMESPACE__.'\\ExtendsFinalClass', true); public function testExtendedFinalMethod() { - set_error_handler(function () { return false; }); - $e = error_reporting(0); - trigger_error('', E_USER_NOTICE); + $deprecations = array(); + set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); + $e = error_reporting(E_USER_DEPRECATED); class_exists(__NAMESPACE__.'\\Fixtures\\ExtendedFinalMethod', true); error_reporting($e); restore_error_handler(); - $lastError = error_get_last(); - unset($lastError['file'], $lastError['line']); - $xError = array( - 'type' => E_USER_DEPRECATED, - 'message' => 'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".', + 'The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod2()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod".', ); - $this->assertSame($xError, $lastError); + $this->assertSame($xError, $deprecations); } public function testExtendedDeprecatedMethodDoesntTriggerAnyNotice() @@ -361,12 +358,26 @@ class_exists('Test\\'.__NAMESPACE__.'\\ExtendsInternals', true); restore_error_handler(); $this->assertSame($deprecations, array( - 'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass" class is considered internal since version 3.4. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".', 'The "Symfony\Component\Debug\Tests\Fixtures\InternalInterface" interface is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".', + 'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass" class is considered internal since version 3.4. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternalsParent".', 'The "Symfony\Component\Debug\Tests\Fixtures\InternalTrait" trait is considered internal. It may change without further notice. You should not use it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".', - 'The "Symfony\Component\Debug\Tests\Fixtures\InternalTrait2::internalMethod()" method is considered internal since version 3.4. It may change without further notice. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".', + 'The "Symfony\Component\Debug\Tests\Fixtures\InternalClass::internalMethod()" method is considered internal since version 3.4. It may change without further notice. You should not extend it from "Test\Symfony\Component\Debug\Tests\ExtendsInternals".', )); } + + public function testUseTraitWithInternalMethod() + { + $deprecations = array(); + set_error_handler(function ($type, $msg) use (&$deprecations) { $deprecations[] = $msg; }); + $e = error_reporting(E_USER_DEPRECATED); + + class_exists('Test\\'.__NAMESPACE__.'\\UseTraitWithInternalMethod', true); + + error_reporting($e); + restore_error_handler(); + + $this->assertSame(array(), $deprecations); + } } class ClassLoader @@ -420,6 +431,8 @@ public function internalMethod() { } }'); } elseif ('Test\\'.__NAMESPACE__.'\ExtendsInternalsParent' === $class) { eval('namespace Test\\'.__NAMESPACE__.'; class ExtendsInternalsParent extends \\'.__NAMESPACE__.'\Fixtures\InternalClass implements \\'.__NAMESPACE__.'\Fixtures\InternalInterface { }'); + } elseif ('Test\\'.__NAMESPACE__.'\UseTraitWithInternalMethod' === $class) { + eval('namespace Test\\'.__NAMESPACE__.'; class UseTraitWithInternalMethod { use \\'.__NAMESPACE__.'\Fixtures\TraitWithInternalMethod; }'); } } } diff --git a/vendor/symfony/debug/Tests/ErrorHandlerTest.php b/vendor/symfony/debug/Tests/ErrorHandlerTest.php index 02e9a7589..a8d40e849 100644 --- a/vendor/symfony/debug/Tests/ErrorHandlerTest.php +++ b/vendor/symfony/debug/Tests/ErrorHandlerTest.php @@ -65,6 +65,30 @@ public function testRegister() } } + public function testErrorGetLast() + { + $handler = ErrorHandler::register(); + $logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); + $handler->setDefaultLogger($logger); + $handler->screamAt(E_ALL); + + try { + @trigger_error('Hello', E_USER_WARNING); + $expected = array( + 'type' => E_USER_WARNING, + 'message' => 'Hello', + 'file' => __FILE__, + 'line' => __LINE__ - 5, + ); + $this->assertSame($expected, error_get_last()); + } catch (\Exception $e) { + restore_error_handler(); + restore_exception_handler(); + + throw $e; + } + } + public function testNotice() { ErrorHandler::register(); @@ -500,7 +524,7 @@ public function testHandleErrorException() $handler = new ErrorHandler(); $handler->setExceptionHandler(function () use (&$args) { - $args = func_get_args(); + $args = \func_get_args(); }); $handler->handleException($exception); @@ -538,7 +562,7 @@ public function testHandleFatalErrorOnHHVM() 'backtrace' => array(456), ); - call_user_func_array(array($handler, 'handleError'), $error); + \call_user_func_array(array($handler, 'handleError'), $error); $handler->handleFatalError($error); } finally { restore_error_handler(); diff --git a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php index 66171e3ae..ce9f35553 100644 --- a/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php +++ b/vendor/symfony/debug/Tests/Exception/FlattenExceptionTest.php @@ -14,19 +14,19 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Debug\Exception\FlattenException; use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; -use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; -use Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException; use Symfony\Component\HttpKernel\Exception\ConflictHttpException; -use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; use Symfony\Component\HttpKernel\Exception\GoneHttpException; use Symfony\Component\HttpKernel\Exception\LengthRequiredHttpException; +use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; +use Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; use Symfony\Component\HttpKernel\Exception\PreconditionFailedHttpException; use Symfony\Component\HttpKernel\Exception\PreconditionRequiredHttpException; use Symfony\Component\HttpKernel\Exception\ServiceUnavailableHttpException; use Symfony\Component\HttpKernel\Exception\TooManyRequestsHttpException; +use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; use Symfony\Component\HttpKernel\Exception\UnsupportedMediaTypeHttpException; class FlattenExceptionTest extends TestCase @@ -236,7 +236,7 @@ function () {}, $this->assertSame(array('object', 'stdClass'), $array[$i++]); $this->assertSame(array('object', 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException'), $array[$i++]); $this->assertSame(array('incomplete-object', 'BogusTestClass'), $array[$i++]); - $this->assertSame(array('resource', defined('HHVM_VERSION') ? 'Directory' : 'stream'), $array[$i++]); + $this->assertSame(array('resource', \defined('HHVM_VERSION') ? 'Directory' : 'stream'), $array[$i++]); $this->assertSame(array('resource', 'stream'), $array[$i++]); $args = $array[$i++]; diff --git a/vendor/symfony/debug/Tests/ExceptionHandlerTest.php b/vendor/symfony/debug/Tests/ExceptionHandlerTest.php index 0285eff13..6ff6a74f4 100644 --- a/vendor/symfony/debug/Tests/ExceptionHandlerTest.php +++ b/vendor/symfony/debug/Tests/ExceptionHandlerTest.php @@ -12,10 +12,10 @@ namespace Symfony\Component\Debug\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\Debug\ExceptionHandler; use Symfony\Component\Debug\Exception\OutOfMemoryException; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; +use Symfony\Component\Debug\ExceptionHandler; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; require_once __DIR__.'/HeaderMock.php'; diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php index 65c80fc1c..5cdac2f12 100644 --- a/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php +++ b/vendor/symfony/debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php @@ -11,18 +11,18 @@ namespace Symfony\Component\Debug\Tests\FatalErrorHandler; +use Composer\Autoload\ClassLoader as ComposerClassLoader; use PHPUnit\Framework\TestCase; +use Symfony\Component\Debug\DebugClassLoader; use Symfony\Component\Debug\Exception\FatalErrorException; use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler; -use Symfony\Component\Debug\DebugClassLoader; -use Composer\Autoload\ClassLoader as ComposerClassLoader; class ClassNotFoundFatalErrorHandlerTest extends TestCase { public static function setUpBeforeClass() { foreach (spl_autoload_functions() as $function) { - if (!is_array($function)) { + if (!\is_array($function)) { continue; } @@ -32,7 +32,7 @@ public static function setUpBeforeClass() } if ($function[0] instanceof ComposerClassLoader) { - $function[0]->add('Symfony_Component_Debug_Tests_Fixtures', dirname(dirname(dirname(dirname(dirname(__DIR__)))))); + $function[0]->add('Symfony_Component_Debug_Tests_Fixtures', \dirname(\dirname(\dirname(\dirname(\dirname(__DIR__)))))); break; } } diff --git a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php index 739e5b2b1..a2647f57f 100644 --- a/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php +++ b/vendor/symfony/debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php @@ -64,10 +64,10 @@ public function provideUndefinedMethodData() ), array( array( - 'type' => 1, - 'message' => 'Call to undefined method class@anonymous::test()', - 'file' => '/home/possum/work/symfony/test.php', - 'line' => 11, + 'type' => 1, + 'message' => 'Call to undefined method class@anonymous::test()', + 'file' => '/home/possum/work/symfony/test.php', + 'line' => 11, ), 'Attempted to call an undefined method named "test" of class "class@anonymous".', ), diff --git a/vendor/symfony/debug/Tests/Fixtures/ExtendedFinalMethod.php b/vendor/symfony/debug/Tests/Fixtures/ExtendedFinalMethod.php index 2bd337e5a..050d19ff5 100644 --- a/vendor/symfony/debug/Tests/Fixtures/ExtendedFinalMethod.php +++ b/vendor/symfony/debug/Tests/Fixtures/ExtendedFinalMethod.php @@ -4,6 +4,8 @@ class ExtendedFinalMethod extends FinalMethod { + use FinalMethod2Trait; + /** * {@inheritdoc} */ diff --git a/vendor/symfony/debug/Tests/Fixtures/FinalMethod.php b/vendor/symfony/debug/Tests/Fixtures/FinalMethod.php index 92ec42186..98a47524c 100644 --- a/vendor/symfony/debug/Tests/Fixtures/FinalMethod.php +++ b/vendor/symfony/debug/Tests/Fixtures/FinalMethod.php @@ -11,6 +11,13 @@ public function finalMethod() { } + /** + * @final + */ + public function finalMethod2() + { + } + public function anotherMethod() { } diff --git a/vendor/symfony/debug/Tests/Fixtures/FinalMethod2Trait.php b/vendor/symfony/debug/Tests/Fixtures/FinalMethod2Trait.php new file mode 100644 index 000000000..8547f3afe --- /dev/null +++ b/vendor/symfony/debug/Tests/Fixtures/FinalMethod2Trait.php @@ -0,0 +1,10 @@ + --EXPECTF-- The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod()" method is considered final since version 3.3. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod". +The "Symfony\Component\Debug\Tests\Fixtures\FinalMethod::finalMethod2()" method is considered final. It may change without further notice as of its next major version. You should not extend it from "Symfony\Component\Debug\Tests\Fixtures\ExtendedFinalMethod". diff --git a/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt b/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt index 7ce7b9dc6..9cd44388c 100644 --- a/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt +++ b/vendor/symfony/debug/Tests/phpt/decorate_exception_hander.phpt @@ -1,5 +1,7 @@ --TEST-- Test catching fatal errors when handlers are nested +--INI-- +display_errors=0 --FILE-- --EXPECTF-- -Fatal error: Class 'Symfony\Component\Debug\missing' not found in %s on line %d object(Symfony\Component\Debug\Exception\ClassNotFoundException)#%d (8) { ["message":protected]=> string(131) "Attempted to load class "missing" from namespace "Symfony\Component\Debug". @@ -38,8 +39,7 @@ Did you forget a "use" statement for another namespace?" ["line":protected]=> int(%d) ["trace":"Exception":private]=> - array(0) { - } + array(%d) {%A} ["previous":"Exception":private]=> NULL ["severity":protected]=> diff --git a/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt b/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt index 9df0a65cf..3f4559543 100644 --- a/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt +++ b/vendor/symfony/debug/Tests/phpt/exception_rethrown.phpt @@ -7,7 +7,7 @@ namespace Symfony\Component\Debug; $vendor = __DIR__; while (!file_exists($vendor.'/vendor')) { - $vendor = dirname($vendor); + $vendor = \dirname($vendor); } require $vendor.'/vendor/autoload.php'; diff --git a/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt b/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt index 5c5245c06..2b74e5c68 100644 --- a/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt +++ b/vendor/symfony/debug/Tests/phpt/fatal_with_nested_handlers.phpt @@ -7,7 +7,7 @@ namespace Symfony\Component\Debug; $vendor = __DIR__; while (!file_exists($vendor.'/vendor')) { - $vendor = dirname($vendor); + $vendor = \dirname($vendor); } require $vendor.'/vendor/autoload.php'; diff --git a/vendor/symfony/debug/phpunit.xml.dist b/vendor/symfony/debug/phpunit.xml.dist index 12e58612b..a51bbff93 100644 --- a/vendor/symfony/debug/phpunit.xml.dist +++ b/vendor/symfony/debug/phpunit.xml.dist @@ -1,7 +1,7 @@ id = (string) $id; $this->public = $public; - $this->private = 2 > func_num_args(); + $this->private = 2 > \func_num_args(); } /** diff --git a/vendor/symfony/dependency-injection/Argument/IteratorArgument.php b/vendor/symfony/dependency-injection/Argument/IteratorArgument.php index ab3a87900..2d796d2d8 100644 --- a/vendor/symfony/dependency-injection/Argument/IteratorArgument.php +++ b/vendor/symfony/dependency-injection/Argument/IteratorArgument.php @@ -46,7 +46,7 @@ public function setValues(array $values) { foreach ($values as $k => $v) { if (null !== $v && !$v instanceof Reference) { - throw new InvalidArgumentException(sprintf('An IteratorArgument must hold only Reference instances, "%s" given.', is_object($v) ? get_class($v) : gettype($v))); + throw new InvalidArgumentException(sprintf('An IteratorArgument must hold only Reference instances, "%s" given.', \is_object($v) ? \get_class($v) : \gettype($v))); } } diff --git a/vendor/symfony/dependency-injection/Argument/RewindableGenerator.php b/vendor/symfony/dependency-injection/Argument/RewindableGenerator.php index e162a7c34..f8f771d62 100644 --- a/vendor/symfony/dependency-injection/Argument/RewindableGenerator.php +++ b/vendor/symfony/dependency-injection/Argument/RewindableGenerator.php @@ -38,7 +38,7 @@ public function getIterator() public function count() { - if (is_callable($count = $this->count)) { + if (\is_callable($count = $this->count)) { $this->count = $count(); } diff --git a/vendor/symfony/dependency-injection/ChildDefinition.php b/vendor/symfony/dependency-injection/ChildDefinition.php index f363a6482..85cc86038 100644 --- a/vendor/symfony/dependency-injection/ChildDefinition.php +++ b/vendor/symfony/dependency-injection/ChildDefinition.php @@ -95,7 +95,7 @@ public function getArgument($index) */ public function replaceArgument($index, $value) { - if (is_int($index)) { + if (\is_int($index)) { $this->arguments['index_'.$index] = $value; } elseif (0 === strpos($index, '$')) { $this->arguments[$index] = $value; @@ -121,14 +121,6 @@ public function setInstanceofConditionals(array $instanceof) { throw new BadMethodCallException('A ChildDefinition cannot have instanceof conditionals set on it.'); } - - /** - * @internal - */ - public function setBindings(array $bindings) - { - throw new BadMethodCallException('A ChildDefinition cannot have bindings set on it.'); - } } class_alias(ChildDefinition::class, DefinitionDecorator::class); diff --git a/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php b/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php index 5d2d4429e..cff09d57d 100644 --- a/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php +++ b/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php @@ -90,8 +90,8 @@ protected function processValue($value, $isRoot = false) */ protected function getConstructor(Definition $definition, $required) { - if (is_string($factory = $definition->getFactory())) { - if (!function_exists($factory)) { + if (\is_string($factory = $definition->getFactory())) { + if (!\function_exists($factory)) { throw new RuntimeException(sprintf('Invalid service "%s": function "%s" does not exist.', $this->currentId, $factory)); } $r = new \ReflectionFunction($factory); @@ -118,8 +118,12 @@ protected function getConstructor(Definition $definition, $required) $class = $definition->getClass(); - if (!$r = $this->container->getReflectionClass($class)) { - throw new RuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class)); + try { + if (!$r = $this->container->getReflectionClass($class)) { + throw new RuntimeException(sprintf('Invalid service "%s": class "%s" does not exist.', $this->currentId, $class)); + } + } catch (\ReflectionException $e) { + throw new RuntimeException(sprintf('Invalid service "%s": %s.', $this->currentId, lcfirst(rtrim($e->getMessage(), '.')))); } if (!$r = $r->getConstructor()) { if ($required) { diff --git a/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php b/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php index 296051302..7c22d3c08 100644 --- a/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/AnalyzeServiceReferencesPass.php @@ -12,12 +12,12 @@ namespace Symfony\Component\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\ExpressionLanguage; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\ExpressionLanguage\Expression; /** @@ -34,15 +34,18 @@ class AnalyzeServiceReferencesPass extends AbstractRecursivePass implements Repe private $graph; private $currentDefinition; private $onlyConstructorArguments; + private $hasProxyDumper; private $lazy; private $expressionLanguage; + private $byConstructor; /** * @param bool $onlyConstructorArguments Sets this Service Reference pass to ignore method calls */ - public function __construct($onlyConstructorArguments = false) + public function __construct($onlyConstructorArguments = false, $hasProxyDumper = true) { $this->onlyConstructorArguments = (bool) $onlyConstructorArguments; + $this->hasProxyDumper = (bool) $hasProxyDumper; } /** @@ -62,6 +65,7 @@ public function process(ContainerBuilder $container) $this->graph = $container->getCompiler()->getServiceReferenceGraph(); $this->graph->clear(); $this->lazy = false; + $this->byConstructor = false; foreach ($container->getAliases() as $id => $alias) { $targetId = $this->getDefinitionId((string) $alias); @@ -97,8 +101,9 @@ protected function processValue($value, $isRoot = false) $targetId, $targetDefinition, $value, - $this->lazy || ($targetDefinition && $targetDefinition->isLazy()), - ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior() + $this->lazy || ($this->hasProxyDumper && $targetDefinition && $targetDefinition->isLazy()), + ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior(), + $this->byConstructor ); return $value; @@ -111,11 +116,16 @@ protected function processValue($value, $isRoot = false) return $value; } $this->currentDefinition = $value; + } elseif ($this->currentDefinition === $value) { + return $value; } $this->lazy = false; + $byConstructor = $this->byConstructor; + $this->byConstructor = true; $this->processValue($value->getFactory()); $this->processValue($value->getArguments()); + $this->byConstructor = $byConstructor; if (!$this->onlyConstructorArguments) { $this->processValue($value->getProperties()); diff --git a/vendor/symfony/dependency-injection/Compiler/AutowirePass.php b/vendor/symfony/dependency-injection/Compiler/AutowirePass.php index 803490cec..4aabb0b29 100644 --- a/vendor/symfony/dependency-injection/Compiler/AutowirePass.php +++ b/vendor/symfony/dependency-injection/Compiler/AutowirePass.php @@ -452,7 +452,17 @@ private function createAutowiredDefinition($type) private function createTypeNotFoundMessage(TypedReference $reference, $label) { - if (!$r = $this->container->getReflectionClass($type = $reference->getType(), false)) { + $trackResources = $this->container->isTrackingResources(); + $this->container->setResourceTracking(false); + try { + if ($r = $this->container->getReflectionClass($type = $reference->getType(), false)) { + $alternatives = $this->createTypeAlternatives($reference); + } + } finally { + $this->container->setResourceTracking($trackResources); + } + + if (!$r) { // either $type does not exist or a parent class does not exist try { $resource = new ClassExistenceResource($type, false); @@ -465,7 +475,6 @@ private function createTypeNotFoundMessage(TypedReference $reference, $label) $message = sprintf('has type "%s" but this class %s.', $type, $parentMsg ? sprintf('is missing a parent class (%s)', $parentMsg) : 'was not found'); } else { - $alternatives = $this->createTypeAlternatives($reference); $message = $this->container->has($type) ? 'this service is abstract' : 'no such service exists'; $message = sprintf('references %s "%s" but %s.%s', $r->isInterface() ? 'interface' : 'class', $type, $message, $alternatives); @@ -542,7 +551,7 @@ private function getAliasesSuggestionForType($type, $extraContext = null) } $extraContext = $extraContext ? ' '.$extraContext : ''; - if (1 < $len = count($aliases)) { + if (1 < $len = \count($aliases)) { $message = sprintf('Try changing the type-hint%s to one of its parents: ', $extraContext); for ($i = 0, --$len; $i < $len; ++$i) { $message .= sprintf('%s "%s", ', class_exists($aliases[$i], false) ? 'class' : 'interface', $aliases[$i]); diff --git a/vendor/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php b/vendor/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php index 7f032058a..feb05c049 100644 --- a/vendor/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php +++ b/vendor/symfony/dependency-injection/Compiler/CheckArgumentsValidityPass.php @@ -41,7 +41,7 @@ protected function processValue($value, $isRoot = false) $i = 0; foreach ($value->getArguments() as $k => $v) { if ($k !== $i++) { - if (!is_int($k)) { + if (!\is_int($k)) { $msg = sprintf('Invalid constructor argument for service "%s": integer expected but found string "%s". Check your service definition.', $this->currentId, $k); $value->addError($msg); if ($this->throwExceptions) { @@ -63,7 +63,7 @@ protected function processValue($value, $isRoot = false) $i = 0; foreach ($methodCall[1] as $k => $v) { if ($k !== $i++) { - if (!is_int($k)) { + if (!\is_int($k)) { $msg = sprintf('Invalid argument for method call "%s" of service "%s": integer expected but found string "%s". Check your service definition.', $methodCall[0], $this->currentId, $k); $value->addError($msg); if ($this->throwExceptions) { diff --git a/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php b/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php index 6191893e0..ac7866b2b 100644 --- a/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/CheckCircularReferencesPass.php @@ -11,8 +11,8 @@ namespace Symfony\Component\DependencyInjection\Compiler; -use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; /** * Checks your services for circular references. @@ -64,7 +64,7 @@ private function checkOutEdges(array $edges) $this->currentPath[] = $id; if (false !== $searchKey) { - throw new ServiceCircularReferenceException($id, array_slice($this->currentPath, $searchKey)); + throw new ServiceCircularReferenceException($id, \array_slice($this->currentPath, $searchKey)); } $this->checkOutEdges($node->getOutEdges()); diff --git a/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php b/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php index d7d44d90c..a1967802f 100644 --- a/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php +++ b/vendor/symfony/dependency-injection/Compiler/CheckDefinitionValidityPass.php @@ -48,6 +48,15 @@ public function process(ContainerBuilder $container) throw new RuntimeException(sprintf('Please add the class to service "%s" even if it is constructed by a factory since we might need to add method calls based on compile-time checks.', $id)); } if (class_exists($id) || interface_exists($id, false)) { + if (0 === strpos($id, '\\') && 1 < substr_count($id, '\\')) { + throw new RuntimeException(sprintf( + 'The definition for "%s" has no class attribute, and appears to reference a class or interface. ' + .'Please specify the class attribute explicitly or remove the leading backslash by renaming ' + .'the service to "%s" to get rid of this error.', + $id, substr($id, 1) + )); + } + throw new RuntimeException(sprintf( 'The definition for "%s" has no class attribute, and appears to reference a ' .'class or interface in the global namespace. Leaving out the "class" attribute ' @@ -57,13 +66,7 @@ public function process(ContainerBuilder $container) )); } - throw new RuntimeException(sprintf( - 'The definition for "%s" has no class. If you intend to inject ' - .'this service dynamically at runtime, please mark it as synthetic=true. ' - .'If this is an abstract definition solely used by child definitions, ' - .'please add abstract=true, otherwise specify a class to get rid of this error.', - $id - )); + throw new RuntimeException(sprintf('The definition for "%s" has no class. If you intend to inject this service dynamically at runtime, please mark it as synthetic=true. If this is an abstract definition solely used by child definitions, please add abstract=true, otherwise specify a class to get rid of this error.', $id)); } // tag attribute values must be scalars diff --git a/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php b/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php index 7ffedd3dc..77b35f186 100644 --- a/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php +++ b/vendor/symfony/dependency-injection/Compiler/CheckExceptionOnInvalidReferenceBehaviorPass.php @@ -11,9 +11,8 @@ namespace Symfony\Component\DependencyInjection\Compiler; -use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\Reference; /** @@ -31,9 +30,6 @@ protected function processValue($value, $isRoot = false) if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $value->getInvalidBehavior() && !$this->container->has($id = (string) $value)) { throw new ServiceNotFoundException($id, $this->currentId); } - if (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $value->getInvalidBehavior() && $this->container->has($id = (string) $value) && !$this->container->findDefinition($id)->isShared()) { - throw new InvalidArgumentException(sprintf('Invalid ignore-on-uninitialized reference found in service "%s": target service "%s" is not shared.', $this->currentId, $id)); - } return $value; } diff --git a/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php b/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php index 72c7dd165..8f2a3bdf7 100644 --- a/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php +++ b/vendor/symfony/dependency-injection/Compiler/CheckReferenceValidityPass.php @@ -12,8 +12,8 @@ namespace Symfony\Component\DependencyInjection\Compiler; use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Reference; /** * Checks the validity of references. @@ -34,12 +34,7 @@ protected function processValue($value, $isRoot = false) $targetDefinition = $this->container->getDefinition((string) $value); if ($targetDefinition->isAbstract()) { - throw new RuntimeException(sprintf( - 'The definition "%s" has a reference to an abstract definition "%s". ' - .'Abstract definitions cannot be the target of references.', - $this->currentId, - $value - )); + throw new RuntimeException(sprintf('The definition "%s" has a reference to an abstract definition "%s". Abstract definitions cannot be the target of references.', $this->currentId, $value)); } } diff --git a/vendor/symfony/dependency-injection/Compiler/Compiler.php b/vendor/symfony/dependency-injection/Compiler/Compiler.php index 2a0d13641..d5c01a640 100644 --- a/vendor/symfony/dependency-injection/Compiler/Compiler.php +++ b/vendor/symfony/dependency-injection/Compiler/Compiler.php @@ -79,10 +79,10 @@ public function getLoggingFormatter() */ public function addPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/) { - if (func_num_args() >= 3) { + if (\func_num_args() >= 3) { $priority = func_get_arg(2); } else { - if (__CLASS__ !== get_class($this)) { + if (__CLASS__ !== \get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED); @@ -115,10 +115,10 @@ public function addLogMessage($string) public function log(CompilerPassInterface $pass, $message) { if (false !== strpos($message, "\n")) { - $message = str_replace("\n", "\n".get_class($pass).': ', trim($message)); + $message = str_replace("\n", "\n".\get_class($pass).': ', trim($message)); } - $this->log[] = get_class($pass).': '.$message; + $this->log[] = \get_class($pass).': '.$message; } /** diff --git a/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php b/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php index 1976d0ac5..263bd4cf1 100644 --- a/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php +++ b/vendor/symfony/dependency-injection/Compiler/DecoratorServicePass.php @@ -11,8 +11,8 @@ namespace Symfony\Component\DependencyInjection\Compiler; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\DependencyInjection\ContainerBuilder; /** * Overwrites a service but keeps the overridden one. @@ -34,6 +34,7 @@ public function process(ContainerBuilder $container) } $definitions->insert(array($id, $definition), array($decorated[2], --$order)); } + $decoratingDefinitions = array(); foreach ($definitions as list($id, $definition)) { list($inner, $renamedId) = $definition->getDecoratedService(); @@ -53,18 +54,25 @@ public function process(ContainerBuilder $container) $container->setAlias($renamedId, new Alias($container->normalizeId($alias), false)); } else { $decoratedDefinition = $container->getDefinition($inner); - $definition->setTags(array_merge($decoratedDefinition->getTags(), $definition->getTags())); - if ($types = array_merge($decoratedDefinition->getAutowiringTypes(false), $definition->getAutowiringTypes(false))) { - $definition->setAutowiringTypes($types); - } $public = $decoratedDefinition->isPublic(); $private = $decoratedDefinition->isPrivate(); $decoratedDefinition->setPublic(false); - $decoratedDefinition->setTags(array()); - if ($decoratedDefinition->getAutowiringTypes(false)) { - $decoratedDefinition->setAutowiringTypes(array()); - } $container->setDefinition($renamedId, $decoratedDefinition); + $decoratingDefinitions[$inner] = $decoratedDefinition; + } + + if (isset($decoratingDefinitions[$inner])) { + $decoratingDefinition = $decoratingDefinitions[$inner]; + $definition->setTags(array_merge($decoratingDefinition->getTags(), $definition->getTags())); + $autowiringTypes = $decoratingDefinition->getAutowiringTypes(false); + if ($types = array_merge($autowiringTypes, $definition->getAutowiringTypes(false))) { + $definition->setAutowiringTypes($types); + } + $decoratingDefinition->setTags(array()); + if ($autowiringTypes) { + $decoratingDefinition->setAutowiringTypes(array()); + } + $decoratingDefinitions[$inner] = $definition; } $container->setAlias($inner, $id)->setPublic($public)->setPrivate($private); diff --git a/vendor/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php b/vendor/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php index 825e117cc..1279fcaa7 100644 --- a/vendor/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php +++ b/vendor/symfony/dependency-injection/Compiler/FactoryReturnTypePass.php @@ -61,7 +61,7 @@ private function updateDefinition(ContainerBuilder $container, $id, Definition $ } $class = null; - if (is_string($factory)) { + if (\is_string($factory)) { try { $m = new \ReflectionFunction($factory); if (false !== $m->getFileName() && file_exists($m->getFileName())) { diff --git a/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php b/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php index c64348ed1..05eb72d97 100644 --- a/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/InlineServiceDefinitionsPass.php @@ -88,7 +88,7 @@ protected function processValue($value, $isRoot = false) $ids = array_keys($this->cloningIds); $ids[] = $id; - throw new ServiceCircularReferenceException($id, array_slice($ids, array_search($id, $ids))); + throw new ServiceCircularReferenceException($id, \array_slice($ids, array_search($id, $ids))); } $this->cloningIds[$id] = true; @@ -106,11 +106,15 @@ protected function processValue($value, $isRoot = false) */ private function isInlineableDefinition($id, Definition $definition, ServiceReferenceGraph $graph) { + if ($definition->getErrors() || $definition->isDeprecated() || $definition->isLazy() || $definition->isSynthetic()) { + return false; + } + if (!$definition->isShared()) { return true; } - if ($definition->isDeprecated() || $definition->isPublic() || $definition->isPrivate() || $definition->isLazy()) { + if ($definition->isPublic() || $definition->isPrivate()) { return false; } @@ -130,14 +134,14 @@ private function isInlineableDefinition($id, Definition $definition, ServiceRefe $ids[] = $edge->getSourceNode()->getId(); } - if (count(array_unique($ids)) > 1) { + if (\count(array_unique($ids)) > 1) { return false; } - if (count($ids) > 1 && is_array($factory = $definition->getFactory()) && ($factory[0] instanceof Reference || $factory[0] instanceof Definition)) { + if (\count($ids) > 1 && \is_array($factory = $definition->getFactory()) && ($factory[0] instanceof Reference || $factory[0] instanceof Definition)) { return false; } - return true; + return !$ids || $this->container->getDefinition($ids[0])->isShared(); } } diff --git a/vendor/symfony/dependency-injection/Compiler/LoggingFormatter.php b/vendor/symfony/dependency-injection/Compiler/LoggingFormatter.php index a9d8258de..b058d2623 100644 --- a/vendor/symfony/dependency-injection/Compiler/LoggingFormatter.php +++ b/vendor/symfony/dependency-injection/Compiler/LoggingFormatter.php @@ -49,6 +49,6 @@ public function formatUnusedAutowiringPatterns(CompilerPassInterface $pass, $id, public function format(CompilerPassInterface $pass, $message) { - return sprintf('%s: %s', get_class($pass), $message); + return sprintf('%s: %s', \get_class($pass), $message); } } diff --git a/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php b/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php index c36535927..71cfa2d51 100644 --- a/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php +++ b/vendor/symfony/dependency-injection/Compiler/MergeExtensionConfigurationPass.php @@ -147,7 +147,7 @@ public function __construct(ExtensionInterface $extension, ParameterBagInterface { parent::__construct($parameterBag); - $this->extensionClass = get_class($extension); + $this->extensionClass = \get_class($extension); } /** @@ -155,7 +155,7 @@ public function __construct(ExtensionInterface $extension, ParameterBagInterface */ public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/) { - throw new LogicException(sprintf('You cannot add compiler pass "%s" from extension "%s". Compiler passes must be registered before the container is compiled.', get_class($pass), $this->extensionClass)); + throw new LogicException(sprintf('You cannot add compiler pass "%s" from extension "%s". Compiler passes must be registered before the container is compiled.', \get_class($pass), $this->extensionClass)); } /** @@ -163,7 +163,7 @@ public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig: */ public function registerExtension(ExtensionInterface $extension) { - throw new LogicException(sprintf('You cannot register extension "%s" from "%s". Extensions must be registered before the container is compiled.', get_class($extension), $this->extensionClass)); + throw new LogicException(sprintf('You cannot register extension "%s" from "%s". Extensions must be registered before the container is compiled.', \get_class($extension), $this->extensionClass)); } /** diff --git a/vendor/symfony/dependency-injection/Compiler/PassConfig.php b/vendor/symfony/dependency-injection/Compiler/PassConfig.php index d1a308328..31104fb1f 100644 --- a/vendor/symfony/dependency-injection/Compiler/PassConfig.php +++ b/vendor/symfony/dependency-injection/Compiler/PassConfig.php @@ -121,10 +121,10 @@ public function getPasses() */ public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/) { - if (func_num_args() >= 3) { + if (\func_num_args() >= 3) { $priority = func_get_arg(2); } else { - if (__CLASS__ !== get_class($this)) { + if (__CLASS__ !== \get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED); @@ -271,13 +271,13 @@ public function setRemovingPasses(array $passes) */ private function sortPasses(array $passes) { - if (0 === count($passes)) { + if (0 === \count($passes)) { return array(); } krsort($passes); // Flatten the array - return call_user_func_array('array_merge', $passes); + return \call_user_func_array('array_merge', $passes); } } diff --git a/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php b/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php index 97b083fa1..ed9b0b7f1 100644 --- a/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php +++ b/vendor/symfony/dependency-injection/Compiler/PriorityTaggedServiceTrait.php @@ -47,7 +47,7 @@ private function findAndSortTaggedServices($tagName, ContainerBuilder $container if ($services) { krsort($services); - $services = call_user_func_array('array_merge', $services); + $services = \call_user_func_array('array_merge', $services); } return $services; diff --git a/vendor/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php b/vendor/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php index b99c252fe..e206b0ced 100644 --- a/vendor/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/RegisterEnvVarProcessorsPass.php @@ -17,8 +17,8 @@ use Symfony\Component\DependencyInjection\EnvVarProcessorInterface; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; -use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ServiceLocator; /** * Creates the container.env_var_processors_locator service. @@ -68,7 +68,7 @@ private static function validateProvidedTypes($types, $class) $types = explode('|', $types); foreach ($types as $type) { - if (!in_array($type, self::$allowedTypes)) { + if (!\in_array($type, self::$allowedTypes)) { throw new InvalidArgumentException(sprintf('Invalid type "%s" returned by "%s::getProvidedTypes()", expected one of "%s".', $type, $class, implode('", "', self::$allowedTypes))); } } diff --git a/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php b/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php index 63cacfad8..0a7dcd7e9 100644 --- a/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php +++ b/vendor/symfony/dependency-injection/Compiler/RegisterServiceSubscribersPass.php @@ -68,14 +68,14 @@ protected function processValue($value, $isRoot = false) $declaringClass = (new \ReflectionMethod($class, 'getSubscribedServices'))->class; foreach ($class::getSubscribedServices() as $key => $type) { - if (!is_string($type) || !preg_match('/^\??[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+$/', $type)) { - throw new InvalidArgumentException(sprintf('"%s::getSubscribedServices()" must return valid PHP types for service "%s" key "%s", "%s" returned.', $class, $this->currentId, $key, is_string($type) ? $type : gettype($type))); + if (!\is_string($type) || !preg_match('/^\??[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+$/', $type)) { + throw new InvalidArgumentException(sprintf('"%s::getSubscribedServices()" must return valid PHP types for service "%s" key "%s", "%s" returned.', $class, $this->currentId, $key, \is_string($type) ? $type : \gettype($type))); } if ($optionalBehavior = '?' === $type[0]) { $type = substr($type, 1); $optionalBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE; } - if (is_int($key)) { + if (\is_int($key)) { $key = $type; } if (!isset($serviceMap[$key])) { @@ -90,7 +90,7 @@ protected function processValue($value, $isRoot = false) } if ($serviceMap = array_keys($serviceMap)) { - $message = sprintf(1 < count($serviceMap) ? 'keys "%s" do' : 'key "%s" does', str_replace('%', '%%', implode('", "', $serviceMap))); + $message = sprintf(1 < \count($serviceMap) ? 'keys "%s" do' : 'key "%s" does', str_replace('%', '%%', implode('", "', $serviceMap))); throw new InvalidArgumentException(sprintf('Service %s not exist in the map returned by "%s::getSubscribedServices()" for service "%s".', $message, $class, $this->currentId)); } diff --git a/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php b/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php index c0771890a..5a8548a19 100644 --- a/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/RemoveUnusedDefinitionsPass.php @@ -58,19 +58,19 @@ public function process(ContainerBuilder $container) $referencingAliases[] = $node->getValue(); } } - $isReferenced = (count(array_unique($sourceIds)) - count($referencingAliases)) > 0; + $isReferenced = (\count(array_unique($sourceIds)) - \count($referencingAliases)) > 0; } else { $referencingAliases = array(); $isReferenced = false; } - if (1 === count($referencingAliases) && false === $isReferenced) { + if (1 === \count($referencingAliases) && false === $isReferenced) { $container->setDefinition((string) reset($referencingAliases), $definition); $definition->setPublic(!$definition->isPrivate()); $definition->setPrivate(reset($referencingAliases)->isPrivate()); $container->removeDefinition($id); $container->log($this, sprintf('Removed service "%s"; reason: replaces alias %s.', $id, reset($referencingAliases))); - } elseif (0 === count($referencingAliases) && false === $isReferenced) { + } elseif (0 === \count($referencingAliases) && false === $isReferenced) { $container->removeDefinition($id); $container->resolveEnvPlaceholders(serialize($definition)); $container->log($this, sprintf('Removed service "%s"; reason: unused.', $id)); diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveBindingsPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveBindingsPass.php index 024523e15..bcf265ab4 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveBindingsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveBindingsPass.php @@ -17,8 +17,8 @@ use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\LazyProxy\ProxyHelper; -use Symfony\Component\DependencyInjection\TypedReference; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\TypedReference; /** * @author Guilhem Niot @@ -27,6 +27,7 @@ class ResolveBindingsPass extends AbstractRecursivePass { private $usedBindings = array(); private $unusedBindings = array(); + private $errorMessages = array(); /** * {@inheritdoc} @@ -37,11 +38,19 @@ public function process(ContainerBuilder $container) parent::process($container); foreach ($this->unusedBindings as list($key, $serviceId)) { - throw new InvalidArgumentException(sprintf('Unused binding "%s" in service "%s".', $key, $serviceId)); + $message = sprintf('Unused binding "%s" in service "%s".', $key, $serviceId); + if ($this->errorMessages) { + $message .= sprintf("\nCould be related to%s:", 1 < \count($this->errorMessages) ? ' one of' : ''); + } + foreach ($this->errorMessages as $m) { + $message .= "\n - ".$m; + } + throw new InvalidArgumentException($message); } } finally { $this->usedBindings = array(); $this->unusedBindings = array(); + $this->errorMessages = array(); } } @@ -79,7 +88,7 @@ protected function processValue($value, $isRoot = false) } if (null !== $bindingValue && !$bindingValue instanceof Reference && !$bindingValue instanceof Definition) { - throw new InvalidArgumentException(sprintf('Invalid value for binding key "%s" for service "%s": expected null, an instance of %s or an instance of %s, %s given.', $key, $this->currentId, Reference::class, Definition::class, gettype($bindingValue))); + throw new InvalidArgumentException(sprintf('Invalid value for binding key "%s" for service "%s": expected null, an instance of %s or an instance of %s, %s given.', $key, $this->currentId, Reference::class, Definition::class, \gettype($bindingValue))); } } @@ -94,6 +103,7 @@ protected function processValue($value, $isRoot = false) $calls[] = array($constructor, $value->getArguments()); } } catch (RuntimeException $e) { + $this->errorMessages[] = $e->getMessage(); $this->container->getDefinition($this->currentId)->addError($e->getMessage()); return parent::processValue($value, $isRoot); diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php index a124e472a..d647eda23 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php @@ -15,6 +15,7 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\ExceptionInterface; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; /** * This replaces all ChildDefinition instances with their equivalent fully @@ -25,6 +26,8 @@ */ class ResolveChildDefinitionsPass extends AbstractRecursivePass { + private $currentPath; + protected function processValue($value, $isRoot = false) { if (!$value instanceof Definition) { @@ -36,6 +39,7 @@ protected function processValue($value, $isRoot = false) $value = $this->container->getDefinition($this->currentId); } if ($value instanceof ChildDefinition) { + $this->currentPath = array(); $value = $this->resolveDefinition($value); if ($isRoot) { $this->container->setDefinition($this->currentId, $value); @@ -56,6 +60,8 @@ private function resolveDefinition(ChildDefinition $definition) { try { return $this->doResolveDefinition($definition); + } catch (ServiceCircularReferenceException $e) { + throw $e; } catch (ExceptionInterface $e) { $r = new \ReflectionProperty($e, 'message'); $r->setAccessible(true); @@ -71,6 +77,13 @@ private function doResolveDefinition(ChildDefinition $definition) throw new RuntimeException(sprintf('Parent definition "%s" does not exist.', $parent)); } + $searchKey = array_search($parent, $this->currentPath); + $this->currentPath[] = $parent; + + if (false !== $searchKey) { + throw new ServiceCircularReferenceException($parent, \array_slice($this->currentPath, $searchKey)); + } + $parentDef = $this->container->findDefinition($parent); if ($parentDef instanceof ChildDefinition) { $id = $this->currentId; @@ -103,7 +116,7 @@ private function doResolveDefinition(ChildDefinition $definition) $def->setAutowired($parentDef->isAutowired()); $def->setChanges($parentDef->getChanges()); - $def->setBindings($parentDef->getBindings()); + $def->setBindings($definition->getBindings() + $parentDef->getBindings()); // overwrite with values specified in the decorator $changes = $definition->getChanges(); @@ -150,7 +163,7 @@ private function doResolveDefinition(ChildDefinition $definition) if (is_numeric($k)) { $def->addArgument($v); } elseif (0 === strpos($k, 'index_')) { - $def->replaceArgument((int) substr($k, strlen('index_')), $v); + $def->replaceArgument((int) substr($k, \strlen('index_')), $v); } else { $def->setArgument($k, $v); } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php index c40d6f5d3..910cb9de9 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveClassPass.php @@ -11,8 +11,8 @@ namespace Symfony\Component\DependencyInjection\Compiler; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ChildDefinition; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; /** diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveEnvPlaceholdersPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveEnvPlaceholdersPass.php index f42107c6f..9e1edd4d3 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveEnvPlaceholdersPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveEnvPlaceholdersPass.php @@ -20,7 +20,7 @@ class ResolveEnvPlaceholdersPass extends AbstractRecursivePass { protected function processValue($value, $isRoot = false) { - if (is_string($value)) { + if (\is_string($value)) { return $this->container->resolveEnvPlaceholders($value, true); } if ($value instanceof Definition) { @@ -35,7 +35,7 @@ protected function processValue($value, $isRoot = false) $value = parent::processValue($value, $isRoot); - if ($value && is_array($value) && !$isRoot) { + if ($value && \is_array($value) && !$isRoot) { $value = array_combine($this->container->resolveEnvPlaceholders(array_keys($value), true), $value); } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php index c41cf973f..848da7f2b 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveFactoryClassPass.php @@ -24,7 +24,7 @@ class ResolveFactoryClassPass extends AbstractRecursivePass */ protected function processValue($value, $isRoot = false) { - if ($value instanceof Definition && is_array($factory = $value->getFactory()) && null === $factory[0]) { + if ($value instanceof Definition && \is_array($factory = $value->getFactory()) && null === $factory[0]) { if (null === $class = $value->getClass()) { throw new RuntimeException(sprintf('The "%s" service is defined to be created by a factory, but is missing the factory class. Did you forget to define the factory or service class?', $this->currentId)); } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php index 15110261a..20507cfb5 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveInstanceofConditionalsPass.php @@ -14,8 +14,8 @@ use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; /** * Applies instanceof conditionals to definitions. @@ -105,11 +105,11 @@ private function processDefinition(ContainerBuilder $container, $id, Definition $definition->setShared($shared); } - $i = count($instanceofTags); + $i = \count($instanceofTags); while (0 <= --$i) { foreach ($instanceofTags[$i] as $k => $v) { foreach ($v as $v) { - if ($definition->hasTag($k) && in_array($v, $definition->getTag($k))) { + if ($definition->hasTag($k) && \in_array($v, $definition->getTag($k))) { continue; } $definition->addTag($k, $v); @@ -117,9 +117,11 @@ private function processDefinition(ContainerBuilder $container, $id, Definition } } + $definition->setBindings($bindings); + // reset fields with "merge" behavior $abstract - ->setBindings($bindings) + ->setBindings(array()) ->setArguments(array()) ->setMethodCalls(array()) ->setDecoratedService(null) diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php index d60272b27..f1a1475ae 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveInvalidReferencesPass.php @@ -13,11 +13,11 @@ use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Reference; /** * Emulates the invalid behavior if the reference is not found within the @@ -63,7 +63,7 @@ private function processValue($value, $rootLevel = 0, $level = 0) $value->setArguments($this->processValue($value->getArguments(), 0)); $value->setProperties($this->processValue($value->getProperties(), 1)); $value->setMethodCalls($this->processValue($value->getMethodCalls(), 2)); - } elseif (is_array($value)) { + } elseif (\is_array($value)) { $i = 0; foreach ($value as $k => $v) { diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php index cd6bb6fe8..90cf64adb 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveNamedArgumentsPass.php @@ -41,7 +41,7 @@ protected function processValue($value, $isRoot = false) $resolvedArguments = array(); foreach ($arguments as $key => $argument) { - if (is_int($key)) { + if (\is_int($key)) { $resolvedArguments[$key] = $argument; continue; } @@ -65,7 +65,7 @@ protected function processValue($value, $isRoot = false) } if (null !== $argument && !$argument instanceof Reference && !$argument instanceof Definition) { - throw new InvalidArgumentException(sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of %s or an instance of %s, %s given.', $this->currentId, $key, $class !== $this->currentId ? $class.'::'.$method : $method, Reference::class, Definition::class, gettype($argument))); + throw new InvalidArgumentException(sprintf('Invalid service "%s": the value of argument "%s" of method "%s()" must be null, an instance of %s or an instance of %s, %s given.', $this->currentId, $key, $class !== $this->currentId ? $class.'::'.$method : $method, Reference::class, Definition::class, \gettype($argument))); } $typeFound = false; diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php index 9733e5d09..9a59a73ec 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveParameterPlaceHoldersPass.php @@ -60,10 +60,10 @@ public function process(ContainerBuilder $container) protected function processValue($value, $isRoot = false) { - if (is_string($value)) { + if (\is_string($value)) { $v = $this->bag->resolveValue($value); - return $this->resolveArrays || !$v || !is_array($v) ? $v : $value; + return $this->resolveArrays || !$v || !\is_array($v) ? $v : $value; } if ($value instanceof Definition) { $value->setBindings($this->processValue($value->getBindings())); @@ -78,7 +78,7 @@ protected function processValue($value, $isRoot = false) $value = parent::processValue($value, $isRoot); - if ($value && is_array($value)) { + if ($value && \is_array($value)) { $value = array_combine($this->bag->resolveValue(array_keys($value)), $value); } diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php index 831d99453..839af1ae2 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveReferencesToAliasesPass.php @@ -11,9 +11,9 @@ namespace Symfony\Component\DependencyInjection\Compiler; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; /** * Replaces all references to aliases with references to the actual service. @@ -66,7 +66,7 @@ private function getDefinitionId($id, ContainerBuilder $container) $seen = array(); while ($container->hasAlias($id)) { if (isset($seen[$id])) { - throw new ServiceCircularReferenceException($id, array_keys($seen)); + throw new ServiceCircularReferenceException($id, array_merge(array_keys($seen), array($id))); } $seen[$id] = true; $id = $container->normalizeId($container->getAlias($id)); diff --git a/vendor/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php b/vendor/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php index bde943369..ccc80a443 100644 --- a/vendor/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ResolveServiceSubscribersPass.php @@ -35,7 +35,12 @@ protected function processValue($value, $isRoot = false) } $serviceLocator = $this->serviceLocator; - $this->serviceLocator = $value->hasTag('container.service_subscriber.locator') ? $value->getTag('container.service_subscriber.locator')[0]['id'] : null; + $this->serviceLocator = null; + + if ($value->hasTag('container.service_subscriber.locator')) { + $this->serviceLocator = $value->getTag('container.service_subscriber.locator')[0]['id']; + $value->clearTag('container.service_subscriber.locator'); + } try { return parent::processValue($value); diff --git a/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php b/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php index fb32d501a..5a0703e83 100644 --- a/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php +++ b/vendor/symfony/dependency-injection/Compiler/ServiceLocatorTagPass.php @@ -37,7 +37,7 @@ protected function processValue($value, $isRoot = false) } $arguments = $value->getArguments(); - if (!isset($arguments[0]) || !is_array($arguments[0])) { + if (!isset($arguments[0]) || !\is_array($arguments[0])) { throw new InvalidArgumentException(sprintf('Invalid definition for service "%s": an array of references is expected as first argument when the "container.service_locator" tag is set.', $this->currentId)); } @@ -46,7 +46,7 @@ protected function processValue($value, $isRoot = false) continue; } if (!$v instanceof Reference) { - throw new InvalidArgumentException(sprintf('Invalid definition for service "%s": an array of references is expected as first argument when the "container.service_locator" tag is set, "%s" found for key "%s".', $this->currentId, is_object($v) ? get_class($v) : gettype($v), $k)); + throw new InvalidArgumentException(sprintf('Invalid definition for service "%s": an array of references is expected as first argument when the "container.service_locator" tag is set, "%s" found for key "%s".', $this->currentId, \is_object($v) ? \get_class($v) : \gettype($v), $k)); } $arguments[0][$k] = new ServiceClosureArgument($v); } @@ -80,7 +80,7 @@ public static function register(ContainerBuilder $container, array $refMap, $cal { foreach ($refMap as $id => $ref) { if (!$ref instanceof Reference) { - throw new InvalidArgumentException(sprintf('Invalid service locator definition: only services can be referenced, "%s" found for key "%s". Inject parameter values using constructors instead.', is_object($ref) ? get_class($ref) : gettype($ref), $id)); + throw new InvalidArgumentException(sprintf('Invalid service locator definition: only services can be referenced, "%s" found for key "%s". Inject parameter values using constructors instead.', \is_object($ref) ? \get_class($ref) : \gettype($ref), $id)); } $refMap[$id] = new ServiceClosureArgument($ref); } diff --git a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php index d040e66c4..83486f053 100644 --- a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php +++ b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraph.php @@ -91,11 +91,13 @@ public function clear() * @param string $reference * @param bool $lazy * @param bool $weak + * @param bool $byConstructor */ - public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null/*, bool $lazy = false, bool $weak = false*/) + public function connect($sourceId, $sourceValue, $destId, $destValue = null, $reference = null/*, bool $lazy = false, bool $weak = false, bool $byConstructor = false*/) { - $lazy = func_num_args() >= 6 ? func_get_arg(5) : false; - $weak = func_num_args() >= 7 ? func_get_arg(6) : false; + $lazy = \func_num_args() >= 6 ? func_get_arg(5) : false; + $weak = \func_num_args() >= 7 ? func_get_arg(6) : false; + $byConstructor = \func_num_args() >= 8 ? func_get_arg(7) : false; if (null === $sourceId || null === $destId) { return; @@ -103,7 +105,7 @@ public function connect($sourceId, $sourceValue, $destId, $destValue = null, $re $sourceNode = $this->createNode($sourceId, $sourceValue); $destNode = $this->createNode($destId, $destValue); - $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference, $lazy, $weak); + $edge = new ServiceReferenceGraphEdge($sourceNode, $destNode, $reference, $lazy, $weak, $byConstructor); $sourceNode->addOutEdge($edge); $destNode->addInEdge($edge); diff --git a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php index 018905394..5b8c84b6d 100644 --- a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php +++ b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphEdge.php @@ -25,6 +25,7 @@ class ServiceReferenceGraphEdge private $value; private $lazy; private $weak; + private $byConstructor; /** * @param ServiceReferenceGraphNode $sourceNode @@ -32,14 +33,16 @@ class ServiceReferenceGraphEdge * @param mixed $value * @param bool $lazy * @param bool $weak + * @param bool $byConstructor */ - public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, $value = null, $lazy = false, $weak = false) + public function __construct(ServiceReferenceGraphNode $sourceNode, ServiceReferenceGraphNode $destNode, $value = null, $lazy = false, $weak = false, $byConstructor = false) { $this->sourceNode = $sourceNode; $this->destNode = $destNode; $this->value = $value; $this->lazy = $lazy; $this->weak = $weak; + $this->byConstructor = $byConstructor; } /** @@ -91,4 +94,14 @@ public function isWeak() { return $this->weak; } + + /** + * Returns true if the edge links with a constructor argument. + * + * @return bool + */ + public function isReferencedByConstructor() + { + return $this->byConstructor; + } } diff --git a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php index 1052d2c6a..36b99f1a8 100644 --- a/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php +++ b/vendor/symfony/dependency-injection/Compiler/ServiceReferenceGraphNode.php @@ -11,8 +11,8 @@ namespace Symfony\Component\DependencyInjection\Compiler; -use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\DependencyInjection\Definition; /** * Represents a node in your service graph. diff --git a/vendor/symfony/dependency-injection/Container.php b/vendor/symfony/dependency-injection/Container.php index 5ca9b25ad..4d3e3883d 100644 --- a/vendor/symfony/dependency-injection/Container.php +++ b/vendor/symfony/dependency-injection/Container.php @@ -14,11 +14,11 @@ use Symfony\Component\DependencyInjection\Exception\EnvNotFoundException; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException; -use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; +use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; /** * Container is a dependency injection container. @@ -294,7 +294,7 @@ public function get($id, $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERE } if (isset($this->loading[$id])) { - throw new ServiceCircularReferenceException($id, array_keys($this->loading)); + throw new ServiceCircularReferenceException($id, array_merge(array_keys($this->loading), array($id))); } $this->loading[$id] = true; @@ -340,7 +340,7 @@ public function get($id, $invalidBehavior = /* self::EXCEPTION_ON_INVALID_REFERE $alternatives = array(); foreach ($this->getServiceIds() as $knownId) { $lev = levenshtein($id, $knownId); - if ($lev <= strlen($id) / 3 || false !== strpos($knownId, $id)) { + if ($lev <= \strlen($id) / 3 || false !== strpos($knownId, $id)) { $alternatives[] = $knownId; } } diff --git a/vendor/symfony/dependency-injection/ContainerAwareInterface.php b/vendor/symfony/dependency-injection/ContainerAwareInterface.php index d78491bb9..e7b9d575e 100644 --- a/vendor/symfony/dependency-injection/ContainerAwareInterface.php +++ b/vendor/symfony/dependency-injection/ContainerAwareInterface.php @@ -18,5 +18,8 @@ */ interface ContainerAwareInterface { + /** + * Sets the container. + */ public function setContainer(ContainerInterface $container = null); } diff --git a/vendor/symfony/dependency-injection/ContainerBuilder.php b/vendor/symfony/dependency-injection/ContainerBuilder.php index 7f79e2f4f..5fe6f2ae6 100644 --- a/vendor/symfony/dependency-injection/ContainerBuilder.php +++ b/vendor/symfony/dependency-injection/ContainerBuilder.php @@ -12,6 +12,14 @@ namespace Symfony\Component\DependencyInjection; use Psr\Container\ContainerInterface as PsrContainerInterface; +use Symfony\Component\Config\Resource\ClassExistenceResource; +use Symfony\Component\Config\Resource\ComposerResource; +use Symfony\Component\Config\Resource\DirectoryResource; +use Symfony\Component\Config\Resource\FileExistenceResource; +use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Config\Resource\GlobResource; +use Symfony\Component\Config\Resource\ReflectionClassResource; +use Symfony\Component\Config\Resource\ResourceInterface; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; @@ -26,18 +34,10 @@ use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\Extension\ExtensionInterface; -use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -use Symfony\Component\Config\Resource\ClassExistenceResource; -use Symfony\Component\Config\Resource\ComposerResource; -use Symfony\Component\Config\Resource\DirectoryResource; -use Symfony\Component\Config\Resource\FileExistenceResource; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Resource\GlobResource; -use Symfony\Component\Config\Resource\ReflectionClassResource; -use Symfony\Component\Config\Resource\ResourceInterface; use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\InstantiatorInterface; use Symfony\Component\DependencyInjection\LazyProxy\Instantiator\RealServiceInstantiator; +use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; use Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher; use Symfony\Component\ExpressionLanguage\Expression; @@ -122,7 +122,6 @@ class ContainerBuilder extends Container implements TaggedContainerInterface private $autoconfiguredInstanceof = array(); private $removedIds = array(); - private $alreadyLoading = array(); private static $internalTypes = array( 'int' => true, @@ -293,8 +292,8 @@ public function setResources(array $resources) public function addObjectResource($object) { if ($this->trackResources) { - if (is_object($object)) { - $object = get_class($object); + if (\is_object($object)) { + $object = \get_class($object); } if (!isset($this->classReflectors[$object])) { $this->classReflectors[$object] = new \ReflectionClass($object); @@ -365,11 +364,11 @@ public function getReflectionClass($class, $throw = true) try { if (isset($this->classReflectors[$class])) { $classReflector = $this->classReflectors[$class]; - } elseif ($this->trackResources) { + } elseif (class_exists(ClassExistenceResource::class)) { $resource = new ClassExistenceResource($class, false); $classReflector = $resource->isFresh(0) ? false : new \ReflectionClass($class); } else { - $classReflector = new \ReflectionClass($class); + $classReflector = class_exists($class) ? new \ReflectionClass($class) : false; } } catch (\ReflectionException $e) { if ($throw) { @@ -421,7 +420,7 @@ public function fileExists($path, $trackContents = true) if (is_dir($path)) { if ($trackContents) { - $this->addResource(new DirectoryResource($path, is_string($trackContents) ? $trackContents : null)); + $this->addResource(new DirectoryResource($path, \is_string($trackContents) ? $trackContents : null)); } else { $this->addResource(new GlobResource($path, '/*', false)); } @@ -449,7 +448,7 @@ public function loadFromExtension($extension, array $values = null) throw new BadMethodCallException('Cannot load from an extension on a compiled container.'); } - if (func_num_args() < 2) { + if (\func_num_args() < 2) { $values = array(); } @@ -471,10 +470,10 @@ public function loadFromExtension($extension, array $values = null) */ public function addCompilerPass(CompilerPassInterface $pass, $type = PassConfig::TYPE_BEFORE_OPTIMIZATION/*, int $priority = 0*/) { - if (func_num_args() >= 3) { + if (\func_num_args() >= 3) { $priority = func_get_arg(2); } else { - if (__CLASS__ !== get_class($this)) { + if (__CLASS__ !== \get_class($this)) { $r = new \ReflectionMethod($this, __FUNCTION__); if (__CLASS__ !== $r->getDeclaringClass()->getName()) { @trigger_error(sprintf('Method %s() will have a third `int $priority = 0` argument in version 4.0. Not defining it is deprecated since Symfony 3.2.', __METHOD__), E_USER_DEPRECATED); @@ -588,22 +587,32 @@ public function get($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INV return $this->doGet($id, $invalidBehavior); } - private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, array &$inlineServices = array()) + private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, array &$inlineServices = null, $isConstructorArgument = false) { $id = $this->normalizeId($id); if (isset($inlineServices[$id])) { return $inlineServices[$id]; } - if (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $invalidBehavior) { - return parent::get($id, $invalidBehavior); + if (null === $inlineServices) { + $isConstructorArgument = true; + $inlineServices = array(); } - if ($service = parent::get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)) { - return $service; + try { + if (ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $invalidBehavior) { + return parent::get($id, $invalidBehavior); + } + if ($service = parent::get($id, ContainerInterface::NULL_ON_INVALID_REFERENCE)) { + return $service; + } + } catch (ServiceCircularReferenceException $e) { + if ($isConstructorArgument) { + throw $e; + } } if (!isset($this->definitions[$id]) && isset($this->aliasDefinitions[$id])) { - return $this->doGet((string) $this->aliasDefinitions[$id], $invalidBehavior, $inlineServices); + return $this->doGet((string) $this->aliasDefinitions[$id], $invalidBehavior, $inlineServices, $isConstructorArgument); } try { @@ -616,16 +625,17 @@ private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_ throw $e; } - $loading = isset($this->alreadyLoading[$id]) ? 'loading' : 'alreadyLoading'; - $this->{$loading}[$id] = true; + if ($isConstructorArgument) { + $this->loading[$id] = true; + } try { - $service = $this->createService($definition, $inlineServices, $id); + return $this->createService($definition, $inlineServices, $isConstructorArgument, $id); } finally { - unset($this->{$loading}[$id]); + if ($isConstructorArgument) { + unset($this->loading[$id]); + } } - - return $service; } /** @@ -637,10 +647,10 @@ private function doGet($id, $invalidBehavior = ContainerInterface::EXCEPTION_ON_ * the parameters passed to the container constructor to have precedence * over the loaded ones. * - * $container = new ContainerBuilder(array('foo' => 'bar')); - * $loader = new LoaderXXX($container); - * $loader->load('resource_name'); - * $container->register('foo', new stdClass()); + * $container = new ContainerBuilder(new ParameterBag(array('foo' => 'bar'))); + * $loader = new LoaderXXX($container); + * $loader->load('resource_name'); + * $container->register('foo', 'stdClass'); * * In the above example, even if the loaded resource defines a foo * parameter, the value will still be 'bar' as defined in the ContainerBuilder @@ -751,7 +761,7 @@ public function prependExtensionConfig($name, array $config) */ public function compile(/*$resolveEnvPlaceholders = false*/) { - if (1 <= func_num_args()) { + if (1 <= \func_num_args()) { $resolveEnvPlaceholders = func_get_arg(0); } else { if (__CLASS__ !== static::class) { @@ -856,7 +866,7 @@ public function setAlias($alias, $id) { $alias = $this->normalizeId($alias); - if (is_string($id)) { + if (\is_string($id)) { $id = new Alias($this->normalizeId($id)); } elseif (!$id instanceof Alias) { throw new InvalidArgumentException('$id must be a string, or an Alias object.'); @@ -949,7 +959,7 @@ public function register($id, $class = null) * an autowired definition. * * @param string $id The service identifier - * @param null|string $class The service class + * @param string|null $class The service class * * @return Definition The created definition */ @@ -1067,7 +1077,7 @@ public function findDefinition($id) if (isset($seen[$id])) { $seen = array_values($seen); - $seen = array_slice($seen, array_search($id, $seen)); + $seen = \array_slice($seen, array_search($id, $seen)); $seen[] = $id; throw new ServiceCircularReferenceException($id, $seen); @@ -1092,7 +1102,7 @@ public function findDefinition($id) * @throws RuntimeException When the service is a synthetic service * @throws InvalidArgumentException When configure callable is not callable */ - private function createService(Definition $definition, array &$inlineServices, $id = null, $tryProxy = true) + private function createService(Definition $definition, array &$inlineServices, $isConstructorArgument = false, $id = null, $tryProxy = true) { if (null === $id && isset($inlineServices[$h = spl_object_hash($definition)])) { return $inlineServices[$h]; @@ -1110,16 +1120,14 @@ private function createService(Definition $definition, array &$inlineServices, $ @trigger_error($definition->getDeprecationMessage($id), E_USER_DEPRECATED); } - if ($tryProxy && $definition->isLazy()) { - $proxy = $this - ->getProxyInstantiator() - ->instantiateProxy( - $this, - $definition, - $id, function () use ($definition, &$inlineServices, $id) { - return $this->createService($definition, $inlineServices, $id, false); - } - ); + if ($tryProxy && $definition->isLazy() && !$tryProxy = !($proxy = $this->proxyInstantiator) || $proxy instanceof RealServiceInstantiator) { + $proxy = $proxy->instantiateProxy( + $this, + $definition, + $id, function () use ($definition, &$inlineServices, $id) { + return $this->createService($definition, $inlineServices, true, $id, false); + } + ); $this->shareService($definition, $proxy, $id, $inlineServices); return $proxy; @@ -1131,22 +1139,24 @@ private function createService(Definition $definition, array &$inlineServices, $ require_once $parameterBag->resolveValue($definition->getFile()); } - $arguments = $this->doResolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments())), $inlineServices); - - if (null !== $id && $definition->isShared() && isset($this->services[$id]) && ($tryProxy || !$definition->isLazy())) { - return $this->services[$id]; - } + $arguments = $this->doResolveServices($parameterBag->unescapeValue($parameterBag->resolveValue($definition->getArguments())), $inlineServices, $isConstructorArgument); if (null !== $factory = $definition->getFactory()) { - if (is_array($factory)) { - $factory = array($this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices), $factory[1]); - } elseif (!is_string($factory)) { + if (\is_array($factory)) { + $factory = array($this->doResolveServices($parameterBag->resolveValue($factory[0]), $inlineServices, $isConstructorArgument), $factory[1]); + } elseif (!\is_string($factory)) { throw new RuntimeException(sprintf('Cannot create service "%s" because of invalid factory', $id)); } + } + + if (null !== $id && $definition->isShared() && isset($this->services[$id]) && ($tryProxy || !$definition->isLazy())) { + return $this->services[$id]; + } - $service = call_user_func_array($factory, $arguments); + if (null !== $factory) { + $service = \call_user_func_array($factory, $arguments); - if (!$definition->isDeprecated() && is_array($factory) && is_string($factory[0])) { + if (!$definition->isDeprecated() && \is_array($factory) && \is_string($factory[0])) { $r = new \ReflectionClass($factory[0]); if (0 < strpos($r->getDocComment(), "\n * @deprecated ")) { @@ -1181,7 +1191,7 @@ private function createService(Definition $definition, array &$inlineServices, $ } if ($callable = $definition->getConfigurator()) { - if (is_array($callable)) { + if (\is_array($callable)) { $callable[0] = $parameterBag->resolveValue($callable[0]); if ($callable[0] instanceof Reference) { @@ -1191,11 +1201,11 @@ private function createService(Definition $definition, array &$inlineServices, $ } } - if (!is_callable($callable)) { - throw new InvalidArgumentException(sprintf('The configure callable for class "%s" is not a callable.', get_class($service))); + if (!\is_callable($callable)) { + throw new InvalidArgumentException(sprintf('The configure callable for class "%s" is not a callable.', \get_class($service))); } - call_user_func($callable, $service); + \call_user_func($callable, $service); } return $service; @@ -1214,11 +1224,11 @@ public function resolveServices($value) return $this->doResolveServices($value); } - private function doResolveServices($value, array &$inlineServices = array()) + private function doResolveServices($value, array &$inlineServices = array(), $isConstructorArgument = false) { - if (is_array($value)) { + if (\is_array($value)) { foreach ($value as $k => $v) { - $value[$k] = $this->doResolveServices($v, $inlineServices); + $value[$k] = $this->doResolveServices($v, $inlineServices, $isConstructorArgument); } } elseif ($value instanceof ServiceClosureArgument) { $reference = $value->getValues()[0]; @@ -1261,9 +1271,9 @@ private function doResolveServices($value, array &$inlineServices = array()) return $count; }); } elseif ($value instanceof Reference) { - $value = $this->doGet((string) $value, $value->getInvalidBehavior(), $inlineServices); + $value = $this->doGet((string) $value, $value->getInvalidBehavior(), $inlineServices, $isConstructorArgument); } elseif ($value instanceof Definition) { - $value = $this->createService($value, $inlineServices); + $value = $this->createService($value, $inlineServices, $isConstructorArgument); } elseif ($value instanceof Parameter) { $value = $this->getParameter((string) $value); } elseif ($value instanceof Expression) { @@ -1278,14 +1288,14 @@ private function doResolveServices($value, array &$inlineServices = array()) * * Example: * - * $container->register('foo')->addTag('my.tag', array('hello' => 'world')); + * $container->register('foo')->addTag('my.tag', array('hello' => 'world')); * - * $serviceIds = $container->findTaggedServiceIds('my.tag'); - * foreach ($serviceIds as $serviceId => $tags) { - * foreach ($tags as $tag) { - * echo $tag['hello']; + * $serviceIds = $container->findTaggedServiceIds('my.tag'); + * foreach ($serviceIds as $serviceId => $tags) { + * foreach ($tags as $tag) { + * echo $tag['hello']; + * } * } - * } * * @param string $name * @param bool $throwOnAbstract @@ -1408,6 +1418,7 @@ public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs } $envPlaceholders = $bag instanceof EnvPlaceholderParameterBag ? $bag->getEnvPlaceholders() : $this->envPlaceholders; + $completed = false; foreach ($envPlaceholders as $env => $placeholders) { foreach ($placeholders as $placeholder) { if (false !== stripos($value, $placeholder)) { @@ -1418,14 +1429,19 @@ public function resolveEnvPlaceholders($value, $format = null, array &$usedEnvs } if ($placeholder === $value) { $value = $resolved; + $completed = true; } else { - if (!is_string($resolved) && !is_numeric($resolved)) { - throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type %s inside string value "%s".', $env, gettype($resolved), $value)); + if (!\is_string($resolved) && !is_numeric($resolved)) { + throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "env(%s)" of type %s inside string value "%s".', $env, \gettype($resolved), $this->resolveEnvPlaceholders($value))); } $value = str_ireplace($placeholder, $resolved, $value); } $usedEnvs[$env] = $env; $this->envCounters[$env] = isset($this->envCounters[$env]) ? 1 + $this->envCounters[$env] : 1; + + if ($completed) { + break 2; + } } } } @@ -1473,7 +1489,7 @@ public function getNormalizedIds() */ public function log(CompilerPassInterface $pass, $message) { - $this->getCompiler()->log($pass, $message); + $this->getCompiler()->log($pass, $this->resolveEnvPlaceholders($message)); } /** @@ -1501,7 +1517,7 @@ public static function getServiceConditionals($value) { $services = array(); - if (is_array($value)) { + if (\is_array($value)) { foreach ($value as $v) { $services = array_unique(array_merge($services, self::getServiceConditionals($v))); } @@ -1525,7 +1541,7 @@ public static function getInitializedConditionals($value) { $services = array(); - if (is_array($value)) { + if (\is_array($value)) { foreach ($value as $v) { $services = array_unique(array_merge($services, self::getInitializedConditionals($v))); } @@ -1558,7 +1574,7 @@ protected function getEnv($name) $value = parent::getEnv($name); $bag = $this->getParameterBag(); - if (!is_string($value) || !$bag instanceof EnvPlaceholderParameterBag) { + if (!\is_string($value) || !$bag instanceof EnvPlaceholderParameterBag) { return $value; } @@ -1578,20 +1594,6 @@ protected function getEnv($name) } } - /** - * Retrieves the currently set proxy instantiator or instantiates one. - * - * @return InstantiatorInterface - */ - private function getProxyInstantiator() - { - if (!$this->proxyInstantiator) { - $this->proxyInstantiator = new RealServiceInstantiator(); - } - - return $this->proxyInstantiator; - } - private function callMethod($service, $call, array &$inlineServices) { foreach (self::getServiceConditionals($call[1]) as $s) { @@ -1605,7 +1607,7 @@ private function callMethod($service, $call, array &$inlineServices) } } - call_user_func_array(array($service, $call[0]), $this->doResolveServices($this->getParameterBag()->unescapeValue($this->getParameterBag()->resolveValue($call[1])), $inlineServices)); + \call_user_func_array(array($service, $call[0]), $this->doResolveServices($this->getParameterBag()->unescapeValue($this->getParameterBag()->resolveValue($call[1])), $inlineServices)); } /** @@ -1621,7 +1623,7 @@ private function shareService(Definition $definition, $service, $id, array &$inl if (null !== $id && $definition->isShared()) { $this->services[$id] = $service; - unset($this->loading[$id], $this->alreadyLoading[$id]); + unset($this->loading[$id]); } } @@ -1647,7 +1649,7 @@ private function inVendors($path) $path = realpath($path) ?: $path; foreach ($this->vendors as $vendor) { - if (0 === strpos($path, $vendor) && false !== strpbrk(substr($path, strlen($vendor), 1), '/'.DIRECTORY_SEPARATOR)) { + if (0 === strpos($path, $vendor) && false !== strpbrk(substr($path, \strlen($vendor), 1), '/'.\DIRECTORY_SEPARATOR)) { return true; } } diff --git a/vendor/symfony/dependency-injection/Definition.php b/vendor/symfony/dependency-injection/Definition.php index 99f2d6a22..849d617a1 100644 --- a/vendor/symfony/dependency-injection/Definition.php +++ b/vendor/symfony/dependency-injection/Definition.php @@ -97,7 +97,7 @@ public function setFactory($factory) { $this->changes['factory'] = true; - if (is_string($factory) && false !== strpos($factory, '::')) { + if (\is_string($factory) && false !== strpos($factory, '::')) { $factory = explode('::', $factory, 2); } @@ -109,7 +109,7 @@ public function setFactory($factory) /** * Gets the factory. * - * @return string|array The PHP function or an array containing a class/Reference and a method to call + * @return string|array|null The PHP function or an array containing a class/Reference and a method to call */ public function getFactory() { @@ -119,8 +119,8 @@ public function getFactory() /** * Sets the service that this service is decorating. * - * @param null|string $id The decorated service id, use null to remove decoration - * @param null|string $renamedId The new decorated service id + * @param string|null $id The decorated service id, use null to remove decoration + * @param string|null $renamedId The new decorated service id * @param int $priority The priority of decoration * * @return $this @@ -147,7 +147,7 @@ public function setDecoratedService($id, $renamedId = null, $priority = 0) /** * Gets the service that this service is decorating. * - * @return null|array An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated + * @return array|null An array composed of the decorated service id, the new id for it and the priority of decoration, null if no service is decorated */ public function getDecoratedService() { @@ -255,12 +255,12 @@ public function addArgument($argument) */ public function replaceArgument($index, $argument) { - if (0 === count($this->arguments)) { + if (0 === \count($this->arguments)) { throw new OutOfBoundsException('Cannot replace arguments if none have been configured yet.'); } - if (is_int($index) && ($index < 0 || $index > count($this->arguments) - 1)) { - throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, count($this->arguments) - 1)); + if (\is_int($index) && ($index < 0 || $index > \count($this->arguments) - 1)) { + throw new OutOfBoundsException(sprintf('The index "%d" is not in the range [0, %d].', $index, \count($this->arguments) - 1)); } if (!array_key_exists($index, $this->arguments)) { @@ -400,7 +400,7 @@ public function getMethodCalls() /** * Sets the definition templates to conditionally apply on the current definition, keyed by parent interface/class. * - * @param $instanceof ChildDefinition[] + * @param ChildDefinition[] $instanceof * * @return $this */ @@ -784,7 +784,7 @@ public function setConfigurator($configurator) { $this->changes['configurator'] = true; - if (is_string($configurator) && false !== strpos($configurator, '::')) { + if (\is_string($configurator) && false !== strpos($configurator, '::')) { $configurator = explode('::', $configurator, 2); } @@ -860,7 +860,7 @@ public function setAutowired($autowired) */ public function getAutowiringTypes(/*$triggerDeprecation = true*/) { - if (1 > func_num_args() || func_get_arg(0)) { + if (1 > \func_num_args() || func_get_arg(0)) { @trigger_error('Autowiring-types are deprecated since Symfony 3.3 and will be removed in 4.0. Use aliases instead.', E_USER_DEPRECATED); } diff --git a/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php b/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php index b41bf7e0d..2105d1d40 100644 --- a/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php +++ b/vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php @@ -12,12 +12,12 @@ namespace Symfony\Component\DependencyInjection\Dumper; use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; -use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Parameter; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\DependencyInjection\Reference; /** * GraphvizDumper dumps a service container as a graphviz file. @@ -133,7 +133,7 @@ private function findEdges($id, array $arguments, $required, $name, $lazy = fals foreach ($arguments as $argument) { if ($argument instanceof Parameter) { $argument = $this->container->hasParameter($argument) ? $this->container->getParameter($argument) : null; - } elseif (is_string($argument) && preg_match('/^%([^%]+)%$/', $argument, $match)) { + } elseif (\is_string($argument) && preg_match('/^%([^%]+)%$/', $argument, $match)) { $argument = $this->container->hasParameter($match[1]) ? $this->container->getParameter($match[1]) : null; } @@ -149,7 +149,15 @@ private function findEdges($id, array $arguments, $required, $name, $lazy = fals $edges[] = array('name' => $name, 'required' => $required, 'to' => $argument, 'lazy' => $lazyEdge); } elseif ($argument instanceof ArgumentInterface) { $edges = array_merge($edges, $this->findEdges($id, $argument->getValues(), $required, $name, true)); - } elseif (is_array($argument)) { + } elseif ($argument instanceof Definition) { + $edges = array_merge($edges, + $this->findEdges($id, $argument->getArguments(), $required, ''), + $this->findEdges($id, $argument->getProperties(), false, '') + ); + foreach ($argument->getMethodCalls() as $call) { + $edges = array_merge($edges, $this->findEdges($id, $call[1], false, $call[0].'()')); + } + } elseif (\is_array($argument)) { $edges = array_merge($edges, $this->findEdges($id, $argument, $required, $name, $lazy)); } } @@ -190,7 +198,7 @@ private function findNodes() } if (!$container->hasDefinition($id)) { - $nodes[$id] = array('class' => str_replace('\\', '\\\\', get_class($container->get($id))), 'attributes' => $this->options['node.instance']); + $nodes[$id] = array('class' => str_replace('\\', '\\\\', \get_class($container->get($id))), 'attributes' => $this->options['node.instance']); } } diff --git a/vendor/symfony/dependency-injection/Dumper/PhpDumper.php b/vendor/symfony/dependency-injection/Dumper/PhpDumper.php index a92e11e50..fd7eec057 100644 --- a/vendor/symfony/dependency-injection/Dumper/PhpDumper.php +++ b/vendor/symfony/dependency-injection/Dumper/PhpDumper.php @@ -14,22 +14,23 @@ use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\Variable; -use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; -use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass; use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\TypedReference; -use Symfony\Component\DependencyInjection\Parameter; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\EnvParameterException; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; +use Symfony\Component\DependencyInjection\ExpressionLanguage; use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\DumperInterface as ProxyDumper; use Symfony\Component\DependencyInjection\LazyProxy\PhpDumper\NullDumper; -use Symfony\Component\DependencyInjection\ExpressionLanguage; +use Symfony\Component\DependencyInjection\Parameter; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\TypedReference; +use Symfony\Component\DependencyInjection\Variable; use Symfony\Component\ExpressionLanguage\Expression; use Symfony\Component\HttpKernel\Kernel; @@ -54,7 +55,9 @@ class PhpDumper extends Dumper private $definitionVariables; private $referenceVariables; private $variableCount; - private $reservedVariables = array('instance', 'class'); + private $inlinedDefinitions; + private $serviceCalls; + private $reservedVariables = array('instance', 'class', 'this'); private $expressionLanguage; private $targetDirRegex; private $targetDirMaxMatches; @@ -138,24 +141,41 @@ public function dump(array $options = array()) $this->initializeMethodNamesMap('Container' === $baseClass ? Container::class : $baseClass); - (new AnalyzeServiceReferencesPass())->process($this->container); + if ($this->getProxyDumper() instanceof NullDumper) { + (new AnalyzeServiceReferencesPass(true, false))->process($this->container); + try { + (new CheckCircularReferencesPass())->process($this->container); + } catch (ServiceCircularReferenceException $e) { + $path = $e->getPath(); + end($path); + $path[key($path)] .= '". Try running "composer require symfony/proxy-manager-bridge'; + + throw new ServiceCircularReferenceException($e->getServiceId(), $path); + } + } + + (new AnalyzeServiceReferencesPass(false, !$this->getProxyDumper() instanceof NullDumper))->process($this->container); $this->circularReferences = array(); - $checkedNodes = array(); - foreach ($this->container->getCompiler()->getServiceReferenceGraph()->getNodes() as $id => $node) { - $currentPath = array($id => $id); - $this->analyzeCircularReferences($node->getOutEdges(), $checkedNodes, $currentPath); + foreach (array(true, false) as $byConstructor) { + foreach ($this->container->getCompiler()->getServiceReferenceGraph()->getNodes() as $id => $node) { + if (!$node->getValue() instanceof Definition) { + continue; + } + $currentPath = array($id => true); + $this->analyzeCircularReferences($node->getOutEdges(), $currentPath, $id, $byConstructor); + } } $this->container->getCompiler()->getServiceReferenceGraph()->clear(); $this->docStar = $options['debug'] ? '*' : ''; - if (!empty($options['file']) && is_dir($dir = dirname($options['file']))) { + if (!empty($options['file']) && is_dir($dir = \dirname($options['file']))) { // Build a regexp where the first root dirs are mandatory, // but every other sub-dir is optional up to the full path in $dir // Mandate at least 2 root dirs and not more that 5 optional dirs. - $dir = explode(DIRECTORY_SEPARATOR, realpath($dir)); - $i = count($dir); + $dir = explode(\DIRECTORY_SEPARATOR, realpath($dir)); + $i = \count($dir); if (3 <= $i) { $regex = ''; @@ -163,11 +183,11 @@ public function dump(array $options = array()) $this->targetDirMaxMatches = $i - $lastOptionalDir; while (--$i >= $lastOptionalDir) { - $regex = sprintf('(%s%s)?', preg_quote(DIRECTORY_SEPARATOR.$dir[$i], '#'), $regex); + $regex = sprintf('(%s%s)?', preg_quote(\DIRECTORY_SEPARATOR.$dir[$i], '#'), $regex); } do { - $regex = preg_quote(DIRECTORY_SEPARATOR.$dir[$i], '#').$regex; + $regex = preg_quote(\DIRECTORY_SEPARATOR.$dir[$i], '#').$regex; } while (0 < --$i); $this->targetDirRegex = '#'.preg_quote($dir[0], '#').$regex.'#'; @@ -281,83 +301,31 @@ private function getProxyDumper() return $this->proxyDumper; } - /** - * Generates Service local temp variables. - * - * @return string - */ - private function addServiceLocalTempVariables($cId, Definition $definition, \SplObjectStorage $inlinedDefinitions, \SplObjectStorage $allInlinedDefinitions) + private function analyzeCircularReferences(array $edges, &$currentPath, $sourceId, $byConstructor) { - $allCalls = $calls = $behavior = array(); - - foreach ($allInlinedDefinitions as $def) { - $arguments = array($def->getArguments(), $def->getFactory(), $def->getProperties(), $def->getMethodCalls(), $def->getConfigurator()); - $this->getServiceCallsFromArguments($arguments, $allCalls, false, $cId, $behavior, $allInlinedDefinitions[$def]); - } - - $isPreInstance = isset($inlinedDefinitions[$definition]) && isset($this->circularReferences[$cId]) && !$this->getProxyDumper()->isProxyCandidate($definition) && $definition->isShared(); - foreach ($inlinedDefinitions as $def) { - $this->getServiceCallsFromArguments(array($def->getArguments(), $def->getFactory()), $calls, $isPreInstance, $cId); - if ($def !== $definition) { - $arguments = array($def->getProperties(), $def->getMethodCalls(), $def->getConfigurator()); - $this->getServiceCallsFromArguments($arguments, $calls, $isPreInstance && !$this->hasReference($cId, $arguments, true), $cId); - } - } - if (!isset($inlinedDefinitions[$definition])) { - $arguments = array($definition->getProperties(), $definition->getMethodCalls(), $definition->getConfigurator()); - $this->getServiceCallsFromArguments($arguments, $calls, false, $cId); - } - - $code = ''; - foreach ($calls as $id => $callCount) { - if ('service_container' === $id || $id === $cId || isset($this->referenceVariables[$id])) { - continue; - } - if ($callCount <= 1 && $allCalls[$id] <= 1) { + foreach ($edges as $edge) { + if ($byConstructor && !$edge->isReferencedByConstructor()) { continue; } - - $name = $this->getNextVariableName(); - $this->referenceVariables[$id] = new Variable($name); - - $reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $behavior[$id] ? new Reference($id, $behavior[$id]) : null; - $code .= sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($id, $reference)); - } - - if ('' !== $code) { - if ($isPreInstance) { - $code .= <<services['$cId'])) { - return \$this->services['$cId']; - } - -EOTXT; - } - - $code .= "\n"; - } - - return $code; - } - - private function analyzeCircularReferences(array $edges, &$checkedNodes, &$currentPath) - { - foreach ($edges as $edge) { $node = $edge->getDestNode(); $id = $node->getId(); - if ($node->getValue() && ($edge->isLazy() || $edge->isWeak())) { + if (!$node->getValue() instanceof Definition || $sourceId === $id || $edge->isLazy() || $edge->isWeak()) { // no-op } elseif (isset($currentPath[$id])) { + $currentId = $id; foreach (array_reverse($currentPath) as $parentId) { - $this->circularReferences[$parentId][$id] = $id; - $id = $parentId; + if (!isset($this->circularReferences[$parentId][$currentId])) { + $this->circularReferences[$parentId][$currentId] = $byConstructor; + } + if ($parentId === $id) { + break; + } + $currentId = $parentId; } - } elseif (!isset($checkedNodes[$id])) { - $checkedNodes[$id] = true; + } else { $currentPath[$id] = $id; - $this->analyzeCircularReferences($node->getOutEdges(), $checkedNodes, $currentPath); + $this->analyzeCircularReferences($node->getOutEdges(), $currentPath, $id, $byConstructor); unset($currentPath[$id]); } } @@ -396,6 +364,7 @@ private function collectLineage($class, array &$lineage) private function generateProxyClasses() { + $alreadyGenerated = array(); $definitions = $this->container->getDefinitions(); $strip = '' === $this->docStar && method_exists('Symfony\Component\HttpKernel\Kernel', 'stripComments'); $proxyDumper = $this->getProxyDumper(); @@ -404,9 +373,15 @@ private function generateProxyClasses() if (!$proxyDumper->isProxyCandidate($definition)) { continue; } + if (isset($alreadyGenerated[$class = $definition->getClass()])) { + continue; + } + $alreadyGenerated[$class] = true; // register class' reflector for resource tracking - $this->container->getReflectionClass($definition->getClass()); - $proxyCode = "\n".$proxyDumper->getProxyCode($definition); + $this->container->getReflectionClass($class); + if ("\n" === $proxyCode = "\n".$proxyDumper->getProxyCode($definition)) { + continue; + } if ($strip) { $proxyCode = "inlineRequires && !$this->isHotPath($definition)) { - $lineage = $calls = $behavior = array(); - foreach ($inlinedDefinitions as $def) { - if (!$def->isDeprecated() && is_string($class = is_array($factory = $def->getFactory()) && is_string($factory[0]) ? $factory[0] : $def->getClass())) { + $lineage = array(); + foreach ($this->inlinedDefinitions as $def) { + if (!$def->isDeprecated() && \is_string($class = \is_array($factory = $def->getFactory()) && \is_string($factory[0]) ? $factory[0] : $def->getClass())) { $this->collectLineage($class, $lineage); } - $arguments = array($def->getArguments(), $def->getFactory(), $def->getProperties(), $def->getMethodCalls(), $def->getConfigurator()); - $this->getServiceCallsFromArguments($arguments, $calls, false, $cId, $behavior, $inlinedDefinitions[$def]); } - foreach ($calls as $id => $callCount) { + foreach ($this->serviceCalls as $id => list($callCount, $behavior)) { if ('service_container' !== $id && $id !== $cId - && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE !== $behavior[$id] + && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE !== $behavior && $this->container->has($id) && $this->isTrivialInstance($def = $this->container->findDefinition($id)) - && is_string($class = is_array($factory = $def->getFactory()) && is_string($factory[0]) ? $factory[0] : $def->getClass()) + && \is_string($class = \is_array($factory = $def->getFactory()) && \is_string($factory[0]) ? $factory[0] : $def->getClass()) ) { $this->collectLineage($class, $lineage); } @@ -450,7 +423,7 @@ private function addServiceInclude($cId, Definition $definition, \SplObjectStora } } - foreach ($inlinedDefinitions as $def) { + foreach ($this->inlinedDefinitions as $def) { if ($file = $def->getFile()) { $code .= sprintf(" include_once %s;\n", $this->dumpValue($file)); } @@ -463,59 +436,6 @@ private function addServiceInclude($cId, Definition $definition, \SplObjectStora return $code; } - /** - * Generates the inline definition of a service. - * - * @return string - * - * @throws RuntimeException When the factory definition is incomplete - * @throws ServiceCircularReferenceException When a circular reference is detected - */ - private function addServiceInlinedDefinitions($id, Definition $definition, \SplObjectStorage $inlinedDefinitions, &$isSimpleInstance) - { - $code = ''; - - foreach ($inlinedDefinitions as $def) { - if ($definition === $def) { - continue; - } - if ($inlinedDefinitions[$def] <= 1 && !$def->getMethodCalls() && !$def->getProperties() && !$def->getConfigurator() && false === strpos($this->dumpValue($def->getClass()), '$')) { - continue; - } - if (isset($this->definitionVariables[$def])) { - $name = $this->definitionVariables[$def]; - } else { - $name = $this->getNextVariableName(); - $this->definitionVariables[$def] = new Variable($name); - } - - // a construct like: - // $a = new ServiceA(ServiceB $b); $b = new ServiceB(ServiceA $a); - // this is an indication for a wrong implementation, you can circumvent this problem - // by setting up your service structure like this: - // $b = new ServiceB(); - // $a = new ServiceA(ServiceB $b); - // $b->setServiceA(ServiceA $a); - if (isset($inlinedDefinition[$definition]) && $this->hasReference($id, array($def->getArguments(), $def->getFactory()))) { - throw new ServiceCircularReferenceException($id, array($id)); - } - - $code .= $this->addNewInstance($def, '$'.$name, ' = ', $id); - - if (!$this->hasReference($id, array($def->getProperties(), $def->getMethodCalls(), $def->getConfigurator()), true)) { - $code .= $this->addServiceProperties($def, $name); - $code .= $this->addServiceMethodCalls($def, $name); - $code .= $this->addServiceConfigurator($def, $name); - } else { - $isSimpleInstance = false; - } - - $code .= "\n"; - } - - return $code; - } - /** * Generates the service instance. * @@ -552,13 +472,7 @@ private function addServiceInstance($id, Definition $definition, $isSimpleInstan $instantiation .= ' = '; } - $code = $this->addNewInstance($definition, $return, $instantiation, $id); - - if (!$isSimpleInstance) { - $code .= "\n"; - } - - return $code; + return $this->addNewInstance($definition, $return, $instantiation, $id); } /** @@ -573,7 +487,7 @@ private function isTrivialInstance(Definition $definition) if ($definition->isSynthetic() || $definition->getFile() || $definition->getMethodCalls() || $definition->getProperties() || $definition->getConfigurator()) { return false; } - if ($definition->isDeprecated() || $definition->isLazy() || $definition->getFactory() || 3 < count($definition->getArguments())) { + if ($definition->isDeprecated() || $definition->isLazy() || $definition->getFactory() || 3 < \count($definition->getArguments())) { return false; } @@ -581,7 +495,7 @@ private function isTrivialInstance(Definition $definition) if (!$arg || $arg instanceof Parameter) { continue; } - if (is_array($arg) && 3 >= count($arg)) { + if (\is_array($arg) && 3 >= \count($arg)) { foreach ($arg as $k => $v) { if ($this->dumpValue($k) !== $this->dumpValue($k, false)) { return false; @@ -603,10 +517,6 @@ private function isTrivialInstance(Definition $definition) } } - if (false !== strpos($this->dumpLiteralClass($this->dumpValue($definition->getClass())), '$')) { - return false; - } - return true; } @@ -643,42 +553,6 @@ private function addServiceProperties(Definition $definition, $variableName = 'i return $code; } - /** - * Generates the inline definition setup. - * - * @return string - * - * @throws ServiceCircularReferenceException when the container contains a circular reference - */ - private function addServiceInlinedDefinitionsSetup($id, Definition $definition, \SplObjectStorage $inlinedDefinitions, $isSimpleInstance) - { - $this->referenceVariables[$id] = new Variable('instance'); - - $code = ''; - foreach ($inlinedDefinitions as $def) { - if ($definition === $def || !$this->hasReference($id, array($def->getProperties(), $def->getMethodCalls(), $def->getConfigurator()), true)) { - continue; - } - - // if the instance is simple, the return statement has already been generated - // so, the only possible way to get there is because of a circular reference - if ($isSimpleInstance) { - throw new ServiceCircularReferenceException($id, array($id)); - } - - $name = (string) $this->definitionVariables[$def]; - $code .= $this->addServiceProperties($def, $name); - $code .= $this->addServiceMethodCalls($def, $name); - $code .= $this->addServiceConfigurator($def, $name); - } - - if ('' !== $code && ($definition->getProperties() || $definition->getMethodCalls() || $definition->getConfigurator())) { - $code .= "\n"; - } - - return $code; - } - /** * Adds configurator definition. * @@ -693,7 +567,7 @@ private function addServiceConfigurator(Definition $definition, $variableName = return ''; } - if (is_array($callable)) { + if (\is_array($callable)) { if ($callable[0] instanceof Reference || ($callable[0] instanceof Definition && $this->definitionVariables->contains($callable[0]))) { return sprintf(" %s->%s(\$%s);\n", $this->dumpValue($callable[0]), $callable[1], $variableName); @@ -729,27 +603,26 @@ private function addService($id, Definition $definition, &$file = null) $this->definitionVariables = new \SplObjectStorage(); $this->referenceVariables = array(); $this->variableCount = 0; + $this->referenceVariables[$id] = new Variable('instance'); $return = array(); if ($class = $definition->getClass()) { - $class = $this->container->resolveEnvPlaceholders($class); + $class = $class instanceof Parameter ? '%'.$class.'%' : $this->container->resolveEnvPlaceholders($class); $return[] = sprintf(0 === strpos($class, '%') ? '@return object A %1$s instance' : '@return \%s', ltrim($class, '\\')); } elseif ($definition->getFactory()) { $factory = $definition->getFactory(); - if (is_string($factory)) { + if (\is_string($factory)) { $return[] = sprintf('@return object An instance returned by %s()', $factory); - } elseif (is_array($factory) && (is_string($factory[0]) || $factory[0] instanceof Definition || $factory[0] instanceof Reference)) { - if (is_string($factory[0]) || $factory[0] instanceof Reference) { - $return[] = sprintf('@return object An instance returned by %s::%s()', (string) $factory[0], $factory[1]); - } elseif ($factory[0] instanceof Definition) { - $return[] = sprintf('@return object An instance returned by %s::%s()', $factory[0]->getClass(), $factory[1]); - } + } elseif (\is_array($factory) && (\is_string($factory[0]) || $factory[0] instanceof Definition || $factory[0] instanceof Reference)) { + $class = $factory[0] instanceof Definition ? $factory[0]->getClass() : (string) $factory[0]; + $class = $class instanceof Parameter ? '%'.$class.'%' : $this->container->resolveEnvPlaceholders($class); + $return[] = sprintf('@return object An instance returned by %s::%s()', $class, $factory[1]); } } if ($definition->isDeprecated()) { - if ($return && 0 === strpos($return[count($return) - 1], '@return')) { + if ($return && 0 === strpos($return[\count($return) - 1], '@return')) { $return[] = ''; } @@ -788,6 +661,11 @@ protected function {$methodName}($lazyInitialization) EOF; } + $this->serviceCalls = array(); + $this->inlinedDefinitions = $this->getDefinitionsFromArguments(array($definition), null, $this->serviceCalls); + + $code .= $this->addServiceInclude($id, $definition); + if ($this->getProxyDumper()->isProxyCandidate($definition)) { $factoryCode = $asFile ? "\$this->load('%s.php', false)" : '$this->%s(false)'; $code .= $this->getProxyDumper()->getProxyFactoryCode($definition, $id, sprintf($factoryCode, $methodName)); @@ -797,42 +675,131 @@ protected function {$methodName}($lazyInitialization) $code .= sprintf(" @trigger_error(%s, E_USER_DEPRECATED);\n\n", $this->export($definition->getDeprecationMessage($id))); } - $inlinedDefinitions = $this->getDefinitionsFromArguments(array($definition)); - $constructorDefinitions = $this->getDefinitionsFromArguments(array($definition->getArguments(), $definition->getFactory())); - $otherDefinitions = new \SplObjectStorage(); + $code .= $this->addInlineService($id, $definition); - foreach ($inlinedDefinitions as $def) { - if ($def === $definition || isset($constructorDefinitions[$def])) { - $constructorDefinitions[$def] = $inlinedDefinitions[$def]; - } else { - $otherDefinitions[$def] = $inlinedDefinitions[$def]; + if ($asFile) { + $code = implode("\n", array_map(function ($line) { return $line ? substr($line, 8) : $line; }, explode("\n", $code))); + } else { + $code .= " }\n"; + } + + $this->definitionVariables = $this->inlinedDefinitions = null; + $this->referenceVariables = $this->serviceCalls = null; + + return $code; + } + + private function addInlineVariables($id, Definition $definition, array $arguments, $forConstructor) + { + $code = ''; + + foreach ($arguments as $argument) { + if (\is_array($argument)) { + $code .= $this->addInlineVariables($id, $definition, $argument, $forConstructor); + } elseif ($argument instanceof Reference) { + $code .= $this->addInlineReference($id, $definition, $this->container->normalizeId($argument), $forConstructor); + } elseif ($argument instanceof Definition) { + $code .= $this->addInlineService($id, $definition, $argument, $forConstructor); } } - $isSimpleInstance = !$definition->getProperties() && !$definition->getMethodCalls() && !$definition->getConfigurator(); + return $code; + } - $code .= - $this->addServiceInclude($id, $definition, $inlinedDefinitions). - $this->addServiceLocalTempVariables($id, $definition, $constructorDefinitions, $inlinedDefinitions). - $this->addServiceInlinedDefinitions($id, $definition, $constructorDefinitions, $isSimpleInstance). - $this->addServiceInstance($id, $definition, $isSimpleInstance). - $this->addServiceLocalTempVariables($id, $definition, $otherDefinitions, $inlinedDefinitions). - $this->addServiceInlinedDefinitions($id, $definition, $otherDefinitions, $isSimpleInstance). - $this->addServiceInlinedDefinitionsSetup($id, $definition, $inlinedDefinitions, $isSimpleInstance). - $this->addServiceProperties($definition). - $this->addServiceMethodCalls($definition). - $this->addServiceConfigurator($definition). - (!$isSimpleInstance ? "\n return \$instance;\n" : '') - ; + private function addInlineReference($id, Definition $definition, $targetId, $forConstructor) + { + list($callCount, $behavior) = $this->serviceCalls[$targetId]; - if ($asFile) { - $code = implode("\n", array_map(function ($line) { return $line ? substr($line, 8) : $line; }, explode("\n", $code))); + while ($this->container->hasAlias($targetId)) { + $targetId = (string) $this->container->getAlias($targetId); + } + + if ($id === $targetId) { + return $this->addInlineService($id, $definition, $definition); + } + + if ('service_container' === $targetId || isset($this->referenceVariables[$targetId])) { + return ''; + } + + $hasSelfRef = isset($this->circularReferences[$id][$targetId]); + $forConstructor = $forConstructor && !isset($this->definitionVariables[$definition]); + $code = $hasSelfRef && $this->circularReferences[$id][$targetId] && !$forConstructor ? $this->addInlineService($id, $definition, $definition) : ''; + + if (isset($this->referenceVariables[$targetId]) || (2 > $callCount && (!$hasSelfRef || !$forConstructor))) { + return $code; + } + + $name = $this->getNextVariableName(); + $this->referenceVariables[$targetId] = new Variable($name); + + $reference = ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE >= $behavior ? new Reference($targetId, $behavior) : null; + $code .= sprintf(" \$%s = %s;\n", $name, $this->getServiceCall($targetId, $reference)); + + if (!$hasSelfRef || !$forConstructor) { + return $code; + } + + $code .= sprintf(<<<'EOTXT' + + if (isset($this->%s['%s'])) { + return $this->%1$s['%2$s']; + } + +EOTXT + , + 'services', + $id + ); + + return $code; + } + + private function addInlineService($id, Definition $definition, Definition $inlineDef = null, $forConstructor = true) + { + $isSimpleInstance = $isRootInstance = null === $inlineDef; + + if (isset($this->definitionVariables[$inlineDef = $inlineDef ?: $definition])) { + return ''; + } + + $arguments = array($inlineDef->getArguments(), $inlineDef->getFactory()); + + $code = $this->addInlineVariables($id, $definition, $arguments, $forConstructor); + + if ($arguments = array_filter(array($inlineDef->getProperties(), $inlineDef->getMethodCalls(), $inlineDef->getConfigurator()))) { + $isSimpleInstance = false; + } elseif ($definition !== $inlineDef && 2 > $this->inlinedDefinitions[$inlineDef]) { + return $code; + } + + if (isset($this->definitionVariables[$inlineDef])) { + $isSimpleInstance = false; } else { - $code .= " }\n"; + $name = $definition === $inlineDef ? 'instance' : $this->getNextVariableName(); + $this->definitionVariables[$inlineDef] = new Variable($name); + $code .= '' !== $code ? "\n" : ''; + + if ('instance' === $name) { + $code .= $this->addServiceInstance($id, $definition, $isSimpleInstance); + } else { + $code .= $this->addNewInstance($inlineDef, '$'.$name, ' = ', $id); + } + + if ('' !== $inline = $this->addInlineVariables($id, $definition, $arguments, false)) { + $code .= "\n".$inline."\n"; + } elseif ($arguments && 'instance' === $name) { + $code .= "\n"; + } + + $code .= $this->addServiceProperties($inlineDef, $name); + $code .= $this->addServiceMethodCalls($inlineDef, $name); + $code .= $this->addServiceConfigurator($inlineDef, $name); } - $this->definitionVariables = null; - $this->referenceVariables = null; + if ($isRootInstance && !$isSimpleInstance) { + $code .= "\n return \$instance;\n"; + } return $code; } @@ -885,7 +852,7 @@ private function addNewInstance(Definition $definition, $return, $instantiation, if (null !== $definition->getFactory()) { $callable = $definition->getFactory(); - if (is_array($callable)) { + if (\is_array($callable)) { if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $callable[1])) { throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s)', $callable[1] ?: 'n/a')); } @@ -1133,6 +1100,9 @@ private function addRemovedIds() $ids = array_keys($ids); sort($ids); foreach ($ids as $id) { + if (preg_match('/^\d+_[^~]++~[._a-zA-Z\d]{7}$/', $id)) { + continue; + } $code .= ' '.$this->doExport($id)." => true,\n"; } @@ -1260,7 +1230,7 @@ private function addInlineRequires() $inlinedDefinitions = $this->getDefinitionsFromArguments(array($definition)); foreach ($inlinedDefinitions as $def) { - if (is_string($class = is_array($factory = $def->getFactory()) && is_string($factory[0]) ? $factory[0] : $def->getClass())) { + if (\is_string($class = \is_array($factory = $def->getFactory()) && \is_string($factory[0]) ? $factory[0] : $def->getClass())) { $this->collectLineage($class, $lineage); } } @@ -1373,7 +1343,7 @@ public function getParameterBag() } if ($dynamicPhp) { - $loadedDynamicParameters = $this->exportParameters(array_combine(array_keys($dynamicPhp), array_fill(0, count($dynamicPhp), false)), '', 8); + $loadedDynamicParameters = $this->exportParameters(array_combine(array_keys($dynamicPhp), array_fill(0, \count($dynamicPhp), false)), '', 8); $getDynamicParameter = <<<'EOF' switch ($name) { %s @@ -1397,7 +1367,7 @@ public function getParameterBag() /*{$this->docStar} * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string \$name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * @@ -1465,10 +1435,10 @@ private function exportParameters(array $parameters, $path = '', $indent = 12) { $php = array(); foreach ($parameters as $key => $value) { - if (is_array($value)) { + if (\is_array($value)) { $value = $this->exportParameters($value, $path.'/'.$key, $indent + 4); } elseif ($value instanceof ArgumentInterface) { - throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain special arguments. "%s" found in "%s".', get_class($value), $path.'/'.$key)); + throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain special arguments. "%s" found in "%s".', \get_class($value), $path.'/'.$key)); } elseif ($value instanceof Variable) { throw new InvalidArgumentException(sprintf('You cannot dump a container with parameters that contain variable references. Variable "%s" found in "%s".', $value, $path.'/'.$key)); } elseif ($value instanceof Definition) { @@ -1525,7 +1495,7 @@ private function wrapServiceConditionals($value, $code) * * @param string $value * - * @return null|string + * @return string|null */ private function getServiceConditionals($value) { @@ -1551,117 +1521,39 @@ private function getServiceConditionals($value) return implode(' && ', $conditions); } - /** - * Builds service calls from arguments. - */ - private function getServiceCallsFromArguments(array $arguments, array &$calls, $isPreInstance, $callerId, array &$behavior = array(), $step = 1) + private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage $definitions = null, array &$calls = array()) { + if (null === $definitions) { + $definitions = new \SplObjectStorage(); + } + foreach ($arguments as $argument) { - if (is_array($argument)) { - $this->getServiceCallsFromArguments($argument, $calls, $isPreInstance, $callerId, $behavior, $step); + if (\is_array($argument)) { + $this->getDefinitionsFromArguments($argument, $definitions, $calls); } elseif ($argument instanceof Reference) { $id = $this->container->normalizeId($argument); if (!isset($calls[$id])) { - $calls[$id] = (int) ($isPreInstance && isset($this->circularReferences[$callerId][$id])); - } - if (!isset($behavior[$id])) { - $behavior[$id] = $argument->getInvalidBehavior(); + $calls[$id] = array(0, $argument->getInvalidBehavior()); } else { - $behavior[$id] = min($behavior[$id], $argument->getInvalidBehavior()); + $calls[$id][1] = min($calls[$id][1], $argument->getInvalidBehavior()); } - $calls[$id] += $step; - } - } - } - - private function getDefinitionsFromArguments(array $arguments, \SplObjectStorage $definitions = null) - { - if (null === $definitions) { - $definitions = new \SplObjectStorage(); - } - - foreach ($arguments as $argument) { - if (is_array($argument)) { - $this->getDefinitionsFromArguments($argument, $definitions); + ++$calls[$id][0]; } elseif (!$argument instanceof Definition) { // no-op } elseif (isset($definitions[$argument])) { $definitions[$argument] = 1 + $definitions[$argument]; } else { $definitions[$argument] = 1; - $this->getDefinitionsFromArguments($argument->getArguments(), $definitions); - $this->getDefinitionsFromArguments(array($argument->getFactory()), $definitions); - $this->getDefinitionsFromArguments($argument->getProperties(), $definitions); - $this->getDefinitionsFromArguments($argument->getMethodCalls(), $definitions); - $this->getDefinitionsFromArguments(array($argument->getConfigurator()), $definitions); - // move current definition last in the list - $nbOccurences = $definitions[$argument]; - unset($definitions[$argument]); - $definitions[$argument] = $nbOccurences; + $arguments = array($argument->getArguments(), $argument->getFactory(), $argument->getProperties(), $argument->getMethodCalls(), $argument->getConfigurator()); + $this->getDefinitionsFromArguments($arguments, $definitions, $calls); } } return $definitions; } - /** - * Checks if a service id has a reference. - * - * @param string $id - * @param array $arguments - * @param bool $deep - * @param array $visited - * - * @return bool - */ - private function hasReference($id, array $arguments, $deep = false, array &$visited = array()) - { - if (!isset($this->circularReferences[$id])) { - return false; - } - - foreach ($arguments as $argument) { - if (is_array($argument)) { - if ($this->hasReference($id, $argument, $deep, $visited)) { - return true; - } - - continue; - } elseif ($argument instanceof Reference) { - $argumentId = $this->container->normalizeId($argument); - if ($id === $argumentId) { - return true; - } - - if (!$deep || isset($visited[$argumentId]) || !isset($this->circularReferences[$id][$argumentId])) { - continue; - } - - $visited[$argumentId] = true; - - $service = $this->container->getDefinition($argumentId); - } elseif ($argument instanceof Definition) { - $service = $argument; - } else { - continue; - } - - // if the proxy manager is enabled, disable searching for references in lazy services, - // as these services will be instantiated lazily and don't have direct related references. - if ($service->isLazy() && !$this->getProxyDumper() instanceof NullDumper) { - continue; - } - - if ($this->hasReference($id, array($service->getArguments(), $service->getFactory(), $service->getProperties(), $service->getMethodCalls(), $service->getConfigurator()), $deep, $visited)) { - return true; - } - } - - return false; - } - /** * Dumps values. * @@ -1674,7 +1566,7 @@ private function hasReference($id, array $arguments, $deep = false, array &$visi */ private function dumpValue($value, $interpolate = true) { - if (is_array($value)) { + if (\is_array($value)) { if ($value && $interpolate && false !== $param = array_search($value, $this->container->getParameterBag()->all(), true)) { return $this->dumpValue("%$param%"); } @@ -1685,7 +1577,7 @@ private function dumpValue($value, $interpolate = true) return sprintf('array(%s)', implode(', ', $code)); } elseif ($value instanceof ArgumentInterface) { - $scope = array($this->definitionVariables, $this->referenceVariables, $this->variableCount); + $scope = array($this->definitionVariables, $this->referenceVariables); $this->definitionVariables = $this->referenceVariables = null; try { @@ -1727,12 +1619,12 @@ private function dumpValue($value, $interpolate = true) $countCode[] = ' }'; } - $code[] = sprintf(' }, %s)', count($operands) > 1 ? implode("\n", $countCode) : $operands[0]); + $code[] = sprintf(' }, %s)', \count($operands) > 1 ? implode("\n", $countCode) : $operands[0]); return implode("\n", $code); } } finally { - list($this->definitionVariables, $this->referenceVariables, $this->variableCount) = $scope; + list($this->definitionVariables, $this->referenceVariables) = $scope; } } elseif ($value instanceof Definition) { if (null !== $this->definitionVariables && $this->definitionVariables->contains($value)) { @@ -1756,17 +1648,17 @@ private function dumpValue($value, $interpolate = true) if (null !== $value->getFactory()) { $factory = $value->getFactory(); - if (is_string($factory)) { + if (\is_string($factory)) { return sprintf('%s(%s)', $this->dumpLiteralClass($this->dumpValue($factory)), implode(', ', $arguments)); } - if (is_array($factory)) { + if (\is_array($factory)) { if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$/', $factory[1])) { throw new RuntimeException(sprintf('Cannot dump definition because of invalid factory method (%s)', $factory[1] ?: 'n/a')); } $class = $this->dumpValue($factory[0]); - if (is_string($factory[0])) { + if (\is_string($factory[0])) { return sprintf('%s::%s(%s)', $this->dumpLiteralClass($class), $factory[1], implode(', ', $arguments)); } @@ -1775,7 +1667,7 @@ private function dumpValue($value, $interpolate = true) return sprintf('(%s)->%s(%s)', $class, $factory[1], implode(', ', $arguments)); } - return sprintf("\\call_user_func(array(%s, '%s')%s)", $class, $factory[1], count($arguments) > 0 ? ', '.implode(', ', $arguments) : ''); + return sprintf("\\call_user_func(array(%s, '%s')%s)", $class, $factory[1], \count($arguments) > 0 ? ', '.implode(', ', $arguments) : ''); } if ($factory[0] instanceof Reference) { @@ -1805,7 +1697,7 @@ private function dumpValue($value, $interpolate = true) return $this->getExpressionLanguage()->compile((string) $value, array('this' => 'container')); } elseif ($value instanceof Parameter) { return $this->dumpParameter($value); - } elseif (true === $interpolate && is_string($value)) { + } elseif (true === $interpolate && \is_string($value)) { if (preg_match('/^%([^%]+)%$/', $value, $match)) { // we do this to deal with non string values (Boolean, integer, ...) // the preg_replace_callback converts them to strings @@ -1819,7 +1711,7 @@ private function dumpValue($value, $interpolate = true) return $code; } - } elseif (is_object($value) || is_resource($value)) { + } elseif (\is_object($value) || \is_resource($value)) { throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); } @@ -1862,7 +1754,7 @@ private function dumpParameter($name) $value = $this->container->getParameter($name); $dumpedValue = $this->dumpValue($value, false); - if (!$value || !is_array($value)) { + if (!$value || !\is_array($value)) { return $dumpedValue; } @@ -1893,9 +1785,14 @@ private function getServiceCall($id, Reference $reference = null) return '$this'; } - if ($this->container->hasDefinition($id) && ($definition = $this->container->getDefinition($id)) && !$definition->isSynthetic()) { - if (null !== $reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) { + if ($this->container->hasDefinition($id) && $definition = $this->container->getDefinition($id)) { + if ($definition->isSynthetic()) { + $code = sprintf('$this->get(\'%s\'%s)', $id, null !== $reference ? ', '.$reference->getInvalidBehavior() : ''); + } elseif (null !== $reference && ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE === $reference->getInvalidBehavior()) { $code = 'null'; + if (!$definition->isShared()) { + return $code; + } } elseif ($this->isTrivialInstance($definition)) { $code = substr($this->addNewInstance($definition, '', '', $id), 8, -2); if ($definition->isShared()) { @@ -1976,9 +1873,9 @@ private function generateMethodName($id) private function getNextVariableName() { $firstChars = self::FIRST_CHARS; - $firstCharsLength = strlen($firstChars); + $firstCharsLength = \strlen($firstChars); $nonFirstChars = self::NON_FIRST_CHARS; - $nonFirstCharsLength = strlen($nonFirstChars); + $nonFirstCharsLength = \strlen($nonFirstChars); while (true) { $name = ''; @@ -1998,7 +1895,7 @@ private function getNextVariableName() ++$this->variableCount; // check that the name is not reserved - if (in_array($name, $this->reservedVariables, true)) { + if (\in_array($name, $this->reservedVariables, true)) { continue; } @@ -2040,12 +1937,12 @@ private function isHotPath(Definition $definition) private function export($value) { - if (null !== $this->targetDirRegex && is_string($value) && preg_match($this->targetDirRegex, $value, $matches, PREG_OFFSET_CAPTURE)) { + if (null !== $this->targetDirRegex && \is_string($value) && preg_match($this->targetDirRegex, $value, $matches, PREG_OFFSET_CAPTURE)) { $prefix = $matches[0][1] ? $this->doExport(substr($value, 0, $matches[0][1]), true).'.' : ''; - $suffix = $matches[0][1] + strlen($matches[0][0]); + $suffix = $matches[0][1] + \strlen($matches[0][0]); $suffix = isset($value[$suffix]) ? '.'.$this->doExport(substr($value, $suffix), true) : ''; $dirname = $this->asFiles ? '$this->containerDir' : '__DIR__'; - $offset = 1 + $this->targetDirMaxMatches - count($matches); + $offset = 1 + $this->targetDirMaxMatches - \count($matches); if ($this->asFiles || 0 < $offset) { $dirname = sprintf('$this->targetDirs[%d]', $offset); @@ -2063,7 +1960,7 @@ private function export($value) private function doExport($value, $resolveEnv = false) { - if (is_string($value) && false !== strpos($value, "\n")) { + if (\is_string($value) && false !== strpos($value, "\n")) { $cleanParts = explode("\n", $value); $cleanParts = array_map(function ($part) { return var_export($part, true); }, $cleanParts); $export = implode('."\n".', $cleanParts); diff --git a/vendor/symfony/dependency-injection/Dumper/XmlDumper.php b/vendor/symfony/dependency-injection/Dumper/XmlDumper.php index 4410a1470..1dcef12da 100644 --- a/vendor/symfony/dependency-injection/Dumper/XmlDumper.php +++ b/vendor/symfony/dependency-injection/Dumper/XmlDumper.php @@ -11,15 +11,15 @@ namespace Symfony\Component\DependencyInjection\Dumper; +use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Parameter; -use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Parameter; +use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\ExpressionLanguage\Expression; /** @@ -80,7 +80,7 @@ private function addMethodCalls(array $methodcalls, \DOMElement $parent) foreach ($methodcalls as $methodcall) { $call = $this->document->createElement('call'); $call->setAttribute('method', $methodcall[0]); - if (count($methodcall[1])) { + if (\count($methodcall[1])) { $this->convertParameters($methodcall[1], 'argument', $call); } $parent->appendChild($call); @@ -160,10 +160,10 @@ private function addService($definition, $id, \DOMElement $parent) if ($callable = $definition->getFactory()) { $factory = $this->document->createElement('factory'); - if (is_array($callable) && $callable[0] instanceof Definition) { + if (\is_array($callable) && $callable[0] instanceof Definition) { $this->addService($callable[0], null, $factory); $factory->setAttribute('method', $callable[1]); - } elseif (is_array($callable)) { + } elseif (\is_array($callable)) { if (null !== $callable[0]) { $factory->setAttribute($callable[0] instanceof Reference ? 'service' : 'class', $callable[0]); } @@ -203,10 +203,10 @@ private function addService($definition, $id, \DOMElement $parent) if ($callable = $definition->getConfigurator()) { $configurator = $this->document->createElement('configurator'); - if (is_array($callable) && $callable[0] instanceof Definition) { + if (\is_array($callable) && $callable[0] instanceof Definition) { $this->addService($callable[0], null, $configurator); $configurator->setAttribute('method', $callable[1]); - } elseif (is_array($callable)) { + } elseif (\is_array($callable)) { $configurator->setAttribute($callable[0] instanceof Reference ? 'service' : 'class', $callable[0]); $configurator->setAttribute('method', $callable[1]); } else { @@ -268,7 +268,7 @@ private function addServices(\DOMElement $parent) */ private function convertParameters(array $parameters, $type, \DOMElement $parent, $keyAttribute = 'key') { - $withKeys = array_keys($parameters) !== range(0, count($parameters) - 1); + $withKeys = array_keys($parameters) !== range(0, \count($parameters) - 1); foreach ($parameters as $key => $value) { $element = $this->document->createElement($type); if ($withKeys) { @@ -278,7 +278,7 @@ private function convertParameters(array $parameters, $type, \DOMElement $parent if ($value instanceof ServiceClosureArgument) { $value = $value->getValues()[0]; } - if (is_array($value)) { + if (\is_array($value)) { $element->setAttribute('type', 'collection'); $this->convertParameters($value, $type, $element, 'key'); } elseif ($value instanceof TaggedIteratorArgument) { @@ -306,7 +306,7 @@ private function convertParameters(array $parameters, $type, \DOMElement $parent $text = $this->document->createTextNode(self::phpToXml((string) $value)); $element->appendChild($text); } else { - if (in_array($value, array('null', 'true', 'false'), true)) { + if (\in_array($value, array('null', 'true', 'false'), true)) { $element->setAttribute('type', 'string'); } $text = $this->document->createTextNode(self::phpToXml($value)); @@ -325,9 +325,9 @@ private function escape(array $arguments) { $args = array(); foreach ($arguments as $k => $v) { - if (is_array($v)) { + if (\is_array($v)) { $args[$k] = $this->escape($v); - } elseif (is_string($v)) { + } elseif (\is_string($v)) { $args[$k] = str_replace('%', '%%', $v); } else { $args[$k] = $v; @@ -357,7 +357,7 @@ public static function phpToXml($value) return 'false'; case $value instanceof Parameter: return '%'.$value.'%'; - case is_object($value) || is_resource($value): + case \is_object($value) || \is_resource($value): throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); default: return (string) $value; diff --git a/vendor/symfony/dependency-injection/Dumper/YamlDumper.php b/vendor/symfony/dependency-injection/Dumper/YamlDumper.php index f76857224..35441023d 100644 --- a/vendor/symfony/dependency-injection/Dumper/YamlDumper.php +++ b/vendor/symfony/dependency-injection/Dumper/YamlDumper.php @@ -11,10 +11,6 @@ namespace Symfony\Component\DependencyInjection\Dumper; -use Symfony\Component\Yaml\Dumper as YmlDumper; -use Symfony\Component\Yaml\Parser; -use Symfony\Component\Yaml\Tag\TaggedValue; -use Symfony\Component\Yaml\Yaml; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\Argument\ArgumentInterface; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; @@ -22,10 +18,14 @@ use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Parameter; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\ExpressionLanguage\Expression; +use Symfony\Component\Yaml\Dumper as YmlDumper; +use Symfony\Component\Yaml\Parser; +use Symfony\Component\Yaml\Tag\TaggedValue; +use Symfony\Component\Yaml\Yaml; /** * YamlDumper dumps a service container as a YAML string. @@ -102,7 +102,7 @@ private function addService($id, Definition $definition) } if ($definition->isDeprecated()) { - $code .= sprintf(" deprecated: %s\n", $definition->getDeprecationMessage('%service_id%')); + $code .= sprintf(" deprecated: %s\n", $this->dumper->dump($definition->getDeprecationMessage('%service_id%'))); } if ($definition->isAutowired()) { @@ -236,7 +236,7 @@ private function addParameters() */ private function dumpCallable($callable) { - if (is_array($callable)) { + if (\is_array($callable)) { if ($callable[0] instanceof Reference) { $callable = array($this->getServiceCall((string) $callable[0], $callable[0]), $callable[1]); } else { @@ -268,13 +268,13 @@ private function dumpValue($value) if ($value instanceof IteratorArgument) { $tag = 'iterator'; } else { - throw new RuntimeException(sprintf('Unspecified Yaml tag for type "%s".', get_class($value))); + throw new RuntimeException(sprintf('Unspecified Yaml tag for type "%s".', \get_class($value))); } return new TaggedValue($tag, $this->dumpValue($value->getValues())); } - if (is_array($value)) { + if (\is_array($value)) { $code = array(); foreach ($value as $k => $v) { $code[$k] = $this->dumpValue($v); @@ -289,7 +289,7 @@ private function dumpValue($value) return $this->getExpressionCall((string) $value); } elseif ($value instanceof Definition) { return new TaggedValue('service', (new Parser())->parse("_:\n".$this->addService('_', $value), Yaml::PARSE_CUSTOM_TAGS)['_']['_']); - } elseif (is_object($value) || is_resource($value)) { + } elseif (\is_object($value) || \is_resource($value)) { throw new RuntimeException('Unable to dump a service container if a parameter is an object or a resource.'); } @@ -346,9 +346,9 @@ private function prepareParameters(array $parameters, $escape = true) { $filtered = array(); foreach ($parameters as $key => $value) { - if (is_array($value)) { + if (\is_array($value)) { $value = $this->prepareParameters($value, $escape); - } elseif ($value instanceof Reference || is_string($value) && 0 === strpos($value, '@')) { + } elseif ($value instanceof Reference || \is_string($value) && 0 === strpos($value, '@')) { $value = '@'.$value; } @@ -367,9 +367,9 @@ private function escape(array $arguments) { $args = array(); foreach ($arguments as $k => $v) { - if (is_array($v)) { + if (\is_array($v)) { $args[$k] = $this->escape($v); - } elseif (is_string($v)) { + } elseif (\is_string($v)) { $args[$k] = str_replace('%', '%%', $v); } else { $args[$k] = $v; diff --git a/vendor/symfony/dependency-injection/EnvVarProcessor.php b/vendor/symfony/dependency-injection/EnvVarProcessor.php index d4c60a860..13568079b 100644 --- a/vendor/symfony/dependency-injection/EnvVarProcessor.php +++ b/vendor/symfony/dependency-injection/EnvVarProcessor.php @@ -110,11 +110,11 @@ public function getEnv($prefix, $name, \Closure $getEnv) } if ('const' === $prefix) { - if (!defined($env)) { + if (!\defined($env)) { throw new RuntimeException(sprintf('Env var "%s" maps to undefined constant "%s".', $name, $env)); } - return constant($env); + return \constant($env); } if ('base64' === $prefix) { @@ -128,8 +128,8 @@ public function getEnv($prefix, $name, \Closure $getEnv) throw new RuntimeException(sprintf('Invalid JSON in env var "%s": '.json_last_error_msg(), $name)); } - if (!is_array($env)) { - throw new RuntimeException(sprintf('Invalid JSON env var "%s": array expected, %s given.', $name, gettype($env))); + if (!\is_array($env)) { + throw new RuntimeException(sprintf('Invalid JSON env var "%s": array expected, %s given.', $name, \gettype($env))); } return $env; @@ -142,7 +142,7 @@ public function getEnv($prefix, $name, \Closure $getEnv) } $value = $this->container->getParameter($match[1]); if (!is_scalar($value)) { - throw new RuntimeException(sprintf('Parameter "%s" found when resolving env var "%s" must be scalar, "%s" given.', $match[1], $name, gettype($value))); + throw new RuntimeException(sprintf('Parameter "%s" found when resolving env var "%s" must be scalar, "%s" given.', $match[1], $name, \gettype($value))); } return $value; diff --git a/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php b/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php index 40c01b050..7a30f629d 100644 --- a/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php +++ b/vendor/symfony/dependency-injection/Exception/ParameterNotFoundException.php @@ -56,7 +56,7 @@ public function updateRepr() } if ($this->alternatives) { - if (1 == count($this->alternatives)) { + if (1 == \count($this->alternatives)) { $this->message .= ' Did you mean this: "'; } else { $this->message .= ' Did you mean one of these: "'; diff --git a/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php b/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php index 59567074c..9a0128c83 100644 --- a/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php +++ b/vendor/symfony/dependency-injection/Exception/ServiceNotFoundException.php @@ -35,7 +35,7 @@ public function __construct($id, $sourceId = null, \Exception $previous = null, } if ($alternatives) { - if (1 == count($alternatives)) { + if (1 == \count($alternatives)) { $msg .= ' Did you mean this: "'; } else { $msg .= ' Did you mean one of these: "'; diff --git a/vendor/symfony/dependency-injection/Extension/ConfigurationExtensionInterface.php b/vendor/symfony/dependency-injection/Extension/ConfigurationExtensionInterface.php index da590635b..c3bd8423b 100644 --- a/vendor/symfony/dependency-injection/Extension/ConfigurationExtensionInterface.php +++ b/vendor/symfony/dependency-injection/Extension/ConfigurationExtensionInterface.php @@ -11,8 +11,8 @@ namespace Symfony\Component\DependencyInjection\Extension; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; /** * ConfigurationExtensionInterface is the interface implemented by container extension classes. diff --git a/vendor/symfony/dependency-injection/Extension/Extension.php b/vendor/symfony/dependency-injection/Extension/Extension.php index 9542c740e..1bafdbebd 100644 --- a/vendor/symfony/dependency-injection/Extension/Extension.php +++ b/vendor/symfony/dependency-injection/Extension/Extension.php @@ -11,12 +11,12 @@ namespace Symfony\Component\DependencyInjection\Extension; +use Symfony\Component\Config\Definition\ConfigurationInterface; +use Symfony\Component\Config\Definition\Processor; use Symfony\Component\DependencyInjection\Container; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Exception\BadMethodCallException; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\Config\Definition\Processor; -use Symfony\Component\Config\Definition\ConfigurationInterface; /** * Provides useful features shared by many extensions. @@ -65,7 +65,7 @@ public function getNamespace() */ public function getAlias() { - $className = get_class($this); + $className = \get_class($this); if ('Extension' != substr($className, -9)) { throw new BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.'); } @@ -79,7 +79,7 @@ public function getAlias() */ public function getConfiguration(array $config, ContainerBuilder $container) { - $class = get_class($this); + $class = \get_class($this); $class = substr_replace($class, '\Configuration', strrpos($class, '\\')); $class = $container->getReflectionClass($class); $constructor = $class ? $class->getConstructor() : null; diff --git a/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php b/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php index cad932003..3b0b57ef0 100644 --- a/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php +++ b/vendor/symfony/dependency-injection/LazyProxy/Instantiator/RealServiceInstantiator.php @@ -28,6 +28,6 @@ class RealServiceInstantiator implements InstantiatorInterface */ public function instantiateProxy(ContainerInterface $container, Definition $definition, $id, $realInstantiator) { - return call_user_func($realInstantiator); + return \call_user_func($realInstantiator); } } diff --git a/vendor/symfony/dependency-injection/LazyProxy/ProxyHelper.php b/vendor/symfony/dependency-injection/LazyProxy/ProxyHelper.php index 84686efff..fb21ba2e4 100644 --- a/vendor/symfony/dependency-injection/LazyProxy/ProxyHelper.php +++ b/vendor/symfony/dependency-injection/LazyProxy/ProxyHelper.php @@ -39,7 +39,7 @@ public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionPa if (!$type) { return; } - if (!is_string($type)) { + if (!\is_string($type)) { $name = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString(); if ($type->isBuiltin()) { @@ -62,17 +62,4 @@ public static function getTypeHint(\ReflectionFunctionAbstract $r, \ReflectionPa return $prefix.$parent->name; } } - - private static function export($value) - { - if (!is_array($value)) { - return var_export($value, true); - } - $code = array(); - foreach ($value as $k => $v) { - $code[] = sprintf('%s => %s', var_export($k, true), self::export($v)); - } - - return sprintf('array(%s)', implode(', ', $code)); - } } diff --git a/vendor/symfony/dependency-injection/Loader/ClosureLoader.php b/vendor/symfony/dependency-injection/Loader/ClosureLoader.php index f8f2efe2e..183cacc4d 100644 --- a/vendor/symfony/dependency-injection/Loader/ClosureLoader.php +++ b/vendor/symfony/dependency-injection/Loader/ClosureLoader.php @@ -11,8 +11,8 @@ namespace Symfony\Component\DependencyInjection\Loader; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\Loader\Loader; +use Symfony\Component\DependencyInjection\ContainerBuilder; /** * ClosureLoader loads service definitions from a PHP closure. @@ -35,7 +35,7 @@ public function __construct(ContainerBuilder $container) */ public function load($resource, $type = null) { - call_user_func($resource, $this->container); + \call_user_func($resource, $this->container); } /** diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php index 73ca320e3..d11347aea 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/AbstractConfigurator.php @@ -28,10 +28,10 @@ abstract class AbstractConfigurator public function __call($method, $args) { if (method_exists($this, 'set'.$method)) { - return call_user_func_array(array($this, 'set'.$method), $args); + return \call_user_func_array(array($this, 'set'.$method), $args); } - throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', get_class($this), $method)); + throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method)); } /** @@ -44,7 +44,7 @@ public function __call($method, $args) */ public static function processValue($value, $allowServices = false) { - if (is_array($value)) { + if (\is_array($value)) { foreach ($value as $k => $v) { $value[$k] = static::processValue($v, $allowServices); } @@ -82,6 +82,6 @@ public static function processValue($value, $allowServices = false) } } - throw new InvalidArgumentException(sprintf('Cannot use values of type "%s" in service configuration files.', is_object($value) ? get_class($value) : gettype($value))); + throw new InvalidArgumentException(sprintf('Cannot use values of type "%s" in service configuration files.', \is_object($value) ? \get_class($value) : \gettype($value))); } } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php index a68f83d8f..3b4b2a483 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/ContainerConfigurator.php @@ -59,7 +59,7 @@ final public function extension($namespace, array $config) final public function import($resource, $type = null, $ignoreErrors = false) { - $this->loader->setCurrentDir(dirname($this->path)); + $this->loader->setCurrentDir(\dirname($this->path)); $this->loader->import($resource, $type, $ignoreErrors, $this->file); } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php index adf294b99..631c92a68 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/DefaultsConfigurator.php @@ -39,7 +39,7 @@ class DefaultsConfigurator extends AbstractServiceConfigurator */ final public function tag($name, array $attributes = array()) { - if (!is_string($name) || '' === $name) { + if (!\is_string($name) || '' === $name) { throw new InvalidArgumentException('The tag name in "_defaults" must be a non-empty string.'); } diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/InstanceofConfigurator.php b/vendor/symfony/dependency-injection/Loader/Configurator/InstanceofConfigurator.php index 1d3975bf8..629874d19 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/InstanceofConfigurator.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/InstanceofConfigurator.php @@ -34,7 +34,7 @@ class InstanceofConfigurator extends AbstractServiceConfigurator * * @param string $fqcn * - * @return InstanceofConfigurator + * @return self */ final protected function setInstanceof($fqcn) { diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/DecorateTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/DecorateTrait.php index 0891fd906..173ad15f0 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/DecorateTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/DecorateTrait.php @@ -18,8 +18,8 @@ trait DecorateTrait /** * Sets the service that this service is decorating. * - * @param null|string $id The decorated service id, use null to remove decoration - * @param null|string $renamedId The new decorated service id + * @param string|null $id The decorated service id, use null to remove decoration + * @param string|null $renamedId The new decorated service id * @param int $priority The priority of decoration * * @return $this diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/FactoryTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/FactoryTrait.php index 12e8859ca..0d50fb747 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/FactoryTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/FactoryTrait.php @@ -24,7 +24,7 @@ trait FactoryTrait */ final public function factory($factory) { - if (is_string($factory) && 1 === substr_count($factory, ':')) { + if (\is_string($factory) && 1 === substr_count($factory, ':')) { $factoryParts = explode(':', $factory); throw new InvalidArgumentException(sprintf('Invalid factory "%s": the `service:method` notation is not available when using PHP-based DI configuration. Use "[ref(\'%s\'), \'%s\']" instead.', $factory, $factoryParts[0], $factoryParts[1])); diff --git a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php index aeb8b047d..c165b6503 100644 --- a/vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php +++ b/vendor/symfony/dependency-injection/Loader/Configurator/Traits/TagTrait.php @@ -25,7 +25,7 @@ trait TagTrait */ final public function tag($name, array $attributes = array()) { - if (!is_string($name) || '' === $name) { + if (!\is_string($name) || '' === $name) { throw new InvalidArgumentException(sprintf('The tag name for service "%s" must be a non-empty string.', $this->id)); } diff --git a/vendor/symfony/dependency-injection/Loader/DirectoryLoader.php b/vendor/symfony/dependency-injection/Loader/DirectoryLoader.php index 769f1026e..a57cac3b5 100644 --- a/vendor/symfony/dependency-injection/Loader/DirectoryLoader.php +++ b/vendor/symfony/dependency-injection/Loader/DirectoryLoader.php @@ -49,6 +49,6 @@ public function supports($resource, $type = null) return true; } - return null === $type && is_string($resource) && '/' === substr($resource, -1); + return null === $type && \is_string($resource) && '/' === substr($resource, -1); } } diff --git a/vendor/symfony/dependency-injection/Loader/FileLoader.php b/vendor/symfony/dependency-injection/Loader/FileLoader.php index fa8c636ed..d5e2327ed 100644 --- a/vendor/symfony/dependency-injection/Loader/FileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/FileLoader.php @@ -11,13 +11,13 @@ namespace Symfony\Component\DependencyInjection\Loader; +use Symfony\Component\Config\FileLocatorInterface; +use Symfony\Component\Config\Loader\FileLoader as BaseFileLoader; +use Symfony\Component\Config\Resource\GlobResource; use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; -use Symfony\Component\Config\Loader\FileLoader as BaseFileLoader; -use Symfony\Component\Config\FileLocatorInterface; -use Symfony\Component\Config\Resource\GlobResource; /** * FileLoader is the abstract class used by all built-in loaders that are file based. @@ -93,7 +93,7 @@ protected function setDefinition($id, Definition $definition) { if ($this->isLoadingInstanceof) { if (!$definition instanceof ChildDefinition) { - throw new InvalidArgumentException(sprintf('Invalid type definition "%s": ChildDefinition expected, "%s" given.', $id, get_class($definition))); + throw new InvalidArgumentException(sprintf('Invalid type definition "%s": ChildDefinition expected, "%s" given.', $id, \get_class($definition))); } $this->instanceof[$id] = $definition; } else { @@ -121,11 +121,11 @@ private function findClasses($namespace, $pattern, $excludePattern) $pattern = $parameterBag->unescapeValue($parameterBag->resolveValue($pattern)); $classes = array(); - $extRegexp = defined('HHVM_VERSION') ? '/\\.(?:php|hh)$/' : '/\\.php$/'; + $extRegexp = \defined('HHVM_VERSION') ? '/\\.(?:php|hh)$/' : '/\\.php$/'; $prefixLen = null; foreach ($this->glob($pattern, true, $resource) as $path => $info) { if (null === $prefixLen) { - $prefixLen = strlen($resource->getPrefix()); + $prefixLen = \strlen($resource->getPrefix()); if ($excludePrefix && 0 !== strpos($excludePrefix, $resource->getPrefix())) { throw new InvalidArgumentException(sprintf('Invalid "exclude" pattern when importing classes for "%s": make sure your "exclude" pattern (%s) is a subset of the "resource" pattern (%s)', $namespace, $excludePattern, $pattern)); @@ -139,7 +139,7 @@ private function findClasses($namespace, $pattern, $excludePattern) if (!preg_match($extRegexp, $path, $m) || !$info->isReadable()) { continue; } - $class = $namespace.ltrim(str_replace('/', '\\', substr($path, $prefixLen, -strlen($m[0]))), '\\'); + $class = $namespace.ltrim(str_replace('/', '\\', substr($path, $prefixLen, -\strlen($m[0]))), '\\'); if (!preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\\\\[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+$/', $class)) { continue; diff --git a/vendor/symfony/dependency-injection/Loader/IniFileLoader.php b/vendor/symfony/dependency-injection/Loader/IniFileLoader.php index 6cc9a1aca..2ee9ea8ff 100644 --- a/vendor/symfony/dependency-injection/Loader/IniFileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/IniFileLoader.php @@ -39,7 +39,7 @@ public function load($resource, $type = null) // real raw parsing $result = parse_ini_file($path, true, INI_SCANNER_RAW); - if (isset($result['parameters']) && is_array($result['parameters'])) { + if (isset($result['parameters']) && \is_array($result['parameters'])) { foreach ($result['parameters'] as $key => $value) { $this->container->setParameter($key, $this->phpize($value)); } @@ -51,7 +51,7 @@ public function load($resource, $type = null) */ public function supports($resource, $type = null) { - if (!is_string($resource)) { + if (!\is_string($resource)) { return false; } @@ -70,19 +70,21 @@ public function supports($resource, $type = null) private function phpize($value) { // trim on the right as comments removal keep whitespaces - $value = rtrim($value); + if ($value !== $v = rtrim($value)) { + $value = '""' === substr_replace($v, '', 1, -1) ? substr($v, 1, -1) : $v; + } $lowercaseValue = strtolower($value); switch (true) { - case defined($value): - return constant($value); + case \defined($value): + return \constant($value); case 'yes' === $lowercaseValue || 'on' === $lowercaseValue: return true; case 'no' === $lowercaseValue || 'off' === $lowercaseValue || 'none' === $lowercaseValue: return false; case isset($value[1]) && ( - ("'" === $value[0] && "'" === $value[strlen($value) - 1]) || - ('"' === $value[0] && '"' === $value[strlen($value) - 1]) + ("'" === $value[0] && "'" === $value[\strlen($value) - 1]) || + ('"' === $value[0] && '"' === $value[\strlen($value) - 1]) ): // quoted string return substr($value, 1, -1); diff --git a/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php b/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php index f0be7534e..ff8df43f8 100644 --- a/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/PhpFileLoader.php @@ -33,7 +33,7 @@ public function load($resource, $type = null) $loader = $this; $path = $this->locator->locate($resource); - $this->setCurrentDir(dirname($path)); + $this->setCurrentDir(\dirname($path)); $this->container->fileExists($path); // the closure forbids access to the private scope in the included file @@ -53,7 +53,7 @@ public function load($resource, $type = null) */ public function supports($resource, $type = null) { - if (!is_string($resource)) { + if (!\is_string($resource)) { return false; } diff --git a/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php b/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php index 72774ddcd..4236b72f2 100644 --- a/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/XmlFileLoader.php @@ -12,17 +12,17 @@ namespace Symfony\Component\DependencyInjection\Loader; use Symfony\Component\Config\Util\XmlUtils; -use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument; -use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\Argument\BoundArgument; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; -use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument; use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\ExpressionLanguage\Expression; /** @@ -72,7 +72,7 @@ public function load($resource, $type = null) */ public function supports($resource, $type = null) { - if (!is_string($resource)) { + if (!\is_string($resource)) { return false; } @@ -111,7 +111,7 @@ private function parseImports(\DOMDocument $xml, $file) return; } - $defaultDirectory = dirname($file); + $defaultDirectory = \dirname($file); foreach ($imports as $import) { $this->setCurrentDir($defaultDirectory); $this->import($import->getAttribute('resource'), XmlUtils::phpize($import->getAttribute('type')) ?: null, (bool) XmlUtils::phpize($import->getAttribute('ignore-errors')), $file); @@ -132,7 +132,7 @@ private function parseDefinitions(\DOMDocument $xml, $file, $defaults) if (false === $services = $xpath->query('//container:services/container:service|//container:services/container:prototype')) { return; } - $this->setCurrentDir(dirname($file)); + $this->setCurrentDir(\dirname($file)); $this->instanceof = array(); $this->isLoadingInstanceof = true; @@ -402,7 +402,7 @@ private function processAnonymousServices(\DOMDocument $xml, $file, $defaults) { $definitions = array(); $count = 0; - $suffix = ContainerBuilder::hash($file); + $suffix = '~'.ContainerBuilder::hash($file); $xpath = new \DOMXPath($xml); $xpath->registerNamespace('container', self::NS); @@ -412,7 +412,7 @@ private function processAnonymousServices(\DOMDocument $xml, $file, $defaults) foreach ($nodes as $node) { if ($services = $this->getChildren($node, 'service')) { // give it a unique name - $id = sprintf('%d_%s', ++$count, preg_replace('/^.*\\\\/', '', $services[0]->getAttribute('class')).'~'.$suffix); + $id = sprintf('%d_%s', ++$count, preg_replace('/^.*\\\\/', '', $services[0]->getAttribute('class')).$suffix); $node->setAttribute('id', $id); $node->setAttribute('service', $id); @@ -533,7 +533,7 @@ private function getArgumentsAsPhp(\DOMElement $node, $name, $file, $lowercase = $arguments[$key] = $arg->nodeValue; break; case 'constant': - $arguments[$key] = constant(trim($arg->nodeValue)); + $arguments[$key] = \constant(trim($arg->nodeValue)); break; default: $arguments[$key] = XmlUtils::phpize($arg->nodeValue); @@ -578,7 +578,7 @@ public function validateSchema(\DOMDocument $dom) if ($element = $dom->documentElement->getAttributeNS('http://www.w3.org/2001/XMLSchema-instance', 'schemaLocation')) { $items = preg_split('/\s+/', $element); - for ($i = 0, $nb = count($items); $i < $nb; $i += 2) { + for ($i = 0, $nb = \count($items); $i < $nb; $i += 2) { if (!$this->container->hasExtension($items[$i])) { continue; } @@ -587,7 +587,7 @@ public function validateSchema(\DOMDocument $dom) $path = str_replace($extension->getNamespace(), str_replace('\\', '/', $extension->getXsdValidationBasePath()).'/', $items[$i + 1]); if (!is_file($path)) { - throw new RuntimeException(sprintf('Extension "%s" references a non-existent XSD file "%s"', get_class($extension), $path)); + throw new RuntimeException(sprintf('Extension "%s" references a non-existent XSD file "%s"', \get_class($extension), $path)); } $schemaLocations[$items[$i]] = $path; @@ -611,7 +611,7 @@ public function validateSchema(\DOMDocument $dom) $locationstart = 'phar:///'; } } - $drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : ''; + $drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : ''; $location = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts)); $imports .= sprintf(' '."\n", $namespace, $location); @@ -650,7 +650,7 @@ public function validateSchema(\DOMDocument $dom) private function validateAlias(\DOMElement $alias, $file) { foreach ($alias->attributes as $name => $node) { - if (!in_array($name, array('alias', 'id', 'public'))) { + if (!\in_array($name, array('alias', 'id', 'public'))) { @trigger_error(sprintf('Using the attribute "%s" is deprecated for the service "%s" which is defined as an alias in "%s". Allowed attributes for service aliases are "alias", "id" and "public". The XmlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $name, $alias->getAttribute('id'), $file), E_USER_DEPRECATED); } } @@ -680,13 +680,7 @@ private function validateExtensions(\DOMDocument $dom, $file) // can it be handled by an extension? if (!$this->container->hasExtension($node->namespaceURI)) { $extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getNamespace(); }, $this->container->getExtensions())); - throw new InvalidArgumentException(sprintf( - 'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', - $node->tagName, - $file, - $node->namespaceURI, - $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none' - )); + throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', $node->tagName, $file, $node->namespaceURI, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none')); } } } @@ -704,7 +698,7 @@ private function loadFromExtensions(\DOMDocument $xml) } $values = static::convertDomElementToArray($node); - if (!is_array($values)) { + if (!\is_array($values)) { $values = array(); } diff --git a/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php b/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php index fa27767b4..48cfde60d 100644 --- a/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php +++ b/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php @@ -20,14 +20,14 @@ use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\ExpressionLanguage\Expression; use Symfony\Component\Yaml\Exception\ParseException; use Symfony\Component\Yaml\Parser as YamlParser; use Symfony\Component\Yaml\Tag\TaggedValue; use Symfony\Component\Yaml\Yaml; -use Symfony\Component\ExpressionLanguage\Expression; /** * YamlFileLoader loads YAML files service definitions. @@ -128,7 +128,7 @@ public function load($resource, $type = null) // parameters if (isset($content['parameters'])) { - if (!is_array($content['parameters'])) { + if (!\is_array($content['parameters'])) { throw new InvalidArgumentException(sprintf('The "parameters" key should contain an array in %s. Check your YAML syntax.', $path)); } @@ -142,8 +142,8 @@ public function load($resource, $type = null) // services $this->anonymousServicesCount = 0; - $this->anonymousServicesSuffix = ContainerBuilder::hash($path); - $this->setCurrentDir(dirname($path)); + $this->anonymousServicesSuffix = '~'.ContainerBuilder::hash($path); + $this->setCurrentDir(\dirname($path)); try { $this->parseDefinitions($content, $path); } finally { @@ -156,15 +156,15 @@ public function load($resource, $type = null) */ public function supports($resource, $type = null) { - if (!is_string($resource)) { + if (!\is_string($resource)) { return false; } - if (null === $type && in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yaml', 'yml'), true)) { + if (null === $type && \in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yaml', 'yml'), true)) { return true; } - return in_array($type, array('yaml', 'yml'), true); + return \in_array($type, array('yaml', 'yml'), true); } /** @@ -179,13 +179,13 @@ private function parseImports(array $content, $file) return; } - if (!is_array($content['imports'])) { + if (!\is_array($content['imports'])) { throw new InvalidArgumentException(sprintf('The "imports" key should contain an array in %s. Check your YAML syntax.', $file)); } - $defaultDirectory = dirname($file); + $defaultDirectory = \dirname($file); foreach ($content['imports'] as $import) { - if (!is_array($import)) { + if (!\is_array($import)) { $import = array('resource' => $import); } if (!isset($import['resource'])) { @@ -209,7 +209,7 @@ private function parseDefinitions(array $content, $file) return; } - if (!is_array($content['services'])) { + if (!\is_array($content['services'])) { throw new InvalidArgumentException(sprintf('The "services" key should contain an array in %s. Check your YAML syntax.', $file)); } @@ -217,16 +217,16 @@ private function parseDefinitions(array $content, $file) $instanceof = $content['services']['_instanceof']; unset($content['services']['_instanceof']); - if (!is_array($instanceof)) { - throw new InvalidArgumentException(sprintf('Service "_instanceof" key must be an array, "%s" given in "%s".', gettype($instanceof), $file)); + if (!\is_array($instanceof)) { + throw new InvalidArgumentException(sprintf('Service "_instanceof" key must be an array, "%s" given in "%s".', \gettype($instanceof), $file)); } $this->instanceof = array(); $this->isLoadingInstanceof = true; foreach ($instanceof as $id => $service) { - if (!$service || !is_array($service)) { + if (!$service || !\is_array($service)) { throw new InvalidArgumentException(sprintf('Type definition "%s" must be a non-empty array within "_instanceof" in %s. Check your YAML syntax.', $id, $file)); } - if (is_string($service) && 0 === strpos($service, '@')) { + if (\is_string($service) && 0 === strpos($service, '@')) { throw new InvalidArgumentException(sprintf('Type definition "%s" cannot be an alias within "_instanceof" in %s. Check your YAML syntax.', $id, $file)); } $this->parseDefinition($id, $service, $file, array()); @@ -256,8 +256,8 @@ private function parseDefaults(array &$content, $file) $defaults = $content['services']['_defaults']; unset($content['services']['_defaults']); - if (!is_array($defaults)) { - throw new InvalidArgumentException(sprintf('Service "_defaults" key must be an array, "%s" given in "%s".', gettype($defaults), $file)); + if (!\is_array($defaults)) { + throw new InvalidArgumentException(sprintf('Service "_defaults" key must be an array, "%s" given in "%s".', \gettype($defaults), $file)); } foreach ($defaults as $key => $default) { @@ -267,12 +267,12 @@ private function parseDefaults(array &$content, $file) } if (isset($defaults['tags'])) { - if (!is_array($tags = $defaults['tags'])) { + if (!\is_array($tags = $defaults['tags'])) { throw new InvalidArgumentException(sprintf('Parameter "tags" in "_defaults" must be an array in %s. Check your YAML syntax.', $file)); } foreach ($tags as $tag) { - if (!is_array($tag)) { + if (!\is_array($tag)) { $tag = array('name' => $tag); } @@ -282,7 +282,7 @@ private function parseDefaults(array &$content, $file) $name = $tag['name']; unset($tag['name']); - if (!is_string($name) || '' === $name) { + if (!\is_string($name) || '' === $name) { throw new InvalidArgumentException(sprintf('The tag name in "_defaults" must be a non-empty string in %s.', $file)); } @@ -295,7 +295,7 @@ private function parseDefaults(array &$content, $file) } if (isset($defaults['bind'])) { - if (!is_array($defaults['bind'])) { + if (!\is_array($defaults['bind'])) { throw new InvalidArgumentException(sprintf('Parameter "bind" in "_defaults" must be an array in %s. Check your YAML syntax.', $file)); } @@ -313,7 +313,7 @@ private function parseDefaults(array &$content, $file) private function isUsingShortSyntax(array $service) { foreach ($service as $key => $value) { - if (is_string($key) && ('' === $key || '$' !== $key[0])) { + if (\is_string($key) && ('' === $key || '$' !== $key[0])) { return false; } } @@ -336,7 +336,7 @@ private function parseDefinition($id, $service, $file, array $defaults) if (preg_match('/^_[a-zA-Z0-9_]*$/', $id)) { @trigger_error(sprintf('Service names that start with an underscore are deprecated since Symfony 3.3 and will be reserved in 4.0. Rename the "%s" service or define it in XML instead.', $id), E_USER_DEPRECATED); } - if (is_string($service) && 0 === strpos($service, '@')) { + if (\is_string($service) && 0 === strpos($service, '@')) { $this->container->setAlias($id, $alias = new Alias(substr($service, 1))); if (isset($defaults['public'])) { $alias->setPublic($defaults['public']); @@ -345,7 +345,7 @@ private function parseDefinition($id, $service, $file, array $defaults) return; } - if (is_array($service) && $this->isUsingShortSyntax($service)) { + if (\is_array($service) && $this->isUsingShortSyntax($service)) { $service = array('arguments' => $service); } @@ -353,8 +353,8 @@ private function parseDefinition($id, $service, $file, array $defaults) $service = array(); } - if (!is_array($service)) { - throw new InvalidArgumentException(sprintf('A service definition must be an array or a string starting with "@" but %s found for service "%s" in %s. Check your YAML syntax.', gettype($service), $id, $file)); + if (!\is_array($service)) { + throw new InvalidArgumentException(sprintf('A service definition must be an array or a string starting with "@" but %s found for service "%s" in %s. Check your YAML syntax.', \gettype($service), $id, $file)); } $this->checkDefinition($id, $service, $file); @@ -368,7 +368,7 @@ private function parseDefinition($id, $service, $file, array $defaults) } foreach ($service as $key => $value) { - if (!in_array($key, array('alias', 'public'))) { + if (!\in_array($key, array('alias', 'public'))) { @trigger_error(sprintf('The configuration key "%s" is unsupported for the service "%s" which is defined as an alias in "%s". Allowed configuration keys for service aliases are "alias" and "public". The YamlFileLoader will raise an exception in Symfony 4.0, instead of silently ignoring unsupported attributes.', $key, $id, $file), E_USER_DEPRECATED); } } @@ -463,7 +463,7 @@ private function parseDefinition($id, $service, $file, array $defaults) } if (isset($service['calls'])) { - if (!is_array($service['calls'])) { + if (!\is_array($service['calls'])) { throw new InvalidArgumentException(sprintf('Parameter "calls" must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file)); } @@ -476,7 +476,7 @@ private function parseDefinition($id, $service, $file, array $defaults) $args = isset($call[1]) ? $this->resolveServices($call[1], $file) : array(); } - if (!is_array($args)) { + if (!\is_array($args)) { throw new InvalidArgumentException(sprintf('The second parameter for function call "%s" must be an array of its arguments for service "%s" in %s. Check your YAML syntax.', $method, $id, $file)); } $definition->addMethodCall($method, $args); @@ -484,7 +484,7 @@ private function parseDefinition($id, $service, $file, array $defaults) } $tags = isset($service['tags']) ? $service['tags'] : array(); - if (!is_array($tags)) { + if (!\is_array($tags)) { throw new InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file)); } @@ -493,7 +493,7 @@ private function parseDefinition($id, $service, $file, array $defaults) } foreach ($tags as $tag) { - if (!is_array($tag)) { + if (!\is_array($tag)) { $tag = array('name' => $tag); } @@ -503,7 +503,7 @@ private function parseDefinition($id, $service, $file, array $defaults) $name = $tag['name']; unset($tag['name']); - if (!is_string($name) || '' === $name) { + if (!\is_string($name) || '' === $name) { throw new InvalidArgumentException(sprintf('The tag name for service "%s" in %s must be a non-empty string.', $id, $file)); } @@ -531,15 +531,15 @@ private function parseDefinition($id, $service, $file, array $defaults) } if (isset($service['autowiring_types'])) { - if (is_string($service['autowiring_types'])) { + if (\is_string($service['autowiring_types'])) { $definition->addAutowiringType($service['autowiring_types']); } else { - if (!is_array($service['autowiring_types'])) { + if (!\is_array($service['autowiring_types'])) { throw new InvalidArgumentException(sprintf('Parameter "autowiring_types" must be a string or an array for service "%s" in %s. Check your YAML syntax.', $id, $file)); } foreach ($service['autowiring_types'] as $autowiringType) { - if (!is_string($autowiringType)) { + if (!\is_string($autowiringType)) { throw new InvalidArgumentException(sprintf('A "autowiring_types" attribute must be of type string for service "%s" in %s. Check your YAML syntax.', $id, $file)); } @@ -553,7 +553,7 @@ private function parseDefinition($id, $service, $file, array $defaults) $bindings = isset($defaults['bind']) ? unserialize(serialize($defaults['bind'])) : array(); if (isset($service['bind'])) { - if (!is_array($service['bind'])) { + if (!\is_array($service['bind'])) { throw new InvalidArgumentException(sprintf('Parameter "bind" must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file)); } @@ -576,7 +576,7 @@ private function parseDefinition($id, $service, $file, array $defaults) } if (array_key_exists('resource', $service)) { - if (!is_string($service['resource'])) { + if (!\is_string($service['resource'])) { throw new InvalidArgumentException(sprintf('A "resource" attribute must be of type string for service "%s" in %s. Check your YAML syntax.', $id, $file)); } $exclude = isset($service['exclude']) ? $service['exclude'] : null; @@ -601,7 +601,7 @@ private function parseDefinition($id, $service, $file, array $defaults) */ private function parseCallable($callable, $parameter, $id, $file) { - if (is_string($callable)) { + if (\is_string($callable)) { if ('' !== $callable && '@' === $callable[0]) { throw new InvalidArgumentException(sprintf('The value of the "%s" option for the "%s" service must be the id of the service without the "@" prefix (replace "%s" with "%s").', $parameter, $id, $callable, substr($callable, 1))); } @@ -615,7 +615,7 @@ private function parseCallable($callable, $parameter, $id, $file) return $callable; } - if (is_array($callable)) { + if (\is_array($callable)) { if (isset($callable[0]) && isset($callable[1])) { return array($this->resolveServices($callable[0], $file), $callable[1]); } @@ -690,24 +690,18 @@ private function validate($content, $file) return $content; } - if (!is_array($content)) { + if (!\is_array($content)) { throw new InvalidArgumentException(sprintf('The service file "%s" is not valid. It should contain an array. Check your YAML syntax.', $file)); } foreach ($content as $namespace => $data) { - if (in_array($namespace, array('imports', 'parameters', 'services'))) { + if (\in_array($namespace, array('imports', 'parameters', 'services'))) { continue; } if (!$this->container->hasExtension($namespace)) { $extensionNamespaces = array_filter(array_map(function ($ext) { return $ext->getAlias(); }, $this->container->getExtensions())); - throw new InvalidArgumentException(sprintf( - 'There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', - $namespace, - $file, - $namespace, - $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none' - )); + throw new InvalidArgumentException(sprintf('There is no extension able to load the configuration for "%s" (in %s). Looked for namespace "%s", found %s', $namespace, $file, $namespace, $extensionNamespaces ? sprintf('"%s"', implode('", "', $extensionNamespaces)) : 'none')); } } @@ -728,7 +722,7 @@ private function resolveServices($value, $file, $isParameter = false) if ($value instanceof TaggedValue) { $argument = $value->getValue(); if ('iterator' === $value->getTag()) { - if (!is_array($argument)) { + if (!\is_array($argument)) { throw new InvalidArgumentException(sprintf('"!iterator" tag only accepts sequences in "%s".', $file)); } $argument = $this->resolveServices($argument, $file, $isParameter); @@ -739,7 +733,7 @@ private function resolveServices($value, $file, $isParameter = false) } } if ('tagged' === $value->getTag()) { - if (!is_string($argument) || !$argument) { + if (!\is_string($argument) || !$argument) { throw new InvalidArgumentException(sprintf('"!tagged" tag only accepts non empty string in "%s".', $file)); } @@ -773,17 +767,17 @@ private function resolveServices($value, $file, $isParameter = false) throw new InvalidArgumentException(sprintf('Unsupported tag "!%s".', $value->getTag())); } - if (is_array($value)) { + if (\is_array($value)) { foreach ($value as $k => $v) { $value[$k] = $this->resolveServices($v, $file, $isParameter); } - } elseif (is_string($value) && 0 === strpos($value, '@=')) { + } elseif (\is_string($value) && 0 === strpos($value, '@=')) { if (!class_exists(Expression::class)) { throw new \LogicException(sprintf('The "@=" expression syntax cannot be used without the ExpressionLanguage component. Try running "composer require symfony/expression-language".')); } return new Expression(substr($value, 2)); - } elseif (is_string($value) && 0 === strpos($value, '@')) { + } elseif (\is_string($value) && 0 === strpos($value, '@')) { if (0 === strpos($value, '@@')) { $value = substr($value, 1); $invalidBehavior = null; @@ -817,11 +811,11 @@ private function resolveServices($value, $file, $isParameter = false) private function loadFromExtensions(array $content) { foreach ($content as $namespace => $values) { - if (in_array($namespace, array('imports', 'parameters', 'services'))) { + if (\in_array($namespace, array('imports', 'parameters', 'services'))) { continue; } - if (!is_array($values) && null !== $values) { + if (!\is_array($values) && null !== $values) { $values = array(); } diff --git a/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php b/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php index ddc7e84fa..12bc7612f 100644 --- a/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php +++ b/vendor/symfony/dependency-injection/ParameterBag/EnvPlaceholderParameterBag.php @@ -11,8 +11,8 @@ namespace Symfony\Component\DependencyInjection\ParameterBag; -use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; +use Symfony\Component\DependencyInjection\Exception\RuntimeException; /** * @author Nicolas Grekas @@ -43,7 +43,7 @@ public function get($name) $defaultValue = parent::get($name); if (null !== $defaultValue && !is_scalar($defaultValue)) { - throw new RuntimeException(sprintf('The default value of an env() parameter must be scalar or null, but "%s" given to "%s".', gettype($defaultValue), $name)); + throw new RuntimeException(sprintf('The default value of an env() parameter must be scalar or null, but "%s" given to "%s".', \gettype($defaultValue), $name)); } } @@ -116,7 +116,7 @@ public function resolve() if (is_numeric($default = $this->parameters[$name])) { $this->parameters[$name] = (string) $default; } elseif (null !== $default && !is_scalar($default)) { - throw new RuntimeException(sprintf('The default value of env parameter "%s" must be scalar or null, %s given.', $env, gettype($default))); + throw new RuntimeException(sprintf('The default value of env parameter "%s" must be scalar or null, %s given.', $env, \gettype($default))); } } } diff --git a/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php b/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php index bb3e21102..e06fd344c 100644 --- a/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php +++ b/vendor/symfony/dependency-injection/ParameterBag/ParameterBag.php @@ -11,8 +11,8 @@ namespace Symfony\Component\DependencyInjection\ParameterBag; -use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; use Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException; +use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; /** @@ -78,18 +78,18 @@ public function get($name) $alternatives = array(); foreach ($this->parameters as $key => $parameterValue) { $lev = levenshtein($name, $key); - if ($lev <= strlen($name) / 3 || false !== strpos($key, $name)) { + if ($lev <= \strlen($name) / 3 || false !== strpos($key, $name)) { $alternatives[] = $key; } } $nonNestedAlternative = null; - if (!count($alternatives) && false !== strpos($name, '.')) { + if (!\count($alternatives) && false !== strpos($name, '.')) { $namePartsLength = array_map('strlen', explode('.', $name)); $key = substr($name, 0, -1 * (1 + array_pop($namePartsLength))); - while (count($namePartsLength)) { + while (\count($namePartsLength)) { if ($this->has($key)) { - if (is_array($this->get($key))) { + if (\is_array($this->get($key))) { $nonNestedAlternative = $key; } break; @@ -233,8 +233,8 @@ public function resolveString($value, array $resolving = array()) $resolved = $this->get($key); - if (!is_string($resolved) && !is_numeric($resolved)) { - throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "%s" of type %s inside string value "%s".', $key, gettype($resolved), $value)); + if (!\is_string($resolved) && !is_numeric($resolved)) { + throw new RuntimeException(sprintf('A string value must be composed of strings and/or numbers, but found parameter "%s" of type %s inside string value "%s".', $key, \gettype($resolved), $value)); } $resolved = (string) $resolved; @@ -254,11 +254,11 @@ public function isResolved() */ public function escapeValue($value) { - if (is_string($value)) { + if (\is_string($value)) { return str_replace('%', '%%', $value); } - if (is_array($value)) { + if (\is_array($value)) { $result = array(); foreach ($value as $k => $v) { $result[$k] = $this->escapeValue($v); @@ -275,11 +275,11 @@ public function escapeValue($value) */ public function unescapeValue($value) { - if (is_string($value)) { + if (\is_string($value)) { return str_replace('%%', '%', $value); } - if (is_array($value)) { + if (\is_array($value)) { $result = array(); foreach ($value as $k => $v) { $result[$k] = $this->unescapeValue($v); diff --git a/vendor/symfony/dependency-injection/ServiceLocator.php b/vendor/symfony/dependency-injection/ServiceLocator.php index 324cccab9..bdedc88e8 100644 --- a/vendor/symfony/dependency-injection/ServiceLocator.php +++ b/vendor/symfony/dependency-injection/ServiceLocator.php @@ -53,7 +53,7 @@ public function get($id) if (isset($this->loading[$id])) { $ids = array_values($this->loading); - $ids = array_slice($this->loading, array_search($id, $ids)); + $ids = \array_slice($this->loading, array_search($id, $ids)); $ids[] = $id; throw new ServiceCircularReferenceException($id, $ids); @@ -91,7 +91,7 @@ private function createServiceNotFoundMessage($id) } $class = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS, 3); - $class = isset($class[2]['object']) ? get_class($class[2]['object']) : null; + $class = isset($class[2]['object']) ? \get_class($class[2]['object']) : null; $externalId = $this->externalId ?: $class; $msg = sprintf('Service "%s" not found: ', $id); @@ -136,7 +136,7 @@ private function formatAlternatives(array $alternatives = null, $separator = 'an if (!$alternatives = array_keys($this->factories)) { return 'is empty...'; } - $format = sprintf('only knows about the %s service%s.', $format, 1 < count($alternatives) ? 's' : ''); + $format = sprintf('only knows about the %s service%s.', $format, 1 < \count($alternatives) ? 's' : ''); } $last = array_pop($alternatives); diff --git a/vendor/symfony/dependency-injection/Tests/Argument/RewindableGeneratorTest.php b/vendor/symfony/dependency-injection/Tests/Argument/RewindableGeneratorTest.php index 1415869a4..31e3f11fe 100644 --- a/vendor/symfony/dependency-injection/Tests/Argument/RewindableGeneratorTest.php +++ b/vendor/symfony/dependency-injection/Tests/Argument/RewindableGeneratorTest.php @@ -46,7 +46,7 @@ public function testCountUsesProvidedValueAsCallback() $this->assertSame(0, $called, 'Count callback is called lazily'); $this->assertCount(3, $generator); - count($generator); + \count($generator); $this->assertSame(1, $called, 'Count callback is called only once'); } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php index 7a06e10d9..8d44fad86 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/AnalyzeServiceReferencesPassTest.php @@ -13,11 +13,11 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; -use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; use Symfony\Component\DependencyInjection\Compiler\RepeatedPass; -use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Reference; class AnalyzeServiceReferencesPassTest extends TestCase { diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/AutowirePassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/AutowirePassTest.php index 924a49094..a21687723 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/AutowirePassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/AutowirePassTest.php @@ -13,8 +13,8 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Config\FileLocator; -use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass; use Symfony\Component\DependencyInjection\Compiler\AutowirePass; +use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass; use Symfony\Component\DependencyInjection\Compiler\ResolveClassPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Exception\AutowiringFailedException; diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/AutowireRequiredMethodsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/AutowireRequiredMethodsPassTest.php index 3b067150f..07c9f9d77 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/AutowireRequiredMethodsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/AutowireRequiredMethodsPassTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\DependencyInjection\Tests\Compiler; use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\Compiler\ResolveClassPass; use Symfony\Component\DependencyInjection\Compiler\AutowireRequiredMethodsPass; +use Symfony\Component\DependencyInjection\Compiler\ResolveClassPass; use Symfony\Component\DependencyInjection\ContainerBuilder; require_once __DIR__.'/../Fixtures/includes/autowiring_classes.php'; diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/CheckCircularReferencesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/CheckCircularReferencesPassTest.php index e8a526e72..a87dc44a9 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/CheckCircularReferencesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/CheckCircularReferencesPassTest.php @@ -13,11 +13,11 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass; use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; +use Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass; use Symfony\Component\DependencyInjection\Compiler\Compiler; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; class CheckCircularReferencesPassTest extends TestCase { diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php index ac002d834..631c344ff 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/CheckExceptionOnInvalidReferenceBehaviorPassTest.php @@ -13,10 +13,10 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Argument\BoundArgument; -use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Compiler\CheckExceptionOnInvalidReferenceBehaviorPass; -use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Reference; class CheckExceptionOnInvalidReferenceBehaviorPassTest extends TestCase { @@ -68,27 +68,6 @@ public function testProcessThrowsExceptionOnInvalidReferenceFromInlinedDefinitio $this->process($container); } - /** - * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException - * @expectedExceptionMessage Invalid ignore-on-uninitialized reference found in service - */ - public function testProcessThrowsExceptionOnNonSharedUninitializedReference() - { - $container = new ContainerBuilder(); - - $container - ->register('a', 'stdClass') - ->addArgument(new Reference('b', $container::IGNORE_ON_UNINITIALIZED_REFERENCE)) - ; - - $container - ->register('b', 'stdClass') - ->setShared(false) - ; - - $this->process($container); - } - public function testProcessDefinitionWithBindings() { $container = new ContainerBuilder(); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/CheckReferenceValidityPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/CheckReferenceValidityPassTest.php index 231520cd7..22b6fd154 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/CheckReferenceValidityPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/CheckReferenceValidityPassTest.php @@ -13,8 +13,8 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Compiler\CheckReferenceValidityPass; -use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; class CheckReferenceValidityPassTest extends TestCase { diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/DecoratorServicePassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/DecoratorServicePassTest.php index 4430e83e9..fe1334e91 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/DecoratorServicePassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/DecoratorServicePassTest.php @@ -13,8 +13,8 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Alias; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\DecoratorServicePass; +use Symfony\Component\DependencyInjection\ContainerBuilder; class DecoratorServicePassTest extends TestCase { @@ -168,6 +168,29 @@ public function testProcessMergesAutowiringTypesInDecoratingDefinitionAndRemoveT $this->assertEmpty($container->getDefinition('child.inner')->getAutowiringTypes()); } + public function testProcessMovesTagsFromDecoratedDefinitionToDecoratingDefinitionMultipleTimes() + { + $container = new ContainerBuilder(); + $container + ->register('foo') + ->setPublic(true) + ->setTags(array('bar' => array('attr' => 'baz'))) + ; + $container + ->register('deco1') + ->setDecoratedService('foo', null, 50) + ; + $container + ->register('deco2') + ->setDecoratedService('foo', null, 2) + ; + + $this->process($container); + + $this->assertEmpty($container->getDefinition('deco1')->getTags()); + $this->assertEquals(array('bar' => array('attr' => 'baz')), $container->getDefinition('deco2')->getTags()); + } + protected function process(ContainerBuilder $container) { $repeatedPass = new DecoratorServicePass(); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/FactoryReturnTypePassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/FactoryReturnTypePassTest.php index f299463d5..bfb61c373 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/FactoryReturnTypePassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/FactoryReturnTypePassTest.php @@ -15,8 +15,8 @@ use Symfony\Component\DependencyInjection\Compiler\FactoryReturnTypePass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\Tests\Fixtures\factoryFunction; use Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryDummy; +use Symfony\Component\DependencyInjection\Tests\Fixtures\factoryFunction; use Symfony\Component\DependencyInjection\Tests\Fixtures\FactoryParent; /** @@ -59,7 +59,7 @@ public function testProcess() */ public function testReturnTypes($factory, $returnType, $hhvmSupport = true) { - if (!$hhvmSupport && defined('HHVM_VERSION')) { + if (!$hhvmSupport && \defined('HHVM_VERSION')) { $this->markTestSkipped('Scalar typehints not supported by hhvm.'); } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php index adaa4044f..b2ad6f947 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/InlineServiceDefinitionsPassTest.php @@ -12,14 +12,14 @@ namespace Symfony\Component\DependencyInjection\Tests\Compiler; use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Argument\IteratorArgument; +use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; -use Symfony\Component\DependencyInjection\Compiler\RepeatedPass; use Symfony\Component\DependencyInjection\Compiler\InlineServiceDefinitionsPass; -use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Compiler\RepeatedPass; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\Argument\IteratorArgument; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Reference; class InlineServiceDefinitionsPassTest extends TestCase { @@ -92,7 +92,7 @@ public function testProcessDoesInlineNonSharedService() $this->assertNotSame($container->getDefinition('bar'), $arguments[2]); } - public function testProcessInlinesMixedServicesLoop() + public function testProcessDoesNotInlineMixedServicesLoop() { $container = new ContainerBuilder(); $container @@ -108,7 +108,7 @@ public function testProcessInlinesMixedServicesLoop() $this->process($container); - $this->assertEquals($container->getDefinition('foo')->getArgument(0), $container->getDefinition('bar')); + $this->assertEquals(new Reference('bar'), $container->getDefinition('foo')->getArgument(0)); } /** diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/IntegrationTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/IntegrationTest.php index 15c827d82..09ba6ab45 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/IntegrationTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/IntegrationTest.php @@ -14,9 +14,9 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\Alias; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; /** * This class tests the integration of the different compiler passes. @@ -123,7 +123,7 @@ public function testProcessInlinesWhenThereAreMultipleReferencesButFromTheSameDe public function testYamlContainerCompiles($directory, $actualServiceId, $expectedServiceId, ContainerBuilder $mainContainer = null) { // allow a container to be passed in, which might have autoconfigure settings - $container = $mainContainer ? $mainContainer : new ContainerBuilder(); + $container = $mainContainer ?: new ContainerBuilder(); $container->setResourceTracking(false); $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../Fixtures/yaml/integration/'.$directory)); $loader->load('main.yml'); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/MergeExtensionConfigurationPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/MergeExtensionConfigurationPassTest.php index 77872720a..3ebd3f5e5 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/MergeExtensionConfigurationPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/MergeExtensionConfigurationPassTest.php @@ -15,8 +15,8 @@ use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass; use Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationContainerBuilder; +use Symfony\Component\DependencyInjection\Compiler\MergeExtensionConfigurationPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/PassConfigTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/PassConfigTest.php index d9444ca89..1fd772ee6 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/PassConfigTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/PassConfigTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\DependencyInjection\Tests\Compiler; use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\Compiler\PassConfig; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\Compiler\PassConfig; /** * @author Guilhem N diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php index c6f4e5e79..fd26561a2 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/RemoveUnusedDefinitionsPassTest.php @@ -13,12 +13,12 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Compiler\AnalyzeServiceReferencesPass; -use Symfony\Component\DependencyInjection\Compiler\RepeatedPass; use Symfony\Component\DependencyInjection\Compiler\RemoveUnusedDefinitionsPass; +use Symfony\Component\DependencyInjection\Compiler\RepeatedPass; use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; class RemoveUnusedDefinitionsPassTest extends TestCase { diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveBindingsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveBindingsPassTest.php index 16e486afa..d59b95af5 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveBindingsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveBindingsPassTest.php @@ -17,8 +17,9 @@ use Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy; use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass; +use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy; +use Symfony\Component\DependencyInjection\Tests\Fixtures\ParentNotExists; use Symfony\Component\DependencyInjection\TypedReference; require_once __DIR__.'/../Fixtures/includes/autowiring_classes.php'; @@ -61,6 +62,21 @@ public function testUnusedBinding() $pass->process($container); } + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\InvalidArgumentException + * @expectedExceptionMessageRegexp Unused binding "$quz" in service [\s\S]+ Invalid service ".*\\ParentNotExists": class NotExists not found\. + */ + public function testMissingParent() + { + $container = new ContainerBuilder(); + + $definition = $container->register(ParentNotExists::class, ParentNotExists::class); + $definition->setBindings(array('$quz' => '123')); + + $pass = new ResolveBindingsPass(); + $pass->process($container); + } + public function testTypedReferenceSupport() { $container = new ContainerBuilder(); diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveChildDefinitionsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveChildDefinitionsPassTest.php index 23a1915fd..1575bd7b0 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveChildDefinitionsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveChildDefinitionsPassTest.php @@ -260,23 +260,23 @@ public function testDeepDefinitionsResolving() $this->process($container); $configurator = $container->getDefinition('sibling')->getConfigurator(); - $this->assertSame('Symfony\Component\DependencyInjection\Definition', get_class($configurator)); + $this->assertSame('Symfony\Component\DependencyInjection\Definition', \get_class($configurator)); $this->assertSame('parentClass', $configurator->getClass()); $factory = $container->getDefinition('sibling')->getFactory(); - $this->assertSame('Symfony\Component\DependencyInjection\Definition', get_class($factory[0])); + $this->assertSame('Symfony\Component\DependencyInjection\Definition', \get_class($factory[0])); $this->assertSame('parentClass', $factory[0]->getClass()); $argument = $container->getDefinition('sibling')->getArgument(0); - $this->assertSame('Symfony\Component\DependencyInjection\Definition', get_class($argument)); + $this->assertSame('Symfony\Component\DependencyInjection\Definition', \get_class($argument)); $this->assertSame('parentClass', $argument->getClass()); $properties = $container->getDefinition('sibling')->getProperties(); - $this->assertSame('Symfony\Component\DependencyInjection\Definition', get_class($properties['prop'])); + $this->assertSame('Symfony\Component\DependencyInjection\Definition', \get_class($properties['prop'])); $this->assertSame('parentClass', $properties['prop']->getClass()); $methodCalls = $container->getDefinition('sibling')->getMethodCalls(); - $this->assertSame('Symfony\Component\DependencyInjection\Definition', get_class($methodCalls[0][1][0])); + $this->assertSame('Symfony\Component\DependencyInjection\Definition', \get_class($methodCalls[0][1][0])); $this->assertSame('parentClass', $methodCalls[0][1][0]->getClass()); } @@ -382,6 +382,27 @@ public function testProcessSetsArguments() $this->assertSame(array(2, 1, 'foo' => 3), $def->getArguments()); } + public function testBindings() + { + $container = new ContainerBuilder(); + + $container->register('parent', 'stdClass') + ->setBindings(array('a' => '1', 'b' => '2')) + ; + + $child = $container->setDefinition('child', new ChildDefinition('parent')) + ->setBindings(array('b' => 'B', 'c' => 'C')) + ; + + $this->process($container); + + $bindings = array(); + foreach ($container->getDefinition('child')->getBindings() as $k => $v) { + $bindings[$k] = $v->getValues()[0]; + } + $this->assertEquals(array('b' => 'B', 'c' => 'C', 'a' => '1'), $bindings); + } + public function testSetAutoconfiguredOnServiceIsParent() { $container = new ContainerBuilder(); @@ -410,4 +431,21 @@ protected function process(ContainerBuilder $container) $pass = new ResolveChildDefinitionsPass(); $pass->process($container); } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException + * @expectedExceptionMessageRegExp /^Circular reference detected for service "c", path: "c -> b -> a -> c"./ + */ + public function testProcessDetectsChildDefinitionIndirectCircularReference() + { + $container = new ContainerBuilder(); + + $container->register('a'); + + $container->setDefinition('b', new ChildDefinition('a')); + $container->setDefinition('c', new ChildDefinition('b')); + $container->setDefinition('a', new ChildDefinition('c')); + + $this->process($container); + } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php index 21a281057..ad6f79d40 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInstanceofConditionalsPassTest.php @@ -12,9 +12,10 @@ namespace Symfony\Component\DependencyInjection\Tests\Compiler; use PHPUnit\Framework\TestCase; +use Symfony\Component\DependencyInjection\Argument\BoundArgument; use Symfony\Component\DependencyInjection\ChildDefinition; -use Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass; use Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass; +use Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass; use Symfony\Component\DependencyInjection\ContainerBuilder; class ResolveInstanceofConditionalsPassTest extends TestCase @@ -250,4 +251,18 @@ public function testMergeReset() $this->assertEmpty($abstract->getTags()); $this->assertTrue($abstract->isAbstract()); } + + public function testBindings() + { + $container = new ContainerBuilder(); + $def = $container->register('foo', self::class)->setBindings(array('$toto' => 123)); + $def->setInstanceofConditionals(array(parent::class => new ChildDefinition(''))); + + (new ResolveInstanceofConditionalsPass())->process($container); + + $bindings = $container->getDefinition('foo')->getBindings(); + $this->assertSame(array('$toto'), array_keys($bindings)); + $this->assertInstanceOf(BoundArgument::class, $bindings['$toto']); + $this->assertSame(123, $bindings['$toto']->getValues()[0]); + } } diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInvalidReferencesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInvalidReferencesPassTest.php index 00613ba5c..61bad48a5 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInvalidReferencesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveInvalidReferencesPassTest.php @@ -13,10 +13,10 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Compiler\ResolveInvalidReferencesPass; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Reference; class ResolveInvalidReferencesPassTest extends TestCase { diff --git a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php index c22ab59ea..6fb619718 100644 --- a/vendor/symfony/dependency-injection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php +++ b/vendor/symfony/dependency-injection/Tests/Compiler/ResolveReferencesToAliasesPassTest.php @@ -13,10 +13,10 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Alias; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Compiler\ResolveReferencesToAliasesPass; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; +use Symfony\Component\DependencyInjection\Reference; class ResolveReferencesToAliasesPassTest extends TestCase { diff --git a/vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php b/vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php index 51038b6b1..0bf1befa3 100644 --- a/vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php +++ b/vendor/symfony/dependency-injection/Tests/ContainerBuilderTest.php @@ -17,8 +17,9 @@ use PHPUnit\Framework\TestCase; use Psr\Container\ContainerInterface as PsrContainerInterface; use Symfony\Component\Config\Resource\ComposerResource; -use Symfony\Component\Config\Resource\ResourceInterface; use Symfony\Component\Config\Resource\DirectoryResource; +use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Config\Resource\ResourceInterface; use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; @@ -31,15 +32,14 @@ use Symfony\Component\DependencyInjection\Exception\RuntimeException; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\DependencyInjection\Loader\ClosureLoader; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy; -use Symfony\Component\DependencyInjection\TypedReference; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\ParameterBag\EnvPlaceholderParameterBag; -use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; +use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ServiceLocator; -use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition; use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass; +use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition; +use Symfony\Component\DependencyInjection\Tests\Fixtures\SimilarArgumentsDummy; +use Symfony\Component\DependencyInjection\TypedReference; use Symfony\Component\ExpressionLanguage\Expression; class ContainerBuilderTest extends TestCase @@ -333,7 +333,7 @@ public function testAddGetCompilerPass() $builder->addCompilerPass($pass2 = $this->getMockBuilder('Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface')->getMock(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 10); $passes = $builder->getCompiler()->getPassConfig()->getPasses(); - $this->assertCount(count($passes) - 2, $defaultPasses); + $this->assertCount(\count($passes) - 2, $defaultPasses); // Pass 1 is executed later $this->assertTrue(array_search($pass1, $passes, true) > array_search($pass2, $passes, true)); } @@ -358,7 +358,7 @@ public function testCreateProxyWithRealServiceInstantiator() $foo1 = $builder->get('foo1'); $this->assertSame($foo1, $builder->get('foo1'), 'The same proxy is retrieved on multiple subsequent calls'); - $this->assertSame('Bar\FooClass', get_class($foo1)); + $this->assertSame('Bar\FooClass', \get_class($foo1)); } public function testCreateServiceClass() @@ -665,17 +665,49 @@ public function testCompileWithResolveEnv() putenv('DUMMY_ENV_VAR'); } + public function testCompileWithArrayResolveEnv() + { + putenv('ARRAY={"foo":"bar"}'); + + $container = new ContainerBuilder(); + $container->setParameter('foo', '%env(json:ARRAY)%'); + $container->compile(true); + + $this->assertSame(array('foo' => 'bar'), $container->getParameter('foo')); + + putenv('ARRAY'); + } + + public function testCompileWithArrayAndAnotherResolveEnv() + { + putenv('DUMMY_ENV_VAR=abc'); + putenv('ARRAY={"foo":"bar"}'); + + $container = new ContainerBuilder(); + $container->setParameter('foo', '%env(json:ARRAY)%'); + $container->setParameter('bar', '%env(DUMMY_ENV_VAR)%'); + $container->compile(true); + + $this->assertSame(array('foo' => 'bar'), $container->getParameter('foo')); + $this->assertSame('abc', $container->getParameter('bar')); + + putenv('DUMMY_ENV_VAR'); + putenv('ARRAY'); + } + /** * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException - * @expectedExceptionMessage A string value must be composed of strings and/or numbers, but found parameter "env(ARRAY)" of type array inside string value "ABC %env(ARRAY)%". + * @expectedExceptionMessage A string value must be composed of strings and/or numbers, but found parameter "env(json:ARRAY)" of type array inside string value "ABC %env(json:ARRAY)%". */ - public function testCompileWithArrayResolveEnv() + public function testCompileWithArrayInStringResolveEnv() { - $bag = new TestingEnvPlaceholderParameterBag(); - $container = new ContainerBuilder($bag); - $container->setParameter('foo', '%env(ARRAY)%'); - $container->setParameter('bar', 'ABC %env(ARRAY)%'); + putenv('ARRAY={"foo":"bar"}'); + + $container = new ContainerBuilder(); + $container->setParameter('foo', 'ABC %env(json:ARRAY)%'); $container->compile(true); + + putenv('ARRAY'); } /** @@ -966,7 +998,7 @@ public function testFileExists() $A = new ComposerResource(); $a = new FileResource(__DIR__.'/Fixtures/xml/services1.xml'); $b = new FileResource(__DIR__.'/Fixtures/xml/services2.xml'); - $c = new DirectoryResource($dir = dirname($b)); + $c = new DirectoryResource($dir = \dirname($b)); $this->assertTrue($container->fileExists((string) $a) && $container->fileExists((string) $b) && $container->fileExists($dir)); @@ -1232,6 +1264,30 @@ public function testNoClassFromGlobalNamespaceClassId() $container->compile(); } + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException + * @expectedExceptionMessage The definition for "\DateTime" has no class attribute, and appears to reference a class or interface in the global namespace. + */ + public function testNoClassFromGlobalNamespaceClassIdWithLeadingSlash() + { + $container = new ContainerBuilder(); + + $container->register('\\'.\DateTime::class); + $container->compile(); + } + + /** + * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException + * @expectedExceptionMessage The definition for "\Symfony\Component\DependencyInjection\Tests\FooClass" has no class attribute, and appears to reference a class or interface. Please specify the class attribute explicitly or remove the leading backslash by renaming the service to "Symfony\Component\DependencyInjection\Tests\FooClass" to get rid of this error. + */ + public function testNoClassFromNamespaceClassIdWithLeadingSlash() + { + $container = new ContainerBuilder(); + + $container->register('\\'.FooClass::class); + $container->compile(); + } + /** * @expectedException \Symfony\Component\DependencyInjection\Exception\RuntimeException * @expectedExceptionMessage The definition for "123_abc" has no class. @@ -1323,6 +1379,17 @@ public function testAlmostCircular($visibility) $foo5 = $container->get('foo5'); $this->assertSame($foo5, $foo5->bar->foo); + + $manager = $container->get('manager'); + $this->assertEquals(new \stdClass(), $manager); + + $manager = $container->get('manager2'); + $this->assertEquals(new \stdClass(), $manager); + + $foo6 = $container->get('foo6'); + $this->assertEquals((object) array('bar6' => (object) array()), $foo6); + + $this->assertInstanceOf(\stdClass::class, $container->get('root')); } public function provideAlmostCircular() @@ -1402,6 +1469,37 @@ public function testArgumentsHaveHigherPriorityThanBindings() $this->assertSame('via-argument', $container->get('foo')->class1->identifier); $this->assertSame('via-bindings', $container->get('foo')->class2->identifier); } + + public function testUninitializedSyntheticReference() + { + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setPublic(true)->setSynthetic(true); + $container->register('bar', 'stdClass')->setPublic(true)->setShared(false) + ->setProperty('foo', new Reference('foo', ContainerInterface::IGNORE_ON_UNINITIALIZED_REFERENCE)); + + $container->compile(); + + $this->assertEquals((object) array('foo' => null), $container->get('bar')); + + $container->set('foo', (object) array(123)); + $this->assertEquals((object) array('foo' => (object) array(123)), $container->get('bar')); + } + + public function testDecoratedSelfReferenceInvolvingPrivateServices() + { + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass') + ->setPublic(false) + ->setProperty('bar', new Reference('foo')); + $container->register('baz', 'stdClass') + ->setPublic(false) + ->setProperty('inner', new Reference('baz.inner')) + ->setDecoratedService('foo'); + + $container->compile(); + + $this->assertSame(array('service_container'), array_keys($container->getDefinitions())); + } } class FooClass @@ -1418,11 +1516,3 @@ public function __construct(A $a) { } } - -class TestingEnvPlaceholderParameterBag extends EnvPlaceholderParameterBag -{ - public function get($name) - { - return 'env(array)' === strtolower($name) ? array(123) : parent::get($name); - } -} diff --git a/vendor/symfony/dependency-injection/Tests/ContainerTest.php b/vendor/symfony/dependency-injection/Tests/ContainerTest.php index 430710707..a57f78797 100644 --- a/vendor/symfony/dependency-injection/Tests/ContainerTest.php +++ b/vendor/symfony/dependency-injection/Tests/ContainerTest.php @@ -15,8 +15,8 @@ use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\Container; use Symfony\Component\DependencyInjection\ContainerInterface; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\ParameterBag\FrozenParameterBag; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; class ContainerTest extends TestCase { diff --git a/vendor/symfony/dependency-injection/Tests/CrossCheckTest.php b/vendor/symfony/dependency-injection/Tests/CrossCheckTest.php index bcfe88acc..6ec9d33f5 100644 --- a/vendor/symfony/dependency-injection/Tests/CrossCheckTest.php +++ b/vendor/symfony/dependency-injection/Tests/CrossCheckTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\DependencyInjection\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\ContainerBuilder; class CrossCheckTest extends TestCase { diff --git a/vendor/symfony/dependency-injection/Tests/Dumper/GraphvizDumperTest.php b/vendor/symfony/dependency-injection/Tests/Dumper/GraphvizDumperTest.php index ffdd0730c..3c40bb550 100644 --- a/vendor/symfony/dependency-injection/Tests/Dumper/GraphvizDumperTest.php +++ b/vendor/symfony/dependency-injection/Tests/Dumper/GraphvizDumperTest.php @@ -13,7 +13,9 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Dumper\GraphvizDumper; +use Symfony\Component\DependencyInjection\Reference; class GraphvizDumperTest extends TestCase { @@ -32,11 +34,11 @@ public function testDump() $container = include self::$fixturesPath.'/containers/container9.php'; $dumper = new GraphvizDumper($container); - $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services9.dot')), $dumper->dump(), '->dump() dumps services'); + $this->assertStringEqualsFile(self::$fixturesPath.'/graphviz/services9.dot', $dumper->dump(), '->dump() dumps services'); $container = include self::$fixturesPath.'/containers/container10.php'; $dumper = new GraphvizDumper($container); - $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services10.dot')), $dumper->dump(), '->dump() dumps services'); + $this->assertStringEqualsFile(self::$fixturesPath.'/graphviz/services10.dot', $dumper->dump(), '->dump() dumps services'); $container = include self::$fixturesPath.'/containers/container10.php'; $dumper = new GraphvizDumper($container); @@ -47,21 +49,21 @@ public function testDump() 'node.instance' => array('fillcolor' => 'green', 'style' => 'empty'), 'node.definition' => array('fillcolor' => 'grey'), 'node.missing' => array('fillcolor' => 'red', 'style' => 'empty'), - )), str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services10-1.dot')), '->dump() dumps services'); + )), file_get_contents(self::$fixturesPath.'/graphviz/services10-1.dot'), '->dump() dumps services'); } public function testDumpWithFrozenContainer() { $container = include self::$fixturesPath.'/containers/container13.php'; $dumper = new GraphvizDumper($container); - $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services13.dot')), $dumper->dump(), '->dump() dumps services'); + $this->assertStringEqualsFile(self::$fixturesPath.'/graphviz/services13.dot', $dumper->dump(), '->dump() dumps services'); } public function testDumpWithFrozenCustomClassContainer() { $container = include self::$fixturesPath.'/containers/container14.php'; $dumper = new GraphvizDumper($container); - $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services14.dot')), $dumper->dump(), '->dump() dumps services'); + $this->assertStringEqualsFile(self::$fixturesPath.'/graphviz/services14.dot', $dumper->dump(), '->dump() dumps services'); } public function testDumpWithUnresolvedParameter() @@ -69,6 +71,18 @@ public function testDumpWithUnresolvedParameter() $container = include self::$fixturesPath.'/containers/container17.php'; $dumper = new GraphvizDumper($container); - $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath.'/graphviz/services17.dot')), $dumper->dump(), '->dump() dumps services'); + $this->assertStringEqualsFile(self::$fixturesPath.'/graphviz/services17.dot', $dumper->dump(), '->dump() dumps services'); + } + + public function testDumpWithInlineDefinition() + { + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->addArgument( + (new Definition('stdClass'))->addArgument(new Reference('bar')) + ); + $container->register('bar', 'stdClass'); + $dumper = new GraphvizDumper($container); + + $this->assertStringEqualsFile(self::$fixturesPath.'/graphviz/services_inline.dot', $dumper->dump(), '->dump() dumps nested references'); } } diff --git a/vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php b/vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php index 56046e735..51c5fd21f 100644 --- a/vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php +++ b/vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php @@ -11,7 +11,6 @@ namespace Symfony\Component\DependencyInjection\Tests\Dumper; -use DummyProxyDumper; use PHPUnit\Framework\TestCase; use Psr\Container\ContainerInterface; use Symfony\Component\Config\FileLocator; @@ -21,18 +20,19 @@ use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface as SymfonyContainerInterface; +use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; use Symfony\Component\DependencyInjection\EnvVarProcessorInterface; +use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Parameter; use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator; -use Symfony\Component\DependencyInjection\TypedReference; -use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\DependencyInjection\Tests\Fixtures\CustomDefinition; +use Symfony\Component\DependencyInjection\Tests\Fixtures\StubbedTranslator; use Symfony\Component\DependencyInjection\Tests\Fixtures\TestServiceSubscriber; +use Symfony\Component\DependencyInjection\TypedReference; use Symfony\Component\DependencyInjection\Variable; use Symfony\Component\ExpressionLanguage\Expression; @@ -97,10 +97,10 @@ public function testDumpRelativeDir() $container = new ContainerBuilder(); $container->setDefinition('test', $definition); - $container->setParameter('foo', 'wiz'.dirname(__DIR__)); + $container->setParameter('foo', 'wiz'.\dirname(__DIR__)); $container->setParameter('bar', __DIR__); $container->setParameter('baz', '%bar%/PhpDumperTest.php'); - $container->setParameter('buz', dirname(dirname(__DIR__))); + $container->setParameter('buz', \dirname(\dirname(__DIR__))); $container->compile(); $dumper = new PhpDumper($container); @@ -185,7 +185,7 @@ public function testAddServiceWithoutCompilation() { $container = include self::$fixturesPath.'/containers/container9.php'; $dumper = new PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/services9.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services'); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services9.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.\DIRECTORY_SEPARATOR.'includes'.\DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services'); } public function testAddService() @@ -193,7 +193,7 @@ public function testAddService() $container = include self::$fixturesPath.'/containers/container9.php'; $container->compile(); $dumper = new PhpDumper($container); - $this->assertStringEqualsFile(self::$fixturesPath.'/php/services9_compiled.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services'); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services9_compiled.php', str_replace(str_replace('\\', '\\\\', self::$fixturesPath.\DIRECTORY_SEPARATOR.'includes'.\DIRECTORY_SEPARATOR), '%path%', $dumper->dump()), '->dump() dumps services'); $container = new ContainerBuilder(); $container->register('foo', 'FooClass')->addArgument(new \stdClass())->setPublic(true); @@ -215,7 +215,7 @@ public function testDumpAsFiles() $container->compile(); $dumper = new PhpDumper($container); $dump = print_r($dumper->dump(array('as_files' => true, 'file' => __DIR__, 'hot_path_tag' => 'hot')), true); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $dump = str_replace('\\\\Fixtures\\\\includes\\\\foo.php', '/Fixtures/includes/foo.php', $dump); } $this->assertStringMatchesFormatFile(self::$fixturesPath.'/php/services9_as_files.txt', $dump); @@ -390,8 +390,8 @@ public function testResolvedBase64EnvParameters() $container->compile(true); $expected = array( - 'env(foo)' => 'd29ybGQ=', - 'hello' => 'world', + 'env(foo)' => 'd29ybGQ=', + 'hello' => 'world', ); $this->assertSame($expected, $container->getParameterBag()->all()); } @@ -490,6 +490,19 @@ public function testInlinedDefinitionReferencingServiceContainer() $this->assertStringEqualsFile(self::$fixturesPath.'/php/services13.php', $dumper->dump(), '->dump() dumps inline definitions which reference service_container'); } + public function testNonSharedLazyDefinitionReferences() + { + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setShared(false)->setLazy(true); + $container->register('bar', 'stdClass')->addArgument(new Reference('foo', ContainerBuilder::EXCEPTION_ON_INVALID_REFERENCE, false)); + $container->compile(); + + $dumper = new PhpDumper($container); + $dumper->setProxyDumper(new \DummyProxyDumper()); + + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_non_shared_lazy.php', $dumper->dump()); + } + public function testInitializePropertiesBeforeMethodCalls() { require_once self::$fixturesPath.'/includes/classes.php'; @@ -518,50 +531,35 @@ public function testCircularReferenceAllowanceForLazyServices() $container->compile(); $dumper = new PhpDumper($container); + $dumper->setProxyDumper(new \DummyProxyDumper()); $dumper->dump(); $this->addToAssertionCount(1); - } - - public function testCircularReferenceAllowanceForInlinedDefinitionsForLazyServices() - { - /* - * test graph: - * [connection] -> [event_manager] --> [entity_manager](lazy) - * | - * --(call)- addEventListener ("@lazy_service") - * - * [lazy_service](lazy) -> [entity_manager](lazy) - * - */ - - $container = new ContainerBuilder(); - - $eventManagerDefinition = new Definition('stdClass'); - - $connectionDefinition = $container->register('connection', 'stdClass')->setPublic(true); - $connectionDefinition->addArgument($eventManagerDefinition); - $container->register('entity_manager', 'stdClass') - ->setPublic(true) - ->setLazy(true) - ->addArgument(new Reference('connection')); + $dumper = new PhpDumper($container); - $lazyServiceDefinition = $container->register('lazy_service', 'stdClass'); - $lazyServiceDefinition->setPublic(true); - $lazyServiceDefinition->setLazy(true); - $lazyServiceDefinition->addArgument(new Reference('entity_manager')); + $message = 'Circular reference detected for service "foo", path: "foo -> bar -> foo". Try running "composer require symfony/proxy-manager-bridge".'; + if (method_exists($this, 'expectException')) { + $this->expectException(ServiceCircularReferenceException::class); + $this->expectExceptionMessage($message); + } else { + $this->setExpectedException(ServiceCircularReferenceException::class, $message); + } - $eventManagerDefinition->addMethodCall('addEventListener', array(new Reference('lazy_service'))); + $dumper->dump(); + } + public function testDedupLazyProxy() + { + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setLazy(true)->setPublic(true); + $container->register('bar', 'stdClass')->setLazy(true)->setPublic(true); $container->compile(); $dumper = new PhpDumper($container); + $dumper->setProxyDumper(new \DummyProxyDumper()); - $dumper->setProxyDumper(new DummyProxyDumper()); - $dumper->dump(); - - $this->addToAssertionCount(1); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_dedup_lazy_proxy.php', $dumper->dump()); } public function testLazyArgumentProvideGenerator() @@ -826,6 +824,17 @@ public function testAlmostCircular($visibility) $foo5 = $container->get('foo5'); $this->assertSame($foo5, $foo5->bar->foo); + + $manager = $container->get('manager'); + $this->assertEquals(new \stdClass(), $manager); + + $manager = $container->get('manager2'); + $this->assertEquals(new \stdClass(), $manager); + + $foo6 = $container->get('foo6'); + $this->assertEquals((object) array('bar6' => (object) array()), $foo6); + + $this->assertInstanceOf(\stdClass::class, $container->get('root')); } public function provideAlmostCircular() @@ -834,6 +843,50 @@ public function provideAlmostCircular() yield array('private'); } + public function testDeepServiceGraph() + { + $container = new ContainerBuilder(); + + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); + $loader->load('services_deep_graph.yml'); + + $container->compile(); + + $dumper = new PhpDumper($container); + $dumper->dump(); + + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_deep_graph.php', $dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Deep_Graph'))); + + require self::$fixturesPath.'/php/services_deep_graph.php'; + + $container = new \Symfony_DI_PhpDumper_Test_Deep_Graph(); + + $this->assertInstanceOf(FooForDeepGraph::class, $container->get('foo')); + $this->assertEquals((object) array('p2' => (object) array('p3' => (object) array())), $container->get('foo')->bClone); + } + + public function testInlineSelfRef() + { + $container = new ContainerBuilder(); + + $bar = (new Definition('App\Bar')) + ->setProperty('foo', new Reference('App\Foo')); + + $baz = (new Definition('App\Baz')) + ->setProperty('bar', $bar) + ->addArgument($bar); + + $container->register('App\Foo') + ->setPublic(true) + ->addArgument($baz); + + $passConfig = $container->getCompiler()->getPassConfig(); + $container->compile(); + + $dumper = new PhpDumper($container); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_inline_self_ref.php', $dumper->dump(array('class' => 'Symfony_DI_PhpDumper_Test_Inline_Self_Ref'))); + } + public function testHotPathOptimizations() { $container = include self::$fixturesPath.'/containers/container_inline_requires.php'; @@ -842,7 +895,7 @@ public function testHotPathOptimizations() $dumper = new PhpDumper($container); $dump = $dumper->dump(array('hot_path_tag' => 'container.hot_path', 'inline_class_loader_parameter' => 'inline_requires', 'file' => self::$fixturesPath.'/php/services_inline_requires.php')); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $dump = str_replace("'\\\\includes\\\\HotPath\\\\", "'/includes/HotPath/", $dump); } @@ -888,6 +941,41 @@ public function testDumpHandlesObjectClassNames() $this->assertInstanceOf('stdClass', $container->get('bar')); } + public function testUninitializedSyntheticReference() + { + $container = new ContainerBuilder(); + $container->register('foo', 'stdClass')->setPublic(true)->setSynthetic(true); + $container->register('bar', 'stdClass')->setPublic(true)->setShared(false) + ->setProperty('foo', new Reference('foo', ContainerBuilder::IGNORE_ON_UNINITIALIZED_REFERENCE)); + + $container->compile(); + + $dumper = new PhpDumper($container); + eval('?>'.$dumper->dump(array( + 'class' => 'Symfony_DI_PhpDumper_Test_UninitializedSyntheticReference', + 'inline_class_loader_parameter' => 'inline_requires', + ))); + + $container = new \Symfony_DI_PhpDumper_Test_UninitializedSyntheticReference(); + + $this->assertEquals((object) array('foo' => null), $container->get('bar')); + + $container->set('foo', (object) array(123)); + $this->assertEquals((object) array('foo' => (object) array(123)), $container->get('bar')); + } + + public function testAdawsonContainer() + { + $container = new ContainerBuilder(); + $loader = new YamlFileLoader($container, new FileLocator(self::$fixturesPath.'/yaml')); + $loader->load('services_adawson.yml'); + $container->compile(); + + $dumper = new PhpDumper($container); + $dump = $dumper->dump(); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_adawson.php', $dumper->dump()); + } + /** * @group legacy * @expectedDeprecation The "private" service is private, getting it from the container is deprecated since Symfony 3.2 and will fail in 4.0. You should either make the service public, or stop using the container directly and use dependency injection instead. @@ -1035,3 +1123,14 @@ public static function getProvidedTypes() return array('rot13' => 'string'); } } + +class FooForDeepGraph +{ + public $bClone; + + public function __construct(\stdClass $a, \stdClass $b) + { + // clone to verify that $b has been fully initialized before + $this->bClone = clone $b; + } +} diff --git a/vendor/symfony/dependency-injection/Tests/Dumper/XmlDumperTest.php b/vendor/symfony/dependency-injection/Tests/Dumper/XmlDumperTest.php index 2e4ccf1fd..f33b3b8d7 100644 --- a/vendor/symfony/dependency-injection/Tests/Dumper/XmlDumperTest.php +++ b/vendor/symfony/dependency-injection/Tests/Dumper/XmlDumperTest.php @@ -54,7 +54,7 @@ public function testAddService() $container = include self::$fixturesPath.'/containers/container9.php'; $dumper = new XmlDumper($container); - $this->assertEquals(str_replace('%path%', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/xml/services9.xml')), $dumper->dump(), '->dump() dumps services'); + $this->assertEquals(str_replace('%path%', self::$fixturesPath.\DIRECTORY_SEPARATOR.'includes'.\DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/xml/services9.xml')), $dumper->dump(), '->dump() dumps services'); $dumper = new XmlDumper($container = new ContainerBuilder()); $container->register('foo', 'FooClass')->addArgument(new \stdClass())->setPublic(true); diff --git a/vendor/symfony/dependency-injection/Tests/Dumper/YamlDumperTest.php b/vendor/symfony/dependency-injection/Tests/Dumper/YamlDumperTest.php index 2a34692c5..ff2239fb6 100644 --- a/vendor/symfony/dependency-injection/Tests/Dumper/YamlDumperTest.php +++ b/vendor/symfony/dependency-injection/Tests/Dumper/YamlDumperTest.php @@ -19,8 +19,8 @@ use Symfony\Component\DependencyInjection\Dumper\YamlDumper; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Parser; +use Symfony\Component\Yaml\Yaml; class YamlDumperTest extends TestCase { @@ -49,7 +49,7 @@ public function testAddService() { $container = include self::$fixturesPath.'/containers/container9.php'; $dumper = new YamlDumper($container); - $this->assertEqualYamlStructure(str_replace('%path%', self::$fixturesPath.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/yaml/services9.yml')), $dumper->dump(), '->dump() dumps services'); + $this->assertEqualYamlStructure(str_replace('%path%', self::$fixturesPath.\DIRECTORY_SEPARATOR.'includes'.\DIRECTORY_SEPARATOR, file_get_contents(self::$fixturesPath.'/yaml/services9.yml')), $dumper->dump(), '->dump() dumps services'); $dumper = new YamlDumper($container = new ContainerBuilder()); $container->register('foo', 'FooClass')->addArgument(new \stdClass())->setPublic(true); diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/FooForCircularWithAddCalls.php b/vendor/symfony/dependency-injection/Tests/Fixtures/FooForCircularWithAddCalls.php new file mode 100644 index 000000000..a8331dc3e --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/FooForCircularWithAddCalls.php @@ -0,0 +1,19 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\DependencyInjection\Tests\Fixtures; + +class FooForCircularWithAddCalls +{ + public function call(\stdClass $argument) + { + } +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/config/prototype.expected.yml b/vendor/symfony/dependency-injection/Tests/Fixtures/config/prototype.expected.yml index 5394535ca..ebfe087d7 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/config/prototype.expected.yml +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/config/prototype.expected.yml @@ -10,7 +10,7 @@ services: tags: - { name: foo } - { name: baz } - deprecated: %service_id% + deprecated: '%service_id%' arguments: [1] factory: f Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar: @@ -19,7 +19,7 @@ services: tags: - { name: foo } - { name: baz } - deprecated: %service_id% + deprecated: '%service_id%' lazy: true arguments: [1] factory: f diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container19.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container19.php index 823a77f53..300a5cc76 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container19.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container19.php @@ -7,9 +7,12 @@ $container = new ContainerBuilder(); +$container->setParameter('env(FOO)', 'Bar\FaooClass'); +$container->setParameter('foo', '%env(FOO)%'); + $container - ->register('service_from_anonymous_factory', 'Bar\FooClass') - ->setFactory(array(new Definition('Bar\FooClass'), 'getInstance')) + ->register('service_from_anonymous_factory', '%foo%') + ->setFactory(array(new Definition('%foo%'), 'getInstance')) ->setPublic(true) ; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_almost_circular.php b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_almost_circular.php index dff937ccd..4c9906f7a 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_almost_circular.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/containers/container_almost_circular.php @@ -4,6 +4,7 @@ use Symfony\Component\DependencyInjection\Definition; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls; $public = 'public' === $visibility; $container = new ContainerBuilder(); @@ -55,4 +56,93 @@ ->addArgument(new Reference('foo5')) ->setProperty('foo', new Reference('foo5')); +// doctrine-like event system + some extra + +$container->register('manager', 'stdClass')->setPublic(true) + ->addArgument(new Reference('connection')); + +$container->register('logger', 'stdClass')->setPublic(true) + ->addArgument(new Reference('connection')) + ->setProperty('handler', (new Definition('stdClass'))->addArgument(new Reference('manager'))) +; +$container->register('connection', 'stdClass')->setPublic(true) + ->addArgument(new Reference('dispatcher')) + ->addArgument(new Reference('config')); + +$container->register('config', 'stdClass')->setPublic(false) + ->setProperty('logger', new Reference('logger')); + +$container->register('dispatcher', 'stdClass')->setPublic($public) + ->setLazy($public) + ->setProperty('subscriber', new Reference('subscriber')); + +$container->register('subscriber', 'stdClass')->setPublic(true) + ->addArgument(new Reference('manager')); + +// doctrine-like event system + some extra (bis) + +$container->register('manager2', 'stdClass')->setPublic(true) + ->addArgument(new Reference('connection2')); + +$container->register('logger2', 'stdClass')->setPublic(false) + ->addArgument(new Reference('connection2')) + ->setProperty('handler2', (new Definition('stdClass'))->addArgument(new Reference('manager2'))) +; +$container->register('connection2', 'stdClass')->setPublic(true) + ->addArgument(new Reference('dispatcher2')) + ->addArgument(new Reference('config2')); + +$container->register('config2', 'stdClass')->setPublic(false) + ->setProperty('logger2', new Reference('logger2')); + +$container->register('dispatcher2', 'stdClass')->setPublic($public) + ->setLazy($public) + ->setProperty('subscriber2', new Reference('subscriber2')); + +$container->register('subscriber2', 'stdClass')->setPublic(false) + ->addArgument(new Reference('manager2')); + +// private service involved in a loop + +$container->register('foo6', 'stdClass') + ->setPublic(true) + ->setProperty('bar6', new Reference('bar6')); + +$container->register('bar6', 'stdClass') + ->setPublic(false) + ->addArgument(new Reference('foo6')); + +$container->register('baz6', 'stdClass') + ->setPublic(true) + ->setProperty('bar6', new Reference('bar6')); + +// provided by Christian Schiffler + +$container + ->register('root', 'stdClass') + ->setArguments([new Reference('level2'), new Reference('multiuse1')]) + ->setPublic(true); + +$container + ->register('level2', FooForCircularWithAddCalls::class) + ->addMethodCall('call', [new Reference('level3')]); + +$container->register('multiuse1', 'stdClass'); + +$container + ->register('level3', 'stdClass') + ->addArgument(new Reference('level4')); + +$container + ->register('level4', 'stdClass') + ->setArguments([new Reference('multiuse1'), new Reference('level5')]); + +$container + ->register('level5', 'stdClass') + ->addArgument(new Reference('level6')); + +$container + ->register('level6', FooForCircularWithAddCalls::class) + ->addMethodCall('call', [new Reference('level5')]); + return $container; diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/graphviz/services_inline.dot b/vendor/symfony/dependency-injection/Tests/Fixtures/graphviz/services_inline.dot new file mode 100644 index 000000000..b430b186d --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/graphviz/services_inline.dot @@ -0,0 +1,10 @@ +digraph sc { + ratio="compress" + node [fontsize="11" fontname="Arial" shape="record"]; + edge [fontsize="9" fontname="Arial" color="grey" arrowhead="open" arrowsize="0.5"]; + + node_service_container [label="service_container (Psr\Container\ContainerInterface, Symfony\Component\DependencyInjection\ContainerInterface)\nSymfony\\Component\\DependencyInjection\\ContainerInterface\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_foo [label="foo\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_bar [label="bar\nstdClass\n", shape=record, fillcolor="#eeeeee", style="filled"]; + node_foo -> node_bar [label="" style="filled"]; +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/classes.php b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/classes.php index bc653a744..33b043fa3 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/includes/classes.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/includes/classes.php @@ -85,17 +85,17 @@ class DummyProxyDumper implements ProxyDumper { public function isProxyCandidate(Definition $definition) { - return false; + return $definition->isLazy(); } public function getProxyFactoryCode(Definition $definition, $id, $factoryCall = null) { - return ''; + return " // lazy factory for {$definition->getClass()}\n\n"; } public function getProxyCode(Definition $definition) { - return ''; + return "// proxy code for {$definition->getClass()}\n"; } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/ini/types.ini b/vendor/symfony/dependency-injection/Tests/Fixtures/ini/types.ini index 19cc5b3b3..75840907d 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/ini/types.ini +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/ini/types.ini @@ -11,9 +11,10 @@ constant = PHP_VERSION 12 = 12 12_string = '12' + 12_quoted_number = "12" 12_comment = 12 ; comment 12_string_comment = '12' ; comment - 12_string_comment_again = "12" ; comment + 12_quoted_number_comment = "12" ; comment -12 = -12 0 = 0 1 = 1 diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services10.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services10.php index a7b43ceef..aa078ab85 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services10.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services10.php @@ -115,7 +115,7 @@ public function getParameterBag() /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services12.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services12.php index 9947d36ac..4266ad8e5 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services12.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services12.php @@ -122,7 +122,7 @@ public function getParameterBag() /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services19.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services19.php index 667dd852a..c8b57a7cc 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services19.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services19.php @@ -21,6 +21,8 @@ class ProjectServiceContainer extends Container public function __construct() { + $this->parameters = $this->getDefaultParameters(); + $this->services = array(); $this->methodMap = array( 'service_from_anonymous_factory' => 'getServiceFromAnonymousFactoryService', @@ -58,11 +60,11 @@ public function isFrozen() /** * Gets the public 'service_from_anonymous_factory' shared service. * - * @return \Bar\FooClass + * @return object A %env(FOO)% instance */ protected function getServiceFromAnonymousFactoryService() { - return $this->services['service_from_anonymous_factory'] = (new \Bar\FooClass())->getInstance(); + return $this->services['service_from_anonymous_factory'] = (new ${($_ = $this->getEnv('FOO')) && false ?: "_"}())->getInstance(); } /** @@ -78,4 +80,102 @@ protected function getServiceWithMethodCallAndFactoryService() return $instance; } + + public function getParameter($name) + { + $name = (string) $name; + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + $name = $this->normalizeParameterName($name); + + if (!(isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters))) { + throw new InvalidArgumentException(sprintf('The parameter "%s" must be defined.', $name)); + } + } + if (isset($this->loadedDynamicParameters[$name])) { + return $this->loadedDynamicParameters[$name] ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); + } + + return $this->parameters[$name]; + } + + public function hasParameter($name) + { + $name = (string) $name; + $name = $this->normalizeParameterName($name); + + return isset($this->parameters[$name]) || isset($this->loadedDynamicParameters[$name]) || array_key_exists($name, $this->parameters); + } + + public function setParameter($name, $value) + { + throw new LogicException('Impossible to call set() on a frozen ParameterBag.'); + } + + public function getParameterBag() + { + if (null === $this->parameterBag) { + $parameters = $this->parameters; + foreach ($this->loadedDynamicParameters as $name => $loaded) { + $parameters[$name] = $loaded ? $this->dynamicParameters[$name] : $this->getDynamicParameter($name); + } + $this->parameterBag = new FrozenParameterBag($parameters); + } + + return $this->parameterBag; + } + + private $loadedDynamicParameters = array( + 'foo' => false, + ); + private $dynamicParameters = array(); + + /** + * Computes a dynamic parameter. + * + * @param string $name The name of the dynamic parameter to load + * + * @return mixed The value of the dynamic parameter + * + * @throws InvalidArgumentException When the dynamic parameter does not exist + */ + private function getDynamicParameter($name) + { + switch ($name) { + case 'foo': $value = $this->getEnv('FOO'); break; + default: throw new InvalidArgumentException(sprintf('The dynamic parameter "%s" must be defined.', $name)); + } + $this->loadedDynamicParameters[$name] = true; + + return $this->dynamicParameters[$name] = $value; + } + + private $normalizedParameterNames = array( + 'env(foo)' => 'env(FOO)', + ); + + private function normalizeParameterName($name) + { + if (isset($this->normalizedParameterNames[$normalizedName = strtolower($name)]) || isset($this->parameters[$normalizedName]) || array_key_exists($normalizedName, $this->parameters)) { + $normalizedName = isset($this->normalizedParameterNames[$normalizedName]) ? $this->normalizedParameterNames[$normalizedName] : $normalizedName; + if ((string) $name !== $normalizedName) { + @trigger_error(sprintf('Parameter names will be made case sensitive in Symfony 4.0. Using "%s" instead of "%s" is deprecated since Symfony 3.4.', $name, $normalizedName), E_USER_DEPRECATED); + } + } else { + $normalizedName = $this->normalizedParameterNames[$normalizedName] = (string) $name; + } + + return $normalizedName; + } + + /** + * Gets the default parameters. + * + * @return array An array of the default parameters + */ + protected function getDefaultParameters() + { + return array( + 'env(FOO)' => 'Bar\\FaooClass', + ); + } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services26.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services26.php index 16b99007a..d6256008f 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services26.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services26.php @@ -138,7 +138,7 @@ public function getParameterBag() /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services8.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services8.php index 56e2a98cc..285942eb1 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services8.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services8.php @@ -102,7 +102,7 @@ public function getParameterBag() /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_as_files.txt b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_as_files.txt index fa89e0494..4b6e2f59e 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_as_files.txt +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_as_files.txt @@ -158,7 +158,6 @@ use Symfony\Component\DependencyInjection\Argument\RewindableGenerator; $this->services['foo_with_inline'] = $instance = new \Foo(); $a = new \Bar(); - $a->pub = 'pub'; $a->setBaz(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->load('getBazService.php')) && false ?: '_'}); @@ -442,7 +441,7 @@ class ProjectServiceContainer extends Container /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php index 1af126fa3..37cc5be35 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services9_compiled.php @@ -264,7 +264,6 @@ protected function getFooWithInlineService() $this->services['foo_with_inline'] = $instance = new \Foo(); $a = new \Bar(); - $a->pub = 'pub'; $a->setBaz(${($_ = isset($this->services['baz']) ? $this->services['baz'] : $this->getBazService()) && false ?: '_'}); @@ -433,7 +432,7 @@ public function getParameterBag() /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_adawson.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_adawson.php new file mode 100644 index 000000000..37b95567c --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_adawson.php @@ -0,0 +1,190 @@ +services = array(); + $this->normalizedIds = array( + 'app\\bus' => 'App\\Bus', + 'app\\db' => 'App\\Db', + 'app\\handler1' => 'App\\Handler1', + 'app\\handler2' => 'App\\Handler2', + 'app\\processor' => 'App\\Processor', + 'app\\registry' => 'App\\Registry', + 'app\\schema' => 'App\\Schema', + ); + $this->methodMap = array( + 'App\\Bus' => 'getBusService', + 'App\\Db' => 'getDbService', + 'App\\Handler1' => 'getHandler1Service', + 'App\\Handler2' => 'getHandler2Service', + 'App\\Processor' => 'getProcessorService', + 'App\\Registry' => 'getRegistryService', + 'App\\Schema' => 'getSchemaService', + ); + $this->privates = array( + 'App\\Handler1' => true, + 'App\\Handler2' => true, + 'App\\Processor' => true, + 'App\\Registry' => true, + 'App\\Schema' => true, + ); + + $this->aliases = array(); + } + + public function getRemovedIds() + { + return array( + 'App\\Handler1' => true, + 'App\\Handler2' => true, + 'App\\Processor' => true, + 'App\\Registry' => true, + 'App\\Schema' => true, + 'Psr\\Container\\ContainerInterface' => true, + 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, + ); + } + + public function compile() + { + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + public function isCompiled() + { + return true; + } + + public function isFrozen() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + + return true; + } + + /** + * Gets the public 'App\Bus' shared service. + * + * @return \App\Bus + */ + protected function getBusService() + { + $this->services['App\Bus'] = $instance = new \App\Bus(${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}); + + $instance->handler1 = ${($_ = isset($this->services['App\Handler1']) ? $this->services['App\Handler1'] : $this->getHandler1Service()) && false ?: '_'}; + $instance->handler2 = ${($_ = isset($this->services['App\Handler2']) ? $this->services['App\Handler2'] : $this->getHandler2Service()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the public 'App\Db' shared service. + * + * @return \App\Db + */ + protected function getDbService() + { + $this->services['App\Db'] = $instance = new \App\Db(); + + $instance->schema = ${($_ = isset($this->services['App\Schema']) ? $this->services['App\Schema'] : $this->getSchemaService()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the private 'App\Handler1' shared service. + * + * @return \App\Handler1 + */ + protected function getHandler1Service() + { + $a = ${($_ = isset($this->services['App\Processor']) ? $this->services['App\Processor'] : $this->getProcessorService()) && false ?: '_'}; + + if (isset($this->services['App\Handler1'])) { + return $this->services['App\Handler1']; + } + + return $this->services['App\Handler1'] = new \App\Handler1(${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}, ${($_ = isset($this->services['App\Schema']) ? $this->services['App\Schema'] : $this->getSchemaService()) && false ?: '_'}, $a); + } + + /** + * Gets the private 'App\Handler2' shared service. + * + * @return \App\Handler2 + */ + protected function getHandler2Service() + { + $a = ${($_ = isset($this->services['App\Processor']) ? $this->services['App\Processor'] : $this->getProcessorService()) && false ?: '_'}; + + if (isset($this->services['App\Handler2'])) { + return $this->services['App\Handler2']; + } + + return $this->services['App\Handler2'] = new \App\Handler2(${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}, ${($_ = isset($this->services['App\Schema']) ? $this->services['App\Schema'] : $this->getSchemaService()) && false ?: '_'}, $a); + } + + /** + * Gets the private 'App\Processor' shared service. + * + * @return \App\Processor + */ + protected function getProcessorService() + { + $a = ${($_ = isset($this->services['App\Registry']) ? $this->services['App\Registry'] : $this->getRegistryService()) && false ?: '_'}; + + if (isset($this->services['App\Processor'])) { + return $this->services['App\Processor']; + } + + return $this->services['App\Processor'] = new \App\Processor($a, ${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}); + } + + /** + * Gets the private 'App\Registry' shared service. + * + * @return \App\Registry + */ + protected function getRegistryService() + { + $this->services['App\Registry'] = $instance = new \App\Registry(); + + $instance->processor = array(0 => ${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}, 1 => ${($_ = isset($this->services['App\Bus']) ? $this->services['App\Bus'] : $this->getBusService()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the private 'App\Schema' shared service. + * + * @return \App\Schema + */ + protected function getSchemaService() + { + $a = ${($_ = isset($this->services['App\Db']) ? $this->services['App\Db'] : $this->getDbService()) && false ?: '_'}; + + if (isset($this->services['App\Schema'])) { + return $this->services['App\Schema']; + } + + return $this->services['App\Schema'] = new \App\Schema($a); + } +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_private.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_private.php index 45fb2432c..9c54acc6b 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_private.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_private.php @@ -25,10 +25,35 @@ public function __construct() $this->methodMap = array( 'bar2' => 'getBar2Service', 'bar3' => 'getBar3Service', + 'bar6' => 'getBar6Service', + 'baz6' => 'getBaz6Service', + 'connection' => 'getConnectionService', + 'connection2' => 'getConnection2Service', 'foo' => 'getFooService', 'foo2' => 'getFoo2Service', 'foo5' => 'getFoo5Service', + 'foo6' => 'getFoo6Service', 'foobar4' => 'getFoobar4Service', + 'level2' => 'getLevel2Service', + 'level3' => 'getLevel3Service', + 'level4' => 'getLevel4Service', + 'level5' => 'getLevel5Service', + 'level6' => 'getLevel6Service', + 'logger' => 'getLoggerService', + 'manager' => 'getManagerService', + 'manager2' => 'getManager2Service', + 'multiuse1' => 'getMultiuse1Service', + 'root' => 'getRootService', + 'subscriber' => 'getSubscriberService', + ); + $this->privates = array( + 'bar6' => true, + 'level2' => true, + 'level3' => true, + 'level4' => true, + 'level5' => true, + 'level6' => true, + 'multiuse1' => true, ); $this->aliases = array(); @@ -41,10 +66,23 @@ public function getRemovedIds() 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar' => true, 'bar5' => true, + 'bar6' => true, + 'config' => true, + 'config2' => true, + 'dispatcher' => true, + 'dispatcher2' => true, 'foo4' => true, 'foobar' => true, 'foobar2' => true, 'foobar3' => true, + 'level2' => true, + 'level3' => true, + 'level4' => true, + 'level5' => true, + 'level6' => true, + 'logger2' => true, + 'multiuse1' => true, + 'subscriber2' => true, ); } @@ -95,6 +133,66 @@ protected function getBar3Service() return $instance; } + /** + * Gets the public 'baz6' shared service. + * + * @return \stdClass + */ + protected function getBaz6Service() + { + $this->services['baz6'] = $instance = new \stdClass(); + + $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the public 'connection' shared service. + * + * @return \stdClass + */ + protected function getConnectionService() + { + $a = new \stdClass(); + + $b = new \stdClass(); + + $this->services['connection'] = $instance = new \stdClass($a, $b); + + $b->logger = ${($_ = isset($this->services['logger']) ? $this->services['logger'] : $this->getLoggerService()) && false ?: '_'}; + + $a->subscriber = ${($_ = isset($this->services['subscriber']) ? $this->services['subscriber'] : $this->getSubscriberService()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the public 'connection2' shared service. + * + * @return \stdClass + */ + protected function getConnection2Service() + { + $a = new \stdClass(); + + $b = new \stdClass(); + + $this->services['connection2'] = $instance = new \stdClass($a, $b); + + $c = new \stdClass($instance); + + $d = ${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && false ?: '_'}; + + $c->handler2 = new \stdClass($d); + + $b->logger2 = $c; + + $a->subscriber2 = new \stdClass($d); + + return $instance; + } + /** * Gets the public 'foo' shared service. * @@ -136,8 +234,7 @@ protected function getFoo5Service() { $this->services['foo5'] = $instance = new \stdClass(); - $a = new \stdClass(${($_ = isset($this->services['foo5']) ? $this->services['foo5'] : $this->getFoo5Service()) && false ?: '_'}); - + $a = new \stdClass($instance); $a->foo = $instance; $instance->bar = $a; @@ -145,6 +242,20 @@ protected function getFoo5Service() return $instance; } + /** + * Gets the public 'foo6' shared service. + * + * @return \stdClass + */ + protected function getFoo6Service() + { + $this->services['foo6'] = $instance = new \stdClass(); + + $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && false ?: '_'}; + + return $instance; + } + /** * Gets the public 'foobar4' shared service. * @@ -160,4 +271,172 @@ protected function getFoobar4Service() return $instance; } + + /** + * Gets the public 'logger' shared service. + * + * @return \stdClass + */ + protected function getLoggerService() + { + $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && false ?: '_'}; + + if (isset($this->services['logger'])) { + return $this->services['logger']; + } + + $this->services['logger'] = $instance = new \stdClass($a); + + $instance->handler = new \stdClass(${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the public 'manager' shared service. + * + * @return \stdClass + */ + protected function getManagerService() + { + $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && false ?: '_'}; + + if (isset($this->services['manager'])) { + return $this->services['manager']; + } + + return $this->services['manager'] = new \stdClass($a); + } + + /** + * Gets the public 'manager2' shared service. + * + * @return \stdClass + */ + protected function getManager2Service() + { + $a = ${($_ = isset($this->services['connection2']) ? $this->services['connection2'] : $this->getConnection2Service()) && false ?: '_'}; + + if (isset($this->services['manager2'])) { + return $this->services['manager2']; + } + + return $this->services['manager2'] = new \stdClass($a); + } + + /** + * Gets the public 'root' shared service. + * + * @return \stdClass + */ + protected function getRootService() + { + return $this->services['root'] = new \stdClass(${($_ = isset($this->services['level2']) ? $this->services['level2'] : $this->getLevel2Service()) && false ?: '_'}, ${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : $this->services['multiuse1'] = new \stdClass()) && false ?: '_'}); + } + + /** + * Gets the public 'subscriber' shared service. + * + * @return \stdClass + */ + protected function getSubscriberService() + { + $a = ${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'}; + + if (isset($this->services['subscriber'])) { + return $this->services['subscriber']; + } + + return $this->services['subscriber'] = new \stdClass($a); + } + + /** + * Gets the private 'bar6' shared service. + * + * @return \stdClass + */ + protected function getBar6Service() + { + $a = ${($_ = isset($this->services['foo6']) ? $this->services['foo6'] : $this->getFoo6Service()) && false ?: '_'}; + + if (isset($this->services['bar6'])) { + return $this->services['bar6']; + } + + return $this->services['bar6'] = new \stdClass($a); + } + + /** + * Gets the private 'level2' shared service. + * + * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls + */ + protected function getLevel2Service() + { + $this->services['level2'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls(); + + $instance->call(${($_ = isset($this->services['level3']) ? $this->services['level3'] : $this->getLevel3Service()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the private 'level3' shared service. + * + * @return \stdClass + */ + protected function getLevel3Service() + { + return $this->services['level3'] = new \stdClass(${($_ = isset($this->services['level4']) ? $this->services['level4'] : $this->getLevel4Service()) && false ?: '_'}); + } + + /** + * Gets the private 'level4' shared service. + * + * @return \stdClass + */ + protected function getLevel4Service() + { + return $this->services['level4'] = new \stdClass(${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : $this->services['multiuse1'] = new \stdClass()) && false ?: '_'}, ${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && false ?: '_'}); + } + + /** + * Gets the private 'level5' shared service. + * + * @return \stdClass + */ + protected function getLevel5Service() + { + $a = ${($_ = isset($this->services['level6']) ? $this->services['level6'] : $this->getLevel6Service()) && false ?: '_'}; + + if (isset($this->services['level5'])) { + return $this->services['level5']; + } + + return $this->services['level5'] = new \stdClass($a); + } + + /** + * Gets the private 'level6' shared service. + * + * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls + */ + protected function getLevel6Service() + { + $this->services['level6'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls(); + + $instance->call(${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the private 'multiuse1' shared service. + * + * @return \stdClass + */ + protected function getMultiuse1Service() + { + return $this->services['multiuse1'] = new \stdClass(); + } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_public.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_public.php index be18eb183..bd08c4d15 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_public.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_almost_circular_public.php @@ -26,14 +26,41 @@ public function __construct() 'bar' => 'getBarService', 'bar3' => 'getBar3Service', 'bar5' => 'getBar5Service', + 'bar6' => 'getBar6Service', + 'baz6' => 'getBaz6Service', + 'connection' => 'getConnectionService', + 'connection2' => 'getConnection2Service', + 'dispatcher' => 'getDispatcherService', + 'dispatcher2' => 'getDispatcher2Service', 'foo' => 'getFooService', 'foo2' => 'getFoo2Service', 'foo4' => 'getFoo4Service', 'foo5' => 'getFoo5Service', + 'foo6' => 'getFoo6Service', 'foobar' => 'getFoobarService', 'foobar2' => 'getFoobar2Service', 'foobar3' => 'getFoobar3Service', 'foobar4' => 'getFoobar4Service', + 'level2' => 'getLevel2Service', + 'level3' => 'getLevel3Service', + 'level4' => 'getLevel4Service', + 'level5' => 'getLevel5Service', + 'level6' => 'getLevel6Service', + 'logger' => 'getLoggerService', + 'manager' => 'getManagerService', + 'manager2' => 'getManager2Service', + 'multiuse1' => 'getMultiuse1Service', + 'root' => 'getRootService', + 'subscriber' => 'getSubscriberService', + ); + $this->privates = array( + 'bar6' => true, + 'level2' => true, + 'level3' => true, + 'level4' => true, + 'level5' => true, + 'level6' => true, + 'multiuse1' => true, ); $this->aliases = array(); @@ -45,6 +72,17 @@ public function getRemovedIds() 'Psr\\Container\\ContainerInterface' => true, 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, 'bar2' => true, + 'bar6' => true, + 'config' => true, + 'config2' => true, + 'level2' => true, + 'level3' => true, + 'level4' => true, + 'level5' => true, + 'level6' => true, + 'logger2' => true, + 'multiuse1' => true, + 'subscriber2' => true, ); } @@ -115,6 +153,93 @@ protected function getBar5Service() return $instance; } + /** + * Gets the public 'baz6' shared service. + * + * @return \stdClass + */ + protected function getBaz6Service() + { + $this->services['baz6'] = $instance = new \stdClass(); + + $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the public 'connection' shared service. + * + * @return \stdClass + */ + protected function getConnectionService() + { + $a = ${($_ = isset($this->services['dispatcher']) ? $this->services['dispatcher'] : $this->getDispatcherService()) && false ?: '_'}; + + if (isset($this->services['connection'])) { + return $this->services['connection']; + } + $b = new \stdClass(); + + $this->services['connection'] = $instance = new \stdClass($a, $b); + + $b->logger = ${($_ = isset($this->services['logger']) ? $this->services['logger'] : $this->getLoggerService()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the public 'connection2' shared service. + * + * @return \stdClass + */ + protected function getConnection2Service() + { + $a = ${($_ = isset($this->services['dispatcher2']) ? $this->services['dispatcher2'] : $this->getDispatcher2Service()) && false ?: '_'}; + + if (isset($this->services['connection2'])) { + return $this->services['connection2']; + } + $b = new \stdClass(); + + $this->services['connection2'] = $instance = new \stdClass($a, $b); + + $c = new \stdClass($instance); + $c->handler2 = new \stdClass(${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && false ?: '_'}); + + $b->logger2 = $c; + + return $instance; + } + + /** + * Gets the public 'dispatcher' shared service. + * + * @return \stdClass + */ + protected function getDispatcherService($lazyLoad = true) + { + $this->services['dispatcher'] = $instance = new \stdClass(); + + $instance->subscriber = ${($_ = isset($this->services['subscriber']) ? $this->services['subscriber'] : $this->getSubscriberService()) && false ?: '_'}; + + return $instance; + } + + /** + * Gets the public 'dispatcher2' shared service. + * + * @return \stdClass + */ + protected function getDispatcher2Service($lazyLoad = true) + { + $this->services['dispatcher2'] = $instance = new \stdClass(); + + $instance->subscriber2 = new \stdClass(${($_ = isset($this->services['manager2']) ? $this->services['manager2'] : $this->getManager2Service()) && false ?: '_'}); + + return $instance; + } + /** * Gets the public 'foo' shared service. * @@ -175,6 +300,20 @@ protected function getFoo5Service() return $instance; } + /** + * Gets the public 'foo6' shared service. + * + * @return \stdClass + */ + protected function getFoo6Service() + { + $this->services['foo6'] = $instance = new \stdClass(); + + $instance->bar6 = ${($_ = isset($this->services['bar6']) ? $this->services['bar6'] : $this->getBar6Service()) && false ?: '_'}; + + return $instance; + } + /** * Gets the public 'foobar' shared service. * @@ -232,4 +371,172 @@ protected function getFoobar4Service() return $instance; } + + /** + * Gets the public 'logger' shared service. + * + * @return \stdClass + */ + protected function getLoggerService() + { + $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && false ?: '_'}; + + if (isset($this->services['logger'])) { + return $this->services['logger']; + } + + $this->services['logger'] = $instance = new \stdClass($a); + + $instance->handler = new \stdClass(${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the public 'manager' shared service. + * + * @return \stdClass + */ + protected function getManagerService() + { + $a = ${($_ = isset($this->services['connection']) ? $this->services['connection'] : $this->getConnectionService()) && false ?: '_'}; + + if (isset($this->services['manager'])) { + return $this->services['manager']; + } + + return $this->services['manager'] = new \stdClass($a); + } + + /** + * Gets the public 'manager2' shared service. + * + * @return \stdClass + */ + protected function getManager2Service() + { + $a = ${($_ = isset($this->services['connection2']) ? $this->services['connection2'] : $this->getConnection2Service()) && false ?: '_'}; + + if (isset($this->services['manager2'])) { + return $this->services['manager2']; + } + + return $this->services['manager2'] = new \stdClass($a); + } + + /** + * Gets the public 'root' shared service. + * + * @return \stdClass + */ + protected function getRootService() + { + return $this->services['root'] = new \stdClass(${($_ = isset($this->services['level2']) ? $this->services['level2'] : $this->getLevel2Service()) && false ?: '_'}, ${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : $this->services['multiuse1'] = new \stdClass()) && false ?: '_'}); + } + + /** + * Gets the public 'subscriber' shared service. + * + * @return \stdClass + */ + protected function getSubscriberService() + { + $a = ${($_ = isset($this->services['manager']) ? $this->services['manager'] : $this->getManagerService()) && false ?: '_'}; + + if (isset($this->services['subscriber'])) { + return $this->services['subscriber']; + } + + return $this->services['subscriber'] = new \stdClass($a); + } + + /** + * Gets the private 'bar6' shared service. + * + * @return \stdClass + */ + protected function getBar6Service() + { + $a = ${($_ = isset($this->services['foo6']) ? $this->services['foo6'] : $this->getFoo6Service()) && false ?: '_'}; + + if (isset($this->services['bar6'])) { + return $this->services['bar6']; + } + + return $this->services['bar6'] = new \stdClass($a); + } + + /** + * Gets the private 'level2' shared service. + * + * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls + */ + protected function getLevel2Service() + { + $this->services['level2'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls(); + + $instance->call(${($_ = isset($this->services['level3']) ? $this->services['level3'] : $this->getLevel3Service()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the private 'level3' shared service. + * + * @return \stdClass + */ + protected function getLevel3Service() + { + return $this->services['level3'] = new \stdClass(${($_ = isset($this->services['level4']) ? $this->services['level4'] : $this->getLevel4Service()) && false ?: '_'}); + } + + /** + * Gets the private 'level4' shared service. + * + * @return \stdClass + */ + protected function getLevel4Service() + { + return $this->services['level4'] = new \stdClass(${($_ = isset($this->services['multiuse1']) ? $this->services['multiuse1'] : $this->services['multiuse1'] = new \stdClass()) && false ?: '_'}, ${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && false ?: '_'}); + } + + /** + * Gets the private 'level5' shared service. + * + * @return \stdClass + */ + protected function getLevel5Service() + { + $a = ${($_ = isset($this->services['level6']) ? $this->services['level6'] : $this->getLevel6Service()) && false ?: '_'}; + + if (isset($this->services['level5'])) { + return $this->services['level5']; + } + + return $this->services['level5'] = new \stdClass($a); + } + + /** + * Gets the private 'level6' shared service. + * + * @return \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls + */ + protected function getLevel6Service() + { + $this->services['level6'] = $instance = new \Symfony\Component\DependencyInjection\Tests\Fixtures\FooForCircularWithAddCalls(); + + $instance->call(${($_ = isset($this->services['level5']) ? $this->services['level5'] : $this->getLevel5Service()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the private 'multiuse1' shared service. + * + * @return \stdClass + */ + protected function getMultiuse1Service() + { + return $this->services['multiuse1'] = new \stdClass(); + } } diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_array_params.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_array_params.php index 4776d98c3..5ef6cb688 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_array_params.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_array_params.php @@ -125,7 +125,7 @@ public function getParameterBag() /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_base64_env.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_base64_env.php index f1b92397d..6b6be9569 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_base64_env.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_base64_env.php @@ -104,7 +104,7 @@ public function getParameterBag() /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_dedup_lazy_proxy.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_dedup_lazy_proxy.php new file mode 100644 index 000000000..73a7f259f --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_dedup_lazy_proxy.php @@ -0,0 +1,88 @@ +services = array(); + $this->methodMap = array( + 'bar' => 'getBarService', + 'foo' => 'getFooService', + ); + + $this->aliases = array(); + } + + public function getRemovedIds() + { + return array( + 'Psr\\Container\\ContainerInterface' => true, + 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, + ); + } + + public function compile() + { + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + public function isCompiled() + { + return true; + } + + public function isFrozen() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + + return true; + } + + protected function createProxy($class, \Closure $factory) + { + return $factory(); + } + + /** + * Gets the public 'bar' shared service. + * + * @return \stdClass + */ + protected function getBarService($lazyLoad = true) + { + // lazy factory for stdClass + + return new \stdClass(); + } + + /** + * Gets the public 'foo' shared service. + * + * @return \stdClass + */ + protected function getFooService($lazyLoad = true) + { + // lazy factory for stdClass + + return new \stdClass(); + } +} + +// proxy code for stdClass diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_deep_graph.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_deep_graph.php new file mode 100644 index 000000000..9a1d1ab8c --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_deep_graph.php @@ -0,0 +1,93 @@ +services = array(); + $this->methodMap = array( + 'bar' => 'getBarService', + 'foo' => 'getFooService', + ); + + $this->aliases = array(); + } + + public function getRemovedIds() + { + return array( + 'Psr\\Container\\ContainerInterface' => true, + 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, + ); + } + + public function compile() + { + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + public function isCompiled() + { + return true; + } + + public function isFrozen() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + + return true; + } + + /** + * Gets the public 'bar' shared service. + * + * @return \stdClass + */ + protected function getBarService() + { + $this->services['bar'] = $instance = new \stdClass(); + + $instance->p5 = new \stdClass(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}); + + return $instance; + } + + /** + * Gets the public 'foo' shared service. + * + * @return \Symfony\Component\DependencyInjection\Tests\Dumper\FooForDeepGraph + */ + protected function getFooService() + { + $a = ${($_ = isset($this->services['bar']) ? $this->services['bar'] : $this->getBarService()) && false ?: '_'}; + + if (isset($this->services['foo'])) { + return $this->services['foo']; + } + $b = new \stdClass(); + + $c = new \stdClass(); + $c->p3 = new \stdClass(); + + $b->p2 = $c; + + return $this->services['foo'] = new \Symfony\Component\DependencyInjection\Tests\Dumper\FooForDeepGraph($a, $b); + } +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_env_in_id.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_env_in_id.php index 6bc714a20..91114fd97 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_env_in_id.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_env_in_id.php @@ -145,7 +145,7 @@ public function getParameterBag() /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_requires.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_requires.php index 2db58bdda..08a474eea 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_requires.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_requires.php @@ -174,7 +174,7 @@ public function getParameterBag() /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_self_ref.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_self_ref.php new file mode 100644 index 000000000..fa8a4e690 --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_inline_self_ref.php @@ -0,0 +1,78 @@ +services = array(); + $this->normalizedIds = array( + 'app\\foo' => 'App\\Foo', + ); + $this->methodMap = array( + 'App\\Foo' => 'getFooService', + ); + + $this->aliases = array(); + } + + public function getRemovedIds() + { + return array( + 'Psr\\Container\\ContainerInterface' => true, + 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, + ); + } + + public function compile() + { + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + public function isCompiled() + { + return true; + } + + public function isFrozen() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + + return true; + } + + /** + * Gets the public 'App\Foo' shared service. + * + * @return \App\Foo + */ + protected function getFooService() + { + $a = new \App\Bar(); + + $b = new \App\Baz($a); + $b->bar = $a; + + $this->services['App\Foo'] = $instance = new \App\Foo($b); + + $a->foo = $instance; + + return $instance; + } +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_non_shared_lazy.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_non_shared_lazy.php new file mode 100644 index 000000000..6c3b14050 --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_non_shared_lazy.php @@ -0,0 +1,92 @@ +services = array(); + $this->methodMap = array( + 'bar' => 'getBarService', + 'foo' => 'getFooService', + ); + $this->privates = array( + 'bar' => true, + 'foo' => true, + ); + + $this->aliases = array(); + } + + public function getRemovedIds() + { + return array( + 'Psr\\Container\\ContainerInterface' => true, + 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, + 'bar' => true, + 'foo' => true, + ); + } + + public function compile() + { + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + public function isCompiled() + { + return true; + } + + public function isFrozen() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + + return true; + } + + protected function createProxy($class, \Closure $factory) + { + return $factory(); + } + + /** + * Gets the private 'bar' shared service. + * + * @return \stdClass + */ + protected function getBarService() + { + return $this->services['bar'] = new \stdClass(${($_ = isset($this->services['foo']) ? $this->services['foo'] : $this->getFooService()) && false ?: '_'}); + } + + /** + * Gets the private 'foo' service. + * + * @return \stdClass + */ + protected function getFooService($lazyLoad = true) + { + // lazy factory for stdClass + + return new \stdClass(); + } +} + +// proxy code for stdClass diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_rot13_env.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_rot13_env.php index aab87ec7a..90836aa90 100644 --- a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_rot13_env.php +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_rot13_env.php @@ -133,7 +133,7 @@ public function getParameterBag() /** * Computes a dynamic parameter. * - * @param string The name of the dynamic parameter to load + * @param string $name The name of the dynamic parameter to load * * @return mixed The value of the dynamic parameter * diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_tsantos.php b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_tsantos.php new file mode 100644 index 000000000..dbaa70956 --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/php/services_tsantos.php @@ -0,0 +1,87 @@ +services = array(); + $this->normalizedIds = array( + 'tsantos\\serializer\\serializerinterface' => 'TSantos\\Serializer\\SerializerInterface', + ); + $this->methodMap = array( + 'tsantos_serializer' => 'getTsantosSerializerService', + ); + $this->aliases = array( + 'TSantos\\Serializer\\SerializerInterface' => 'tsantos_serializer', + ); + } + + public function getRemovedIds() + { + return array( + 'Psr\\Container\\ContainerInterface' => true, + 'Symfony\\Component\\DependencyInjection\\ContainerInterface' => true, + ); + } + + public function compile() + { + throw new LogicException('You cannot compile a dumped container that was already compiled.'); + } + + public function isCompiled() + { + return true; + } + + public function isFrozen() + { + @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the isCompiled() method instead.', __METHOD__), E_USER_DEPRECATED); + + return true; + } + + /** + * Gets the public 'tsantos_serializer' shared service. + * + * @return \TSantos\Serializer\EventEmitterSerializer + */ + protected function getTsantosSerializerService() + { + $a = new \TSantos\Serializer\NormalizerRegistry(); + + $b = new \TSantos\Serializer\Normalizer\CollectionNormalizer(); + + $c = new \TSantos\Serializer\EventDispatcher\EventDispatcher(); + $c->addSubscriber(new \TSantos\SerializerBundle\EventListener\StopwatchListener(new \Symfony\Component\Stopwatch\Stopwatch(true))); + + $this->services['tsantos_serializer'] = $instance = new \TSantos\Serializer\EventEmitterSerializer(new \TSantos\Serializer\Encoder\JsonEncoder(), $a, $c); + + $b->setSerializer($instance); + $d = new \TSantos\Serializer\Normalizer\JsonNormalizer(); + $d->setSerializer($instance); + + $a->add(new \TSantos\Serializer\Normalizer\ObjectNormalizer(new \TSantos\SerializerBundle\Serializer\CircularReferenceHandler())); + $a->add($b); + $a->add($d); + + return $instance; + } +} diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/xml/services_tsantos.xml b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/services_tsantos.xml new file mode 100644 index 000000000..bb310b279 --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/xml/services_tsantos.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services_adawson.yml b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services_adawson.yml new file mode 100644 index 000000000..2a26f38a8 --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services_adawson.yml @@ -0,0 +1,28 @@ +services: + App\Db: + public: true + properties: + schema: '@App\Schema' + + App\Bus: + public: true + arguments: ['@App\Db'] + properties: + handler1: '@App\Handler1' + handler2: '@App\Handler2' + + App\Handler1: + ['@App\Db', '@App\Schema', '@App\Processor'] + + App\Handler2: + ['@App\Db', '@App\Schema', '@App\Processor'] + + App\Processor: + ['@App\Registry', '@App\Db'] + + App\Registry: + properties: + processor: ['@App\Db', '@App\Bus'] + + App\Schema: + arguments: ['@App\Db'] diff --git a/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services_deep_graph.yml b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services_deep_graph.yml new file mode 100644 index 000000000..f16329aef --- /dev/null +++ b/vendor/symfony/dependency-injection/Tests/Fixtures/yaml/services_deep_graph.yml @@ -0,0 +1,24 @@ + +services: + foo: + class: Symfony\Component\DependencyInjection\Tests\Dumper\FooForDeepGraph + public: true + arguments: + - '@bar' + - !service + class: stdClass + properties: + p2: !service + class: stdClass + properties: + p3: !service + class: stdClass + + bar: + class: stdClass + public: true + properties: + p5: !service + class: stdClass + arguments: ['@foo'] + diff --git a/vendor/symfony/dependency-injection/Tests/Loader/DirectoryLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/DirectoryLoaderTest.php index 5de657737..559abbe25 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/DirectoryLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/DirectoryLoaderTest.php @@ -12,13 +12,13 @@ namespace Symfony\Component\DependencyInjection\Tests\Loader; use PHPUnit\Framework\TestCase; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\Config\Loader\LoaderResolver; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; +use Symfony\Component\DependencyInjection\Loader\DirectoryLoader; use Symfony\Component\DependencyInjection\Loader\IniFileLoader; +use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\DependencyInjection\Loader\DirectoryLoader; -use Symfony\Component\Config\Loader\LoaderResolver; -use Symfony\Component\Config\FileLocator; class DirectoryLoaderTest extends TestCase { diff --git a/vendor/symfony/dependency-injection/Tests/Loader/FileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/FileLoaderTest.php index 8a271a818..73015084a 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/FileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/FileLoaderTest.php @@ -11,8 +11,8 @@ namespace Symfony\Component\DependencyInjection\Tests\Loader; -use Psr\Container\ContainerInterface as PsrContainerInterface; use PHPUnit\Framework\TestCase; +use Psr\Container\ContainerInterface as PsrContainerInterface; use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\Loader\LoaderResolver; use Symfony\Component\DependencyInjection\ContainerBuilder; @@ -26,10 +26,10 @@ use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\BadClasses\MissingParent; -use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\AnotherSub\DeeperBaz; -use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Baz; use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo; use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\FooInterface; +use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\AnotherSub\DeeperBaz; +use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\OtherDir\Baz; use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar; use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\BarInterface; diff --git a/vendor/symfony/dependency-injection/Tests/Loader/GlobFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/GlobFileLoaderTest.php index a3be4dfd3..74822f551 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/GlobFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/GlobFileLoaderTest.php @@ -12,10 +12,10 @@ namespace Symfony\Component\DependencyInjection\Tests\Loader; use PHPUnit\Framework\TestCase; +use Symfony\Component\Config\FileLocator; use Symfony\Component\Config\Resource\GlobResource; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\GlobFileLoader; -use Symfony\Component\Config\FileLocator; class GlobFileLoaderTest extends TestCase { diff --git a/vendor/symfony/dependency-injection/Tests/Loader/IniFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/IniFileLoaderTest.php index d3c2dfc76..c2332f822 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/IniFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/IniFileLoaderTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\DependencyInjection\Tests\Loader; use PHPUnit\Framework\TestCase; +use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\IniFileLoader; -use Symfony\Component\Config\FileLocator; class IniFileLoaderTest extends TestCase { @@ -50,7 +50,7 @@ public function testTypeConversions($key, $value, $supported) */ public function testTypeConversionsWithNativePhp($key, $value, $supported) { - if (defined('HHVM_VERSION_ID')) { + if (\defined('HHVM_VERSION_ID')) { $this->markTestSkipped(); } @@ -58,7 +58,6 @@ public function testTypeConversionsWithNativePhp($key, $value, $supported) $this->markTestSkipped(sprintf('Converting the value "%s" to "%s" is not supported by the IniFileLoader.', $key, $value)); } - $this->loader->load('types.ini'); $expected = parse_ini_file(__DIR__.'/../Fixtures/ini/types.ini', true, INI_SCANNER_TYPED); $this->assertSame($value, $expected['parameters'][$key], '->load() converts values to PHP types'); } @@ -78,9 +77,10 @@ public function getTypeConversions() array('constant', PHP_VERSION, true), array('12', 12, true), array('12_string', '12', true), + array('12_quoted_number', 12, false), // INI_SCANNER_RAW removes the double quotes array('12_comment', 12, true), array('12_string_comment', '12', true), - array('12_string_comment_again', '12', true), + array('12_quoted_number_comment', 12, false), // INI_SCANNER_RAW removes the double quotes array('-12', -12, true), array('1', 1, true), array('0', 0, true), diff --git a/vendor/symfony/dependency-injection/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/PhpFileLoaderTest.php index 8c84dc7e8..e0a21e880 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/PhpFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/PhpFileLoaderTest.php @@ -12,11 +12,11 @@ namespace Symfony\Component\DependencyInjection\Tests\Loader; use PHPUnit\Framework\TestCase; +use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; use Symfony\Component\DependencyInjection\Dumper\YamlDumper; use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; -use Symfony\Component\Config\FileLocator; class PhpFileLoaderTest extends TestCase { @@ -46,7 +46,7 @@ public function testConfigServices() $container->compile(); $dumper = new PhpDumper($container); - $this->assertStringEqualsFile($fixtures.'/php/services9_compiled.php', str_replace(str_replace('\\', '\\\\', $fixtures.DIRECTORY_SEPARATOR.'includes'.DIRECTORY_SEPARATOR), '%path%', $dumper->dump())); + $this->assertStringEqualsFile($fixtures.'/php/services9_compiled.php', str_replace(str_replace('\\', '\\\\', $fixtures.\DIRECTORY_SEPARATOR.'includes'.\DIRECTORY_SEPARATOR), '%path%', $dumper->dump())); } /** diff --git a/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php index 1c21045f4..2a9ac68e9 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/XmlFileLoaderTest.php @@ -12,21 +12,22 @@ namespace Symfony\Component\DependencyInjection\Tests\Loader; use PHPUnit\Framework\TestCase; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\Config\Loader\LoaderResolver; +use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Config\Resource\GlobResource; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; +use Symfony\Component\DependencyInjection\Dumper\PhpDumper; +use Symfony\Component\DependencyInjection\Loader\IniFileLoader; use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; -use Symfony\Component\DependencyInjection\Loader\IniFileLoader; -use Symfony\Component\Config\Loader\LoaderResolver; -use Symfony\Component\Config\FileLocator; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Resource\GlobResource; +use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Tests\Fixtures\Bar; use Symfony\Component\DependencyInjection\Tests\Fixtures\BarInterface; use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass; -use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype; use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy; +use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype; use Symfony\Component\ExpressionLanguage\Expression; class XmlFileLoaderTest extends TestCase @@ -455,10 +456,10 @@ public function testExtensions() public function testExtensionInPhar() { - if (extension_loaded('suhosin') && false === strpos(ini_get('suhosin.executor.include.whitelist'), 'phar')) { + if (\extension_loaded('suhosin') && false === strpos(ini_get('suhosin.executor.include.whitelist'), 'phar')) { $this->markTestSkipped('To run this test, add "phar" to the "suhosin.executor.include.whitelist" settings in your php.ini file.'); } - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $this->markTestSkipped('HHVM makes this test conflict with those run in separate processes.'); } @@ -633,10 +634,10 @@ public function testPrototype() $resources = $container->getResources(); - $fixturesDir = dirname(__DIR__).DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR; - $this->assertTrue(false !== array_search(new FileResource($fixturesDir.'xml'.DIRECTORY_SEPARATOR.'services_prototype.xml'), $resources)); - $this->assertTrue(false !== array_search(new GlobResource($fixturesDir.'Prototype', '/*', true), $resources)); + $fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR; $resources = array_map('strval', $resources); + $this->assertContains((string) (new FileResource($fixturesDir.'xml'.\DIRECTORY_SEPARATOR.'services_prototype.xml')), $resources); + $this->assertContains((string) (new GlobResource($fixturesDir.'Prototype', '/*', true)), $resources); $this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo', $resources); $this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar', $resources); } @@ -807,4 +808,16 @@ public function testBindings() '$factory' => 'factory', ), array_map(function ($v) { return $v->getValues()[0]; }, $definition->getBindings())); } + + public function testTsantosContainer() + { + $container = new ContainerBuilder(); + $loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml')); + $loader->load('services_tsantos.xml'); + $container->compile(); + + $dumper = new PhpDumper($container); + $dump = $dumper->dump(); + $this->assertStringEqualsFile(self::$fixturesPath.'/php/services_tsantos.php', $dumper->dump()); + } } diff --git a/vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php index 2812033bd..d8b329a56 100644 --- a/vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php +++ b/vendor/symfony/dependency-injection/Tests/Loader/YamlFileLoaderTest.php @@ -12,22 +12,22 @@ namespace Symfony\Component\DependencyInjection\Tests\Loader; use PHPUnit\Framework\TestCase; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\Config\Loader\LoaderResolver; +use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Config\Resource\GlobResource; use Symfony\Component\DependencyInjection\Argument\IteratorArgument; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\DependencyInjection\Loader\IniFileLoader; use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; -use Symfony\Component\Config\Loader\LoaderResolver; -use Symfony\Component\Config\FileLocator; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Resource\GlobResource; +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\Tests\Fixtures\Bar; use Symfony\Component\DependencyInjection\Tests\Fixtures\BarInterface; use Symfony\Component\DependencyInjection\Tests\Fixtures\CaseSensitiveClass; -use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype; use Symfony\Component\DependencyInjection\Tests\Fixtures\NamedArgumentsDummy; +use Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype; use Symfony\Component\ExpressionLanguage\Expression; class YamlFileLoaderTest extends TestCase @@ -393,10 +393,10 @@ public function testPrototype() $resources = $container->getResources(); - $fixturesDir = dirname(__DIR__).DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR; - $this->assertTrue(false !== array_search(new FileResource($fixturesDir.'yaml'.DIRECTORY_SEPARATOR.'services_prototype.yml'), $resources)); - $this->assertTrue(false !== array_search(new GlobResource($fixturesDir.'Prototype', '', true), $resources)); + $fixturesDir = \dirname(__DIR__).\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR; $resources = array_map('strval', $resources); + $this->assertContains((string) (new FileResource($fixturesDir.'yaml'.\DIRECTORY_SEPARATOR.'services_prototype.yml')), $resources); + $this->assertContains((string) (new GlobResource($fixturesDir.'Prototype', '', true)), $resources); $this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Foo', $resources); $this->assertContains('reflection.Symfony\Component\DependencyInjection\Tests\Fixtures\Prototype\Sub\Bar', $resources); } @@ -586,7 +586,7 @@ public function testAnonymousServices() $this->assertCount(1, $args); $this->assertInstanceOf(Reference::class, $args[0]); $this->assertTrue($container->has((string) $args[0])); - $this->assertRegExp('/^\d+_Bar[._A-Za-z0-9]{7}$/', (string) $args[0]); + $this->assertRegExp('/^\d+_Bar~[._A-Za-z0-9]{7}$/', (string) $args[0]); $anonymous = $container->getDefinition((string) $args[0]); $this->assertEquals('Bar', $anonymous->getClass()); @@ -598,7 +598,7 @@ public function testAnonymousServices() $this->assertInternalType('array', $factory); $this->assertInstanceOf(Reference::class, $factory[0]); $this->assertTrue($container->has((string) $factory[0])); - $this->assertRegExp('/^\d+_Quz[._A-Za-z0-9]{7}$/', (string) $factory[0]); + $this->assertRegExp('/^\d+_Quz~[._A-Za-z0-9]{7}$/', (string) $factory[0]); $this->assertEquals('constructFoo', $factory[1]); $anonymous = $container->getDefinition((string) $factory[0]); diff --git a/vendor/symfony/dependency-injection/Tests/ParameterBag/ParameterBagTest.php b/vendor/symfony/dependency-injection/Tests/ParameterBag/ParameterBagTest.php index c139f0a13..a04cc15c1 100644 --- a/vendor/symfony/dependency-injection/Tests/ParameterBag/ParameterBagTest.php +++ b/vendor/symfony/dependency-injection/Tests/ParameterBag/ParameterBagTest.php @@ -12,10 +12,10 @@ namespace Symfony\Component\DependencyInjection\Tests\ParameterBag; use PHPUnit\Framework\TestCase; -use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; -use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; use Symfony\Component\DependencyInjection\Exception\ParameterCircularReferenceException; +use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; class ParameterBagTest extends TestCase { diff --git a/vendor/symfony/dependency-injection/phpunit.xml.dist b/vendor/symfony/dependency-injection/phpunit.xml.dist index 781f767d5..21dee2a80 100644 --- a/vendor/symfony/dependency-injection/phpunit.xml.dist +++ b/vendor/symfony/dependency-injection/phpunit.xml.dist @@ -1,7 +1,7 @@ container = $container; - $class = get_class($this); + $class = \get_class($this); if ($this instanceof \PHPUnit_Framework_MockObject_MockObject || $this instanceof \Prophecy\Doubler\DoubleInterface) { $class = get_parent_class($class); } @@ -66,7 +66,7 @@ public function addListenerService($eventName, $callback, $priority = 0) { @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); - if (!is_array($callback) || 2 !== count($callback)) { + if (!\is_array($callback) || 2 !== \count($callback)) { throw new \InvalidArgumentException('Expected an array("service", "method") argument'); } @@ -149,9 +149,9 @@ public function addSubscriberService($serviceId, $class) @trigger_error(sprintf('The %s class is deprecated since Symfony 3.3 and will be removed in 4.0. Use EventDispatcher with closure factories instead.', __CLASS__), E_USER_DEPRECATED); foreach ($class::getSubscribedEvents() as $eventName => $params) { - if (is_string($params)) { + if (\is_string($params)) { $this->listenerIds[$eventName][] = array($serviceId, $params, 0); - } elseif (is_string($params[0])) { + } elseif (\is_string($params[0])) { $this->listenerIds[$eventName][] = array($serviceId, $params[0], isset($params[1]) ? $params[1] : 0); } else { foreach ($params as $listener) { diff --git a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php index 9b5c689ad..7577b85a1 100644 --- a/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php +++ b/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php @@ -11,11 +11,11 @@ namespace Symfony\Component\EventDispatcher\Debug; +use Psr\Log\LoggerInterface; +use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\EventDispatcher\Event; use Symfony\Component\Stopwatch\Stopwatch; -use Psr\Log\LoggerInterface; /** * Collects some data about event listeners. @@ -222,7 +222,7 @@ public function reset() */ public function __call($method, $arguments) { - return call_user_func_array(array($this->dispatcher, $method), $arguments); + return \call_user_func_array(array($this->dispatcher, $method), $arguments); } /** @@ -249,7 +249,7 @@ private function preProcess($eventName) { foreach ($this->dispatcher->getListeners($eventName) as $listener) { $priority = $this->getListenerPriority($eventName, $listener); - $wrappedListener = new WrappedListener($listener, null, $this->stopwatch, $this); + $wrappedListener = new WrappedListener($listener instanceof WrappedListener ? $listener->getWrappedListener() : $listener, null, $this->stopwatch, $this); $this->wrappedListeners[$eventName][] = $wrappedListener; $this->dispatcher->removeListener($eventName, $listener); $this->dispatcher->addListener($eventName, $wrappedListener, $priority); @@ -301,11 +301,11 @@ private function postProcess($eventName) private function sortListenersByPriority($a, $b) { - if (is_int($a['priority']) && !is_int($b['priority'])) { + if (\is_int($a['priority']) && !\is_int($b['priority'])) { return 1; } - if (!is_int($a['priority']) && is_int($b['priority'])) { + if (!\is_int($a['priority']) && \is_int($b['priority'])) { return -1; } diff --git a/vendor/symfony/event-dispatcher/Debug/WrappedListener.php b/vendor/symfony/event-dispatcher/Debug/WrappedListener.php index f7b0273e1..d49f69de7 100644 --- a/vendor/symfony/event-dispatcher/Debug/WrappedListener.php +++ b/vendor/symfony/event-dispatcher/Debug/WrappedListener.php @@ -11,9 +11,9 @@ namespace Symfony\Component\EventDispatcher\Debug; -use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\VarDumper\Caster\ClassStub; /** @@ -34,21 +34,28 @@ class WrappedListener public function __construct($listener, $name, Stopwatch $stopwatch, EventDispatcherInterface $dispatcher = null) { $this->listener = $listener; - $this->name = $name; $this->stopwatch = $stopwatch; $this->dispatcher = $dispatcher; $this->called = false; $this->stoppedPropagation = false; - if (is_array($listener)) { - $this->name = is_object($listener[0]) ? get_class($listener[0]) : $listener[0]; + if (\is_array($listener)) { + $this->name = \is_object($listener[0]) ? \get_class($listener[0]) : $listener[0]; $this->pretty = $this->name.'::'.$listener[1]; } elseif ($listener instanceof \Closure) { - $this->pretty = $this->name = 'closure'; - } elseif (is_string($listener)) { + $r = new \ReflectionFunction($listener); + if (false !== strpos($r->name, '{closure}')) { + $this->pretty = $this->name = 'closure'; + } elseif ($class = $r->getClosureScopeClass()) { + $this->name = $class->name; + $this->pretty = $this->name.'::'.$r->name; + } else { + $this->pretty = $this->name = $r->name; + } + } elseif (\is_string($listener)) { $this->pretty = $this->name = $listener; } else { - $this->name = get_class($listener); + $this->name = \get_class($listener); $this->pretty = $this->name.'::__invoke'; } @@ -101,7 +108,7 @@ public function __invoke(Event $event, $eventName, EventDispatcherInterface $dis $e = $this->stopwatch->start($this->name, 'event_listener'); - call_user_func($this->listener, $event, $eventName, $this->dispatcher ?: $dispatcher); + \call_user_func($this->listener, $event, $eventName, $this->dispatcher ?: $dispatcher); if ($e->isStarted()) { $e->stop(); diff --git a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php b/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php index ff636d618..a6fcde33a 100644 --- a/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php +++ b/vendor/symfony/event-dispatcher/DependencyInjection/RegisterListenersPass.php @@ -12,8 +12,8 @@ namespace Symfony\Component\EventDispatcher\DependencyInjection; use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\EventDispatcher\EventDispatcher; diff --git a/vendor/symfony/event-dispatcher/EventDispatcher.php b/vendor/symfony/event-dispatcher/EventDispatcher.php index bc79a958d..4e75c63e4 100644 --- a/vendor/symfony/event-dispatcher/EventDispatcher.php +++ b/vendor/symfony/event-dispatcher/EventDispatcher.php @@ -82,13 +82,13 @@ public function getListenerPriority($eventName, $listener) return; } - if (is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) { + if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) { $listener[0] = $listener[0](); } foreach ($this->listeners[$eventName] as $priority => $listeners) { foreach ($listeners as $k => $v) { - if ($v !== $listener && is_array($v) && isset($v[0]) && $v[0] instanceof \Closure) { + if ($v !== $listener && \is_array($v) && isset($v[0]) && $v[0] instanceof \Closure) { $v[0] = $v[0](); $this->listeners[$eventName][$priority][$k] = $v; } @@ -135,13 +135,13 @@ public function removeListener($eventName, $listener) return; } - if (is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) { + if (\is_array($listener) && isset($listener[0]) && $listener[0] instanceof \Closure) { $listener[0] = $listener[0](); } foreach ($this->listeners[$eventName] as $priority => $listeners) { foreach ($listeners as $k => $v) { - if ($v !== $listener && is_array($v) && isset($v[0]) && $v[0] instanceof \Closure) { + if ($v !== $listener && \is_array($v) && isset($v[0]) && $v[0] instanceof \Closure) { $v[0] = $v[0](); } if ($v === $listener) { @@ -165,9 +165,9 @@ public function removeListener($eventName, $listener) public function addSubscriber(EventSubscriberInterface $subscriber) { foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { - if (is_string($params)) { + if (\is_string($params)) { $this->addListener($eventName, array($subscriber, $params)); - } elseif (is_string($params[0])) { + } elseif (\is_string($params[0])) { $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0); } else { foreach ($params as $listener) { @@ -183,12 +183,12 @@ public function addSubscriber(EventSubscriberInterface $subscriber) public function removeSubscriber(EventSubscriberInterface $subscriber) { foreach ($subscriber->getSubscribedEvents() as $eventName => $params) { - if (is_array($params) && is_array($params[0])) { + if (\is_array($params) && \is_array($params[0])) { foreach ($params as $listener) { $this->removeListener($eventName, array($subscriber, $listener[0])); } } else { - $this->removeListener($eventName, array($subscriber, is_string($params) ? $params : $params[0])); + $this->removeListener($eventName, array($subscriber, \is_string($params) ? $params : $params[0])); } } } diff --git a/vendor/symfony/event-dispatcher/GenericEvent.php b/vendor/symfony/event-dispatcher/GenericEvent.php index 95c99408d..f0be7e18f 100644 --- a/vendor/symfony/event-dispatcher/GenericEvent.php +++ b/vendor/symfony/event-dispatcher/GenericEvent.php @@ -38,7 +38,7 @@ public function __construct($subject = null, array $arguments = array()) /** * Getter for subject property. * - * @return mixed $subject The observer subject + * @return mixed The observer subject */ public function getSubject() { diff --git a/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php index 9997a7b0e..6d377d11f 100644 --- a/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php +++ b/vendor/symfony/event-dispatcher/Tests/AbstractEventDispatcherTest.php @@ -426,7 +426,7 @@ public static function getSubscribedEvents() return array( 'pre.foo' => array('preFoo', 10), 'post.foo' => array('postFoo'), - ); + ); } } diff --git a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php b/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php index 53a3421af..d7c5ce18c 100644 --- a/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php +++ b/vendor/symfony/event-dispatcher/Tests/Debug/TraceableEventDispatcherTest.php @@ -13,10 +13,10 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher; +use Symfony\Component\EventDispatcher\Event; +use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\EventDispatcher\EventDispatcher; -use Symfony\Component\EventDispatcher\Event; use Symfony\Component\Stopwatch\Stopwatch; class TraceableEventDispatcherTest extends TestCase diff --git a/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php b/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php new file mode 100644 index 000000000..f743f148d --- /dev/null +++ b/vendor/symfony/event-dispatcher/Tests/Debug/WrappedListenerTest.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\EventDispatcher\Tests\Debug; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\EventDispatcher\Debug\WrappedListener; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\Stopwatch\Stopwatch; + +class WrappedListenerTest extends TestCase +{ + /** + * @dataProvider provideListenersToDescribe + */ + public function testListenerDescription(callable $listener, $expected) + { + $wrappedListener = new WrappedListener($listener, null, $this->getMockBuilder(Stopwatch::class)->getMock(), $this->getMockBuilder(EventDispatcherInterface::class)->getMock()); + + $this->assertStringMatchesFormat($expected, $wrappedListener->getPretty()); + } + + public function provideListenersToDescribe() + { + $listeners = array( + array(new FooListener(), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::__invoke'), + array(array(new FooListener(), 'listen'), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'), + array(array('Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic'), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'), + array('var_dump', 'var_dump'), + array(function () {}, 'closure'), + ); + + if (\PHP_VERSION_ID >= 70100) { + $listeners[] = array(\Closure::fromCallable(array(new FooListener(), 'listen')), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listen'); + $listeners[] = array(\Closure::fromCallable(array('Symfony\Component\EventDispatcher\Tests\Debug\FooListener', 'listenStatic')), 'Symfony\Component\EventDispatcher\Tests\Debug\FooListener::listenStatic'); + $listeners[] = array(\Closure::fromCallable(function () {}), 'closure'); + } + + return $listeners; + } +} + +class FooListener +{ + public function listen() + { + } + + public function __invoke() + { + } + + public static function listenStatic() + { + } +} diff --git a/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php b/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php index 9cf68c987..b63f69df1 100644 --- a/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php +++ b/vendor/symfony/event-dispatcher/Tests/GenericEventTest.php @@ -31,8 +31,6 @@ class GenericEventTest extends TestCase */ protected function setUp() { - parent::setUp(); - $this->subject = new \stdClass(); $this->event = new GenericEvent($this->subject, array('name' => 'Event')); } @@ -44,8 +42,6 @@ protected function tearDown() { $this->subject = null; $this->event = null; - - parent::tearDown(); } public function testConstruct() diff --git a/vendor/symfony/event-dispatcher/phpunit.xml.dist b/vendor/symfony/event-dispatcher/phpunit.xml.dist index b3ad1bdf5..f2eb1692c 100644 --- a/vendor/symfony/event-dispatcher/phpunit.xml.dist +++ b/vendor/symfony/event-dispatcher/phpunit.xml.dist @@ -1,7 +1,7 @@ mkdir(dirname($targetFile)); + $this->mkdir(\dirname($targetFile)); $doCopy = true; if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) { @@ -95,12 +97,11 @@ public function mkdir($dirs, $mode = 0777) continue; } - if (true !== @mkdir($dir, $mode, true)) { - $error = error_get_last(); + if (!self::box('mkdir', $dir, $mode, true)) { if (!is_dir($dir)) { // The directory was not created by a concurrent process. Let's throw an exception with a developer friendly error message if we have one - if ($error) { - throw new IOException(sprintf('Failed to create "%s": %s.', $dir, $error['message']), 0, null, $dir); + if (self::$lastError) { + throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir); } throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir); } @@ -120,7 +121,7 @@ public function exists($files) $maxPathLength = PHP_MAXPATHLEN - 2; foreach ($this->toIterable($files) as $file) { - if (strlen($file) > $maxPathLength) { + if (\strlen($file) > $maxPathLength) { throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file); } @@ -162,27 +163,24 @@ public function remove($files) { if ($files instanceof \Traversable) { $files = iterator_to_array($files, false); - } elseif (!is_array($files)) { + } elseif (!\is_array($files)) { $files = array($files); } $files = array_reverse($files); foreach ($files as $file) { if (is_link($file)) { // See https://bugs.php.net/52176 - if (!@(unlink($file) || '\\' !== DIRECTORY_SEPARATOR || rmdir($file)) && file_exists($file)) { - $error = error_get_last(); - throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, $error['message'])); + if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) { + throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError)); } } elseif (is_dir($file)) { $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS)); - if (!@rmdir($file) && file_exists($file)) { - $error = error_get_last(); - throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, $error['message'])); + if (!self::box('rmdir', $file) && file_exists($file)) { + throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError)); } - } elseif (!@unlink($file) && file_exists($file)) { - $error = error_get_last(); - throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, $error['message'])); + } elseif (!self::box('unlink', $file) && file_exists($file)) { + throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError)); } } } @@ -224,7 +222,7 @@ public function chown($files, $user, $recursive = false) if ($recursive && is_dir($file) && !is_link($file)) { $this->chown(new \FilesystemIterator($file), $user, true); } - if (is_link($file) && function_exists('lchown')) { + if (is_link($file) && \function_exists('lchown')) { if (true !== @lchown($file, $user)) { throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file); } @@ -251,8 +249,8 @@ public function chgrp($files, $group, $recursive = false) if ($recursive && is_dir($file) && !is_link($file)) { $this->chgrp(new \FilesystemIterator($file), $group, true); } - if (is_link($file) && function_exists('lchgrp')) { - if (true !== @lchgrp($file, $group) || (defined('HHVM_VERSION') && !posix_getgrnam($group))) { + if (is_link($file) && \function_exists('lchgrp')) { + if (true !== @lchgrp($file, $group) || (\defined('HHVM_VERSION') && !posix_getgrnam($group))) { throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file); } } else { @@ -305,7 +303,7 @@ private function isReadable($filename) { $maxPathLength = PHP_MAXPATHLEN - 2; - if (strlen($filename) > $maxPathLength) { + if (\strlen($filename) > $maxPathLength) { throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename); } @@ -323,7 +321,7 @@ private function isReadable($filename) */ public function symlink($originDir, $targetDir, $copyOnWindows = false) { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $originDir = strtr($originDir, '/', '\\'); $targetDir = strtr($targetDir, '/', '\\'); @@ -334,18 +332,16 @@ public function symlink($originDir, $targetDir, $copyOnWindows = false) } } - $this->mkdir(dirname($targetDir)); + $this->mkdir(\dirname($targetDir)); - $ok = false; if (is_link($targetDir)) { - if (readlink($targetDir) != $originDir) { - $this->remove($targetDir); - } else { - $ok = true; + if (readlink($targetDir) === $originDir) { + return; } + $this->remove($targetDir); } - if (!$ok && true !== @symlink($originDir, $targetDir)) { + if (!self::box('symlink', $originDir, $targetDir)) { $this->linkException($originDir, $targetDir, 'symbolic'); } } @@ -377,7 +373,7 @@ public function hardlink($originFile, $targetFiles) $this->remove($targetFile); } - if (true !== @link($originFile, $targetFile)) { + if (!self::box('link', $originFile, $targetFile)) { $this->linkException($originFile, $targetFile, 'hard'); } } @@ -390,9 +386,8 @@ public function hardlink($originFile, $targetFiles) */ private function linkException($origin, $target, $linkType) { - $report = error_get_last(); - if (is_array($report)) { - if ('\\' === DIRECTORY_SEPARATOR && false !== strpos($report['message'], 'error code(1314)')) { + if (self::$lastError) { + if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) { throw new IOException(sprintf('Unable to create %s link due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', $linkType), 0, null, $target); } } @@ -426,14 +421,14 @@ public function readlink($path, $canonicalize = false) return; } - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $path = readlink($path); } return realpath($path); } - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { return realpath($path); } @@ -455,13 +450,13 @@ public function makePathRelative($endPath, $startPath) } // Normalize separators on Windows - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $endPath = str_replace('\\', '/', $endPath); $startPath = str_replace('\\', '/', $startPath); } $stripDriveLetter = function ($path) { - if (strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) { + if (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) { return substr($path, 2); } @@ -479,7 +474,7 @@ public function makePathRelative($endPath, $startPath) $result = array(); foreach ($pathSegments as $segment) { - if ('..' === $segment && ($absolute || count($result))) { + if ('..' === $segment && ($absolute || \count($result))) { array_pop($result); } elseif ('.' !== $segment) { $result[] = $segment; @@ -499,16 +494,16 @@ public function makePathRelative($endPath, $startPath) } // Determine how deep the start path is relative to the common path (ie, "web/bundles" = 2 levels) - if (1 === count($startPathArr) && '' === $startPathArr[0]) { + if (1 === \count($startPathArr) && '' === $startPathArr[0]) { $depth = 0; } else { - $depth = count($startPathArr) - $index; + $depth = \count($startPathArr) - $index; } // Repeated "../" for each level need to reach the common path $traverser = str_repeat('../', $depth); - $endPathRemainder = implode('/', array_slice($endPathArr, $index)); + $endPathRemainder = implode('/', \array_slice($endPathArr, $index)); // Construct $endPath from traversing to the common path, then to the remaining $endPath $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : ''); @@ -539,7 +534,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o { $targetDir = rtrim($targetDir, '/\\'); $originDir = rtrim($originDir, '/\\'); - $originDirLen = strlen($originDir); + $originDirLen = \strlen($originDir); // Iterate in destination folder to remove obsolete entries if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) { @@ -548,7 +543,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o $flags = \FilesystemIterator::SKIP_DOTS; $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST); } - $targetDirLen = strlen($targetDir); + $targetDirLen = \strlen($targetDir); foreach ($deleteIterator as $file) { $origin = $originDir.substr($file->getPathname(), $targetDirLen); if (!$this->exists($origin)) { @@ -606,7 +601,7 @@ public function mirror($originDir, $targetDir, \Traversable $iterator = null, $o public function isAbsolutePath($file) { return strspn($file, '/\\', 0, 1) - || (strlen($file) > 3 && ctype_alpha($file[0]) + || (\strlen($file) > 3 && ctype_alpha($file[0]) && ':' === $file[1] && strspn($file, '/\\', 2, 1) ) @@ -676,7 +671,7 @@ public function tempnam($dir, $prefix) */ public function dumpFile($filename, $content) { - $dir = dirname($filename); + $dir = \dirname($filename); if (!is_dir($dir)) { $this->mkdir($dir); @@ -709,7 +704,7 @@ public function dumpFile($filename, $content) */ public function appendToFile($filename, $content) { - $dir = dirname($filename); + $dir = \dirname($filename); if (!is_dir($dir)) { $this->mkdir($dir); @@ -731,7 +726,7 @@ public function appendToFile($filename, $content) */ private function toIterable($files) { - return is_array($files) || $files instanceof \Traversable ? $files : array($files); + return \is_array($files) || $files instanceof \Traversable ? $files : array($files); } /** @@ -745,6 +740,31 @@ private function getSchemeAndHierarchy($filename) { $components = explode('://', $filename, 2); - return 2 === count($components) ? array($components[0], $components[1]) : array(null, $components[0]); + return 2 === \count($components) ? array($components[0], $components[1]) : array(null, $components[0]); + } + + private static function box($func) + { + self::$lastError = null; + \set_error_handler(__CLASS__.'::handleError'); + try { + $result = \call_user_func_array($func, \array_slice(\func_get_args(), 1)); + \restore_error_handler(); + + return $result; + } catch (\Throwable $e) { + } catch (\Exception $e) { + } + \restore_error_handler(); + + throw $e; + } + + /** + * @internal + */ + public static function handleError($type, $msg) + { + self::$lastError = $msg; } } diff --git a/vendor/symfony/filesystem/LockHandler.php b/vendor/symfony/filesystem/LockHandler.php index a2e7ad5c3..8e0eb7412 100644 --- a/vendor/symfony/filesystem/LockHandler.php +++ b/vendor/symfony/filesystem/LockHandler.php @@ -81,12 +81,12 @@ public function lock($blocking = false) $error = $msg; }); - if (!$this->handle = fopen($this->file, 'r')) { + if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) { if ($this->handle = fopen($this->file, 'x')) { - chmod($this->file, 0444); - } elseif (!$this->handle = fopen($this->file, 'r')) { + chmod($this->file, 0666); + } elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) { usleep(100); // Give some time for chmod() to complete - $this->handle = fopen($this->file, 'r'); + $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r'); } } restore_error_handler(); diff --git a/vendor/symfony/filesystem/Tests/ExceptionTest.php b/vendor/symfony/filesystem/Tests/ExceptionTest.php index 5a04e0409..300acf103 100644 --- a/vendor/symfony/filesystem/Tests/ExceptionTest.php +++ b/vendor/symfony/filesystem/Tests/ExceptionTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Filesystem\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\Filesystem\Exception\IOException; use Symfony\Component\Filesystem\Exception\FileNotFoundException; +use Symfony\Component\Filesystem\Exception\IOException; /** * Test class for Filesystem. diff --git a/vendor/symfony/filesystem/Tests/FilesystemTest.php b/vendor/symfony/filesystem/Tests/FilesystemTest.php index 5898fc257..df8b8124f 100644 --- a/vendor/symfony/filesystem/Tests/FilesystemTest.php +++ b/vendor/symfony/filesystem/Tests/FilesystemTest.php @@ -18,8 +18,8 @@ class FilesystemTest extends FilesystemTestCase { public function testCopyCreatesNewFile() { - $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; - $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + $sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file'; file_put_contents($sourceFilePath, 'SOURCE FILE'); @@ -34,8 +34,8 @@ public function testCopyCreatesNewFile() */ public function testCopyFails() { - $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; - $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + $sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file'; $this->filesystem->copy($sourceFilePath, $targetFilePath); } @@ -46,12 +46,16 @@ public function testCopyFails() public function testCopyUnreadableFileFails() { // skip test on Windows; PHP can't easily set file as unreadable on Windows - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('This test cannot run on Windows.'); } - $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; - $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + if (!getenv('USER') || 'root' === getenv('USER')) { + $this->markTestSkipped('This test will fail if run under superuser'); + } + + $sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file'; file_put_contents($sourceFilePath, 'SOURCE FILE'); @@ -63,8 +67,8 @@ public function testCopyUnreadableFileFails() public function testCopyOverridesExistingFileIfModified() { - $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; - $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + $sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file'; file_put_contents($sourceFilePath, 'SOURCE FILE'); file_put_contents($targetFilePath, 'TARGET FILE'); @@ -78,8 +82,8 @@ public function testCopyOverridesExistingFileIfModified() public function testCopyDoesNotOverrideExistingFileByDefault() { - $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; - $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + $sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file'; file_put_contents($sourceFilePath, 'SOURCE FILE'); file_put_contents($targetFilePath, 'TARGET FILE'); @@ -97,8 +101,8 @@ public function testCopyDoesNotOverrideExistingFileByDefault() public function testCopyOverridesExistingFileIfForced() { - $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; - $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + $sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file'; file_put_contents($sourceFilePath, 'SOURCE FILE'); file_put_contents($targetFilePath, 'TARGET FILE'); @@ -120,12 +124,16 @@ public function testCopyOverridesExistingFileIfForced() public function testCopyWithOverrideWithReadOnlyTargetFails() { // skip test on Windows; PHP can't easily set file as unwritable on Windows - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('This test cannot run on Windows.'); } - $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; - $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + if (!getenv('USER') || 'root' === getenv('USER')) { + $this->markTestSkipped('This test will fail if run under superuser'); + } + + $sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file'; file_put_contents($sourceFilePath, 'SOURCE FILE'); file_put_contents($targetFilePath, 'TARGET FILE'); @@ -143,9 +151,9 @@ public function testCopyWithOverrideWithReadOnlyTargetFails() public function testCopyCreatesTargetDirectoryIfItDoesNotExist() { - $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; - $targetFileDirectory = $this->workspace.DIRECTORY_SEPARATOR.'directory'; - $targetFilePath = $targetFileDirectory.DIRECTORY_SEPARATOR.'copy_target_file'; + $sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFileDirectory = $this->workspace.\DIRECTORY_SEPARATOR.'directory'; + $targetFilePath = $targetFileDirectory.\DIRECTORY_SEPARATOR.'copy_target_file'; file_put_contents($sourceFilePath, 'SOURCE FILE'); @@ -161,8 +169,11 @@ public function testCopyCreatesTargetDirectoryIfItDoesNotExist() */ public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToCopy() { - $sourceFilePath = 'http://symfony.com/images/common/logo/logo_symfony_header.png'; - $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + if (!\in_array('https', stream_get_wrappers())) { + $this->markTestSkipped('"https" stream wrapper is not enabled.'); + } + $sourceFilePath = 'https://symfony.com/images/common/logo/logo_symfony_header.png'; + $targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file'; file_put_contents($targetFilePath, 'TARGET FILE'); @@ -175,8 +186,8 @@ public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToCopy() public function testMkdirCreatesDirectoriesRecursively() { $directory = $this->workspace - .DIRECTORY_SEPARATOR.'directory' - .DIRECTORY_SEPARATOR.'sub_directory'; + .\DIRECTORY_SEPARATOR.'directory' + .\DIRECTORY_SEPARATOR.'sub_directory'; $this->filesystem->mkdir($directory); @@ -185,7 +196,7 @@ public function testMkdirCreatesDirectoriesRecursively() public function testMkdirCreatesDirectoriesFromArray() { - $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR; $directories = array( $basePath.'1', $basePath.'2', $basePath.'3', ); @@ -199,7 +210,7 @@ public function testMkdirCreatesDirectoriesFromArray() public function testMkdirCreatesDirectoriesFromTraversableObject() { - $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR; $directories = new \ArrayObject(array( $basePath.'1', $basePath.'2', $basePath.'3', )); @@ -216,7 +227,7 @@ public function testMkdirCreatesDirectoriesFromTraversableObject() */ public function testMkdirCreatesDirectoriesFails() { - $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR; $dir = $basePath.'2'; file_put_contents($dir, ''); @@ -226,7 +237,7 @@ public function testMkdirCreatesDirectoriesFails() public function testTouchCreatesEmptyFile() { - $file = $this->workspace.DIRECTORY_SEPARATOR.'1'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'1'; $this->filesystem->touch($file); @@ -238,14 +249,14 @@ public function testTouchCreatesEmptyFile() */ public function testTouchFails() { - $file = $this->workspace.DIRECTORY_SEPARATOR.'1'.DIRECTORY_SEPARATOR.'2'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'1'.\DIRECTORY_SEPARATOR.'2'; $this->filesystem->touch($file); } public function testTouchCreatesEmptyFilesFromArray() { - $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR; $files = array( $basePath.'1', $basePath.'2', $basePath.'3', ); @@ -259,7 +270,7 @@ public function testTouchCreatesEmptyFilesFromArray() public function testTouchCreatesEmptyFilesFromTraversableObject() { - $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR; $files = new \ArrayObject(array( $basePath.'1', $basePath.'2', $basePath.'3', )); @@ -273,7 +284,7 @@ public function testTouchCreatesEmptyFilesFromTraversableObject() public function testRemoveCleansFilesAndDirectoriesIteratively() { - $basePath = $this->workspace.DIRECTORY_SEPARATOR.'directory'.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR.'directory'.\DIRECTORY_SEPARATOR; mkdir($basePath); mkdir($basePath.'dir'); @@ -286,7 +297,7 @@ public function testRemoveCleansFilesAndDirectoriesIteratively() public function testRemoveCleansArrayOfFilesAndDirectories() { - $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR; mkdir($basePath.'dir'); touch($basePath.'file'); @@ -303,7 +314,7 @@ public function testRemoveCleansArrayOfFilesAndDirectories() public function testRemoveCleansTraversableObjectOfFilesAndDirectories() { - $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR; mkdir($basePath.'dir'); touch($basePath.'file'); @@ -320,7 +331,7 @@ public function testRemoveCleansTraversableObjectOfFilesAndDirectories() public function testRemoveIgnoresNonExistingFiles() { - $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR; mkdir($basePath.'dir'); @@ -337,7 +348,7 @@ public function testRemoveCleansInvalidLinks() { $this->markAsSkippedIfSymlinkIsMissing(); - $basePath = $this->workspace.DIRECTORY_SEPARATOR.'directory'.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR.'directory'.\DIRECTORY_SEPARATOR; mkdir($basePath); mkdir($basePath.'dir'); @@ -350,7 +361,7 @@ public function testRemoveCleansInvalidLinks() // create symlink to nonexistent dir rmdir($basePath.'dir'); - $this->assertFalse('\\' === DIRECTORY_SEPARATOR ? @readlink($basePath.'dir-link') : is_dir($basePath.'dir-link')); + $this->assertFalse('\\' === \DIRECTORY_SEPARATOR ? @readlink($basePath.'dir-link') : is_dir($basePath.'dir-link')); $this->filesystem->remove($basePath); @@ -359,7 +370,7 @@ public function testRemoveCleansInvalidLinks() public function testFilesExists() { - $basePath = $this->workspace.DIRECTORY_SEPARATOR.'directory'.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR.'directory'.\DIRECTORY_SEPARATOR; mkdir($basePath); touch($basePath.'file1'); @@ -374,7 +385,7 @@ public function testFilesExists() */ public function testFilesExistsFails() { - if ('\\' !== DIRECTORY_SEPARATOR) { + if ('\\' !== \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Long file names are an issue on Windows'); } $basePath = $this->workspace.'\\directory\\'; @@ -383,7 +394,7 @@ public function testFilesExistsFails() $oldPath = getcwd(); mkdir($basePath); chdir($basePath); - $file = str_repeat('T', $maxPathLength - strlen($basePath) + 1); + $file = str_repeat('T', $maxPathLength - \strlen($basePath) + 1); $path = $basePath.$file; exec('TYPE NUL >>'.$file); // equivalent of touch, we can not use the php touch() here because it suffers from the same limitation $this->longPathNamesWindows[] = $path; // save this so we can clean up later @@ -393,7 +404,7 @@ public function testFilesExistsFails() public function testFilesExistsTraversableObjectOfFilesAndDirectories() { - $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR; mkdir($basePath.'dir'); touch($basePath.'file'); @@ -407,7 +418,7 @@ public function testFilesExistsTraversableObjectOfFilesAndDirectories() public function testFilesNotExistsTraversableObjectOfFilesAndDirectories() { - $basePath = $this->workspace.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR; mkdir($basePath.'dir'); touch($basePath.'file'); @@ -424,7 +435,7 @@ public function testFilesNotExistsTraversableObjectOfFilesAndDirectories() public function testInvalidFileNotExists() { - $basePath = $this->workspace.DIRECTORY_SEPARATOR.'directory'.DIRECTORY_SEPARATOR; + $basePath = $this->workspace.\DIRECTORY_SEPARATOR.'directory'.\DIRECTORY_SEPARATOR; $this->assertFalse($this->filesystem->exists($basePath.time())); } @@ -433,9 +444,9 @@ public function testChmodChangesFileMode() { $this->markAsSkippedIfChmodIsMissing(); - $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + $dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir'; mkdir($dir); - $file = $dir.DIRECTORY_SEPARATOR.'file'; + $file = $dir.\DIRECTORY_SEPARATOR.'file'; touch($file); $this->filesystem->chmod($file, 0400); @@ -449,11 +460,11 @@ public function testChmodWithWrongModLeavesPreviousPermissionsUntouched() { $this->markAsSkippedIfChmodIsMissing(); - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $this->markTestSkipped('chmod() changes permissions even when passing invalid modes on HHVM'); } - $dir = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $dir = $this->workspace.\DIRECTORY_SEPARATOR.'file'; touch($dir); $permissions = fileperms($dir); @@ -467,9 +478,9 @@ public function testChmodRecursive() { $this->markAsSkippedIfChmodIsMissing(); - $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + $dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir'; mkdir($dir); - $file = $dir.DIRECTORY_SEPARATOR.'file'; + $file = $dir.\DIRECTORY_SEPARATOR.'file'; touch($file); $this->filesystem->chmod($file, 0400, 0000, true); @@ -483,7 +494,7 @@ public function testChmodAppliesUmask() { $this->markAsSkippedIfChmodIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; touch($file); $this->filesystem->chmod($file, 0770, 0022); @@ -494,8 +505,8 @@ public function testChmodChangesModeOfArrayOfFiles() { $this->markAsSkippedIfChmodIsMissing(); - $directory = $this->workspace.DIRECTORY_SEPARATOR.'directory'; - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $directory = $this->workspace.\DIRECTORY_SEPARATOR.'directory'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; $files = array($directory, $file); mkdir($directory); @@ -511,8 +522,8 @@ public function testChmodChangesModeOfTraversableFileObject() { $this->markAsSkippedIfChmodIsMissing(); - $directory = $this->workspace.DIRECTORY_SEPARATOR.'directory'; - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; + $directory = $this->workspace.\DIRECTORY_SEPARATOR.'directory'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; $files = new \ArrayObject(array($directory, $file)); mkdir($directory); @@ -528,8 +539,8 @@ public function testChmodChangesZeroModeOnSubdirectoriesOnRecursive() { $this->markAsSkippedIfChmodIsMissing(); - $directory = $this->workspace.DIRECTORY_SEPARATOR.'directory'; - $subdirectory = $directory.DIRECTORY_SEPARATOR.'subdirectory'; + $directory = $this->workspace.\DIRECTORY_SEPARATOR.'directory'; + $subdirectory = $directory.\DIRECTORY_SEPARATOR.'subdirectory'; mkdir($directory); mkdir($subdirectory); @@ -544,7 +555,7 @@ public function testChown() { $this->markAsSkippedIfPosixIsMissing(); - $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + $dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir'; mkdir($dir); $owner = $this->getFileOwner($dir); @@ -557,9 +568,9 @@ public function testChownRecursive() { $this->markAsSkippedIfPosixIsMissing(); - $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + $dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir'; mkdir($dir); - $file = $dir.DIRECTORY_SEPARATOR.'file'; + $file = $dir.\DIRECTORY_SEPARATOR.'file'; touch($file); $owner = $this->getFileOwner($dir); @@ -572,8 +583,8 @@ public function testChownSymlink() { $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); @@ -589,8 +600,8 @@ public function testChownLink() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); @@ -609,8 +620,8 @@ public function testChownSymlinkFails() { $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); @@ -626,8 +637,8 @@ public function testChownLinkFails() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); @@ -643,7 +654,7 @@ public function testChownFail() { $this->markAsSkippedIfPosixIsMissing(); - $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + $dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir'; mkdir($dir); $this->filesystem->chown($dir, 'user'.time().mt_rand(1000, 9999)); @@ -653,7 +664,7 @@ public function testChgrp() { $this->markAsSkippedIfPosixIsMissing(); - $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + $dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir'; mkdir($dir); $group = $this->getFileGroup($dir); @@ -666,9 +677,9 @@ public function testChgrpRecursive() { $this->markAsSkippedIfPosixIsMissing(); - $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + $dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir'; mkdir($dir); - $file = $dir.DIRECTORY_SEPARATOR.'file'; + $file = $dir.\DIRECTORY_SEPARATOR.'file'; touch($file); $group = $this->getFileGroup($dir); @@ -681,8 +692,8 @@ public function testChgrpSymlink() { $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); @@ -698,8 +709,8 @@ public function testChgrpLink() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); @@ -718,8 +729,8 @@ public function testChgrpSymlinkFails() { $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); @@ -735,8 +746,8 @@ public function testChgrpLinkFails() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); @@ -752,7 +763,7 @@ public function testChgrpFail() { $this->markAsSkippedIfPosixIsMissing(); - $dir = $this->workspace.DIRECTORY_SEPARATOR.'dir'; + $dir = $this->workspace.\DIRECTORY_SEPARATOR.'dir'; mkdir($dir); $this->filesystem->chgrp($dir, 'user'.time().mt_rand(1000, 9999)); @@ -760,8 +771,8 @@ public function testChgrpFail() public function testRename() { - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $newPath = $this->workspace.DIRECTORY_SEPARATOR.'new_file'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file'; touch($file); $this->filesystem->rename($file, $newPath); @@ -775,8 +786,8 @@ public function testRename() */ public function testRenameThrowsExceptionIfTargetAlreadyExists() { - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $newPath = $this->workspace.DIRECTORY_SEPARATOR.'new_file'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file'; touch($file); touch($newPath); @@ -786,8 +797,8 @@ public function testRenameThrowsExceptionIfTargetAlreadyExists() public function testRenameOverwritesTheTargetIfItAlreadyExists() { - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $newPath = $this->workspace.DIRECTORY_SEPARATOR.'new_file'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file'; touch($file); touch($newPath); @@ -803,20 +814,20 @@ public function testRenameOverwritesTheTargetIfItAlreadyExists() */ public function testRenameThrowsExceptionOnError() { - $file = $this->workspace.DIRECTORY_SEPARATOR.uniqid('fs_test_', true); - $newPath = $this->workspace.DIRECTORY_SEPARATOR.'new_file'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.uniqid('fs_test_', true); + $newPath = $this->workspace.\DIRECTORY_SEPARATOR.'new_file'; $this->filesystem->rename($file, $newPath); } public function testSymlink() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Windows does not support creating "broken" symlinks'); } - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; // $file does not exists right now: creating "broken" links is a wanted feature $this->filesystem->symlink($file, $link); @@ -836,7 +847,7 @@ public function testRemoveSymlink() { $this->markAsSkippedIfSymlinkIsMissing(); - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; $this->filesystem->remove($link); @@ -849,8 +860,8 @@ public function testSymlinkIsOverwrittenIfPointsToDifferentTarget() { $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); symlink($this->workspace, $link); @@ -865,8 +876,8 @@ public function testSymlinkIsNotOverwrittenIfAlreadyCreated() { $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); symlink($file, $link); @@ -881,9 +892,9 @@ public function testSymlinkCreatesTargetDirectoryIfItDoesNotExist() { $this->markAsSkippedIfSymlinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link1 = $this->workspace.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'link'; - $link2 = $this->workspace.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'subdir'.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link1 = $this->workspace.\DIRECTORY_SEPARATOR.'dir'.\DIRECTORY_SEPARATOR.'link'; + $link2 = $this->workspace.\DIRECTORY_SEPARATOR.'dir'.\DIRECTORY_SEPARATOR.'subdir'.\DIRECTORY_SEPARATOR.'link'; touch($file); @@ -900,8 +911,8 @@ public function testLink() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); $this->filesystem->hardlink($file, $link); @@ -917,7 +928,7 @@ public function testRemoveLink() { $this->markAsSkippedIfLinkIsMissing(); - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; $this->filesystem->remove($link); @@ -928,9 +939,9 @@ public function testLinkIsOverwrittenIfPointsToDifferentTarget() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $file2 = $this->workspace.DIRECTORY_SEPARATOR.'file2'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $file2 = $this->workspace.\DIRECTORY_SEPARATOR.'file2'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); touch($file2); @@ -946,8 +957,8 @@ public function testLinkIsNotOverwrittenIfAlreadyCreated() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); link($file, $link); @@ -962,9 +973,9 @@ public function testLinkWithSeveralTargets() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link1 = $this->workspace.DIRECTORY_SEPARATOR.'link'; - $link2 = $this->workspace.DIRECTORY_SEPARATOR.'link2'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link1 = $this->workspace.\DIRECTORY_SEPARATOR.'link'; + $link2 = $this->workspace.\DIRECTORY_SEPARATOR.'link2'; touch($file); @@ -980,8 +991,8 @@ public function testLinkWithSameTarget() { $this->markAsSkippedIfLinkIsMissing(); - $file = $this->workspace.DIRECTORY_SEPARATOR.'file'; - $link = $this->workspace.DIRECTORY_SEPARATOR.'link'; + $file = $this->workspace.\DIRECTORY_SEPARATOR.'file'; + $link = $this->workspace.\DIRECTORY_SEPARATOR.'link'; touch($file); @@ -996,7 +1007,7 @@ public function testReadRelativeLink() { $this->markAsSkippedIfSymlinkIsMissing(); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Relative symbolic links are not supported on Windows'); } @@ -1038,7 +1049,7 @@ public function testReadBrokenLink() { $this->markAsSkippedIfSymlinkIsMissing(); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Windows does not support creating "broken" symlinks'); } @@ -1134,7 +1145,7 @@ public function providePathsForMakePathRelative() array('C:/../../aa/../bb/cc', 'C:/aa/dd/..', '../bb/cc/'), ); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $paths[] = array('c:\var\lib/symfony/src/Symfony/', 'c:/var/lib/symfony/', 'src/Symfony/'); } @@ -1173,8 +1184,8 @@ public function provideLegacyPathsForMakePathRelativeWithRelativePaths() public function testMirrorCopiesFilesAndDirectoriesRecursively() { - $sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR; - $directory = $sourcePath.'directory'.DIRECTORY_SEPARATOR; + $sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR; + $directory = $sourcePath.'directory'.\DIRECTORY_SEPARATOR; $file1 = $directory.'file1'; $file2 = $sourcePath.'file2'; @@ -1183,41 +1194,41 @@ public function testMirrorCopiesFilesAndDirectoriesRecursively() file_put_contents($file1, 'FILE1'); file_put_contents($file2, 'FILE2'); - $targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR; + $targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR; $this->filesystem->mirror($sourcePath, $targetPath); $this->assertTrue(is_dir($targetPath)); $this->assertTrue(is_dir($targetPath.'directory')); - $this->assertFileEquals($file1, $targetPath.'directory'.DIRECTORY_SEPARATOR.'file1'); + $this->assertFileEquals($file1, $targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1'); $this->assertFileEquals($file2, $targetPath.'file2'); $this->filesystem->remove($file1); $this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => false)); - $this->assertTrue($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1')); + $this->assertTrue($this->filesystem->exists($targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1')); $this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => true)); - $this->assertFalse($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1')); + $this->assertFalse($this->filesystem->exists($targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1')); file_put_contents($file1, 'FILE1'); $this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => true)); - $this->assertTrue($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1')); + $this->assertTrue($this->filesystem->exists($targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1')); $this->filesystem->remove($directory); $this->filesystem->mirror($sourcePath, $targetPath, null, array('delete' => true)); $this->assertFalse($this->filesystem->exists($targetPath.'directory')); - $this->assertFalse($this->filesystem->exists($targetPath.'directory'.DIRECTORY_SEPARATOR.'file1')); + $this->assertFalse($this->filesystem->exists($targetPath.'directory'.\DIRECTORY_SEPARATOR.'file1')); } public function testMirrorCreatesEmptyDirectory() { - $sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR; + $sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR; mkdir($sourcePath); - $targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR; + $targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR; $this->filesystem->mirror($sourcePath, $targetPath); @@ -1230,46 +1241,46 @@ public function testMirrorCopiesLinks() { $this->markAsSkippedIfSymlinkIsMissing(); - $sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR; + $sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR; mkdir($sourcePath); file_put_contents($sourcePath.'file1', 'FILE1'); symlink($sourcePath.'file1', $sourcePath.'link1'); - $targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR; + $targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR; $this->filesystem->mirror($sourcePath, $targetPath); $this->assertTrue(is_dir($targetPath)); $this->assertFileEquals($sourcePath.'file1', $targetPath.'link1'); - $this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1')); + $this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1')); } public function testMirrorCopiesLinkedDirectoryContents() { $this->markAsSkippedIfSymlinkIsMissing(true); - $sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR; + $sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR; mkdir($sourcePath.'nested/', 0777, true); file_put_contents($sourcePath.'/nested/file1.txt', 'FILE1'); // Note: We symlink directory, not file symlink($sourcePath.'nested', $sourcePath.'link1'); - $targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR; + $targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR; $this->filesystem->mirror($sourcePath, $targetPath); $this->assertTrue(is_dir($targetPath)); $this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.'link1/file1.txt'); - $this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1')); + $this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1')); } public function testMirrorCopiesRelativeLinkedContents() { $this->markAsSkippedIfSymlinkIsMissing(true); - $sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR; + $sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR; $oldPath = getcwd(); mkdir($sourcePath.'nested/', 0777, true); @@ -1280,25 +1291,25 @@ public function testMirrorCopiesRelativeLinkedContents() chdir($oldPath); - $targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR; + $targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR; $this->filesystem->mirror($sourcePath, $targetPath); $this->assertTrue(is_dir($targetPath)); $this->assertFileEquals($sourcePath.'/nested/file1.txt', $targetPath.'link1/file1.txt'); - $this->assertTrue(is_link($targetPath.DIRECTORY_SEPARATOR.'link1')); - $this->assertEquals('\\' === DIRECTORY_SEPARATOR ? realpath($sourcePath.'\nested') : 'nested', readlink($targetPath.DIRECTORY_SEPARATOR.'link1')); + $this->assertTrue(is_link($targetPath.\DIRECTORY_SEPARATOR.'link1')); + $this->assertEquals('\\' === \DIRECTORY_SEPARATOR ? realpath($sourcePath.'\nested') : 'nested', readlink($targetPath.\DIRECTORY_SEPARATOR.'link1')); } public function testMirrorContentsWithSameNameAsSourceOrTargetWithoutDeleteOption() { - $sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR; + $sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR; mkdir($sourcePath); touch($sourcePath.'source'); touch($sourcePath.'target'); - $targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR; + $targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR; $oldPath = getcwd(); chdir($this->workspace); @@ -1314,12 +1325,12 @@ public function testMirrorContentsWithSameNameAsSourceOrTargetWithoutDeleteOptio public function testMirrorContentsWithSameNameAsSourceOrTargetWithDeleteOption() { - $sourcePath = $this->workspace.DIRECTORY_SEPARATOR.'source'.DIRECTORY_SEPARATOR; + $sourcePath = $this->workspace.\DIRECTORY_SEPARATOR.'source'.\DIRECTORY_SEPARATOR; mkdir($sourcePath); touch($sourcePath.'source'); - $targetPath = $this->workspace.DIRECTORY_SEPARATOR.'target'.DIRECTORY_SEPARATOR; + $targetPath = $this->workspace.\DIRECTORY_SEPARATOR.'target'.\DIRECTORY_SEPARATOR; mkdir($targetPath); touch($targetPath.'source'); @@ -1452,11 +1463,11 @@ public function testTempnamWithHTTPSchemeFails() public function testTempnamOnUnwritableFallsBackToSysTmp() { $scheme = 'file://'; - $dirname = $scheme.$this->workspace.DIRECTORY_SEPARATOR.'does_not_exist'; + $dirname = $scheme.$this->workspace.\DIRECTORY_SEPARATOR.'does_not_exist'; $filename = $this->filesystem->tempnam($dirname, 'bar'); $realTempDir = realpath(sys_get_temp_dir()); - $this->assertStringStartsWith(rtrim($scheme.$realTempDir, DIRECTORY_SEPARATOR), $filename); + $this->assertStringStartsWith(rtrim($scheme.$realTempDir, \DIRECTORY_SEPARATOR), $filename); $this->assertFileExists($filename); // Tear down @@ -1465,10 +1476,10 @@ public function testTempnamOnUnwritableFallsBackToSysTmp() public function testDumpFile() { - $filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt'; + $filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt'; // skip mode check on Windows - if ('\\' !== DIRECTORY_SEPARATOR) { + if ('\\' !== \DIRECTORY_SEPARATOR) { $oldMask = umask(0002); } @@ -1477,15 +1488,40 @@ public function testDumpFile() $this->assertStringEqualsFile($filename, 'bar'); // skip mode check on Windows - if ('\\' !== DIRECTORY_SEPARATOR) { + if ('\\' !== \DIRECTORY_SEPARATOR) { $this->assertFilePermissions(664, $filename); umask($oldMask); } } + public function testDumpFileWithArray() + { + $filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt'; + + $this->filesystem->dumpFile($filename, array('bar')); + + $this->assertFileExists($filename); + $this->assertStringEqualsFile($filename, 'bar'); + } + + public function testDumpFileWithResource() + { + $filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt'; + + $resource = fopen('php://memory', 'rw'); + fwrite($resource, 'bar'); + fseek($resource, 0); + + $this->filesystem->dumpFile($filename, $resource); + + fclose($resource); + $this->assertFileExists($filename); + $this->assertStringEqualsFile($filename, 'bar'); + } + public function testDumpFileOverwritesAnExistingFile() { - $filename = $this->workspace.DIRECTORY_SEPARATOR.'foo.txt'; + $filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo.txt'; file_put_contents($filename, 'FOO BAR'); $this->filesystem->dumpFile($filename, 'bar'); @@ -1496,12 +1532,12 @@ public function testDumpFileOverwritesAnExistingFile() public function testDumpFileWithFileScheme() { - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $this->markTestSkipped('HHVM does not handle the file:// scheme correctly'); } $scheme = 'file://'; - $filename = $scheme.$this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt'; + $filename = $scheme.$this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt'; $this->filesystem->dumpFile($filename, 'bar'); @@ -1512,7 +1548,7 @@ public function testDumpFileWithFileScheme() public function testDumpFileWithZlibScheme() { $scheme = 'compress.zlib://'; - $filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt'; + $filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt'; $this->filesystem->dumpFile($filename, 'bar'); @@ -1523,10 +1559,10 @@ public function testDumpFileWithZlibScheme() public function testAppendToFile() { - $filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.txt'; + $filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'bar.txt'; // skip mode check on Windows - if ('\\' !== DIRECTORY_SEPARATOR) { + if ('\\' !== \DIRECTORY_SEPARATOR) { $oldMask = umask(0002); } @@ -1538,7 +1574,7 @@ public function testAppendToFile() $this->assertStringEqualsFile($filename, 'foobar'); // skip mode check on Windows - if ('\\' !== DIRECTORY_SEPARATOR) { + if ('\\' !== \DIRECTORY_SEPARATOR) { $this->assertFilePermissions(664, $filename); umask($oldMask); } @@ -1546,12 +1582,12 @@ public function testAppendToFile() public function testAppendToFileWithScheme() { - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $this->markTestSkipped('HHVM does not handle the file:// scheme correctly'); } $scheme = 'file://'; - $filename = $scheme.$this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt'; + $filename = $scheme.$this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt'; $this->filesystem->dumpFile($filename, 'foo'); $this->filesystem->appendToFile($filename, 'bar'); @@ -1563,7 +1599,7 @@ public function testAppendToFileWithScheme() public function testAppendToFileWithZlibScheme() { $scheme = 'compress.zlib://'; - $filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'baz.txt'; + $filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'baz.txt'; $this->filesystem->dumpFile($filename, 'foo'); // Zlib stat uses file:// wrapper so remove it @@ -1577,17 +1613,17 @@ public function testAppendToFileWithZlibScheme() public function testAppendToFileCreateTheFileIfNotExists() { - $filename = $this->workspace.DIRECTORY_SEPARATOR.'foo'.DIRECTORY_SEPARATOR.'bar.txt'; + $filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo'.\DIRECTORY_SEPARATOR.'bar.txt'; // skip mode check on Windows - if ('\\' !== DIRECTORY_SEPARATOR) { + if ('\\' !== \DIRECTORY_SEPARATOR) { $oldMask = umask(0002); } $this->filesystem->appendToFile($filename, 'bar'); // skip mode check on Windows - if ('\\' !== DIRECTORY_SEPARATOR) { + if ('\\' !== \DIRECTORY_SEPARATOR) { $this->assertFilePermissions(664, $filename); umask($oldMask); } @@ -1600,7 +1636,7 @@ public function testDumpKeepsExistingPermissionsWhenOverwritingAnExistingFile() { $this->markAsSkippedIfChmodIsMissing(); - $filename = $this->workspace.DIRECTORY_SEPARATOR.'foo.txt'; + $filename = $this->workspace.\DIRECTORY_SEPARATOR.'foo.txt'; file_put_contents($filename, 'FOO BAR'); chmod($filename, 0745); @@ -1613,8 +1649,8 @@ public function testCopyShouldKeepExecutionPermission() { $this->markAsSkippedIfChmodIsMissing(); - $sourceFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_source_file'; - $targetFilePath = $this->workspace.DIRECTORY_SEPARATOR.'copy_target_file'; + $sourceFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_source_file'; + $targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file'; file_put_contents($sourceFilePath, 'SOURCE FILE'); chmod($sourceFilePath, 0745); @@ -1633,6 +1669,6 @@ public function testCopyShouldKeepExecutionPermission() */ private function normalize($path) { - return str_replace('/', DIRECTORY_SEPARATOR, $path); + return str_replace('/', \DIRECTORY_SEPARATOR, $path); } } diff --git a/vendor/symfony/filesystem/Tests/FilesystemTestCase.php b/vendor/symfony/filesystem/Tests/FilesystemTestCase.php index cde01e50e..642925dde 100644 --- a/vendor/symfony/filesystem/Tests/FilesystemTestCase.php +++ b/vendor/symfony/filesystem/Tests/FilesystemTestCase.php @@ -31,24 +31,24 @@ class FilesystemTestCase extends TestCase protected $workspace = null; /** - * @var null|bool Flag for hard links on Windows + * @var bool|null Flag for hard links on Windows */ private static $linkOnWindows = null; /** - * @var null|bool Flag for symbolic links on Windows + * @var bool|null Flag for symbolic links on Windows */ private static $symlinkOnWindows = null; public static function setUpBeforeClass() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { self::$linkOnWindows = true; $originFile = tempnam(sys_get_temp_dir(), 'li'); $targetFile = tempnam(sys_get_temp_dir(), 'li'); if (true !== @link($originFile, $targetFile)) { $report = error_get_last(); - if (is_array($report) && false !== strpos($report['message'], 'error code(1314)')) { + if (\is_array($report) && false !== strpos($report['message'], 'error code(1314)')) { self::$linkOnWindows = false; } } else { @@ -60,7 +60,7 @@ public static function setUpBeforeClass() $targetDir = tempnam(sys_get_temp_dir(), 'sl'); if (true !== @symlink($originDir, $targetDir)) { $report = error_get_last(); - if (is_array($report) && false !== strpos($report['message'], 'error code(1314)')) { + if (\is_array($report) && false !== strpos($report['message'], 'error code(1314)')) { self::$symlinkOnWindows = false; } } else { @@ -129,37 +129,37 @@ protected function getFileGroup($filepath) protected function markAsSkippedIfLinkIsMissing() { - if (!function_exists('link')) { + if (!\function_exists('link')) { $this->markTestSkipped('link is not supported'); } - if ('\\' === DIRECTORY_SEPARATOR && false === self::$linkOnWindows) { + if ('\\' === \DIRECTORY_SEPARATOR && false === self::$linkOnWindows) { $this->markTestSkipped('link requires "Create hard links" privilege on windows'); } } protected function markAsSkippedIfSymlinkIsMissing($relative = false) { - if ('\\' === DIRECTORY_SEPARATOR && false === self::$symlinkOnWindows) { + if ('\\' === \DIRECTORY_SEPARATOR && false === self::$symlinkOnWindows) { $this->markTestSkipped('symlink requires "Create symbolic links" privilege on Windows'); } // https://bugs.php.net/bug.php?id=69473 - if ($relative && '\\' === DIRECTORY_SEPARATOR && 1 === PHP_ZTS) { + if ($relative && '\\' === \DIRECTORY_SEPARATOR && 1 === PHP_ZTS) { $this->markTestSkipped('symlink does not support relative paths on thread safe Windows PHP versions'); } } protected function markAsSkippedIfChmodIsMissing() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('chmod is not supported on Windows'); } } protected function markAsSkippedIfPosixIsMissing() { - if (!function_exists('posix_isatty')) { + if (!\function_exists('posix_isatty')) { $this->markTestSkipped('Function posix_isatty is required.'); } } diff --git a/vendor/symfony/filesystem/Tests/LockHandlerTest.php b/vendor/symfony/filesystem/Tests/LockHandlerTest.php index e0b2281e0..14eabc021 100644 --- a/vendor/symfony/filesystem/Tests/LockHandlerTest.php +++ b/vendor/symfony/filesystem/Tests/LockHandlerTest.php @@ -48,10 +48,14 @@ public function testConstructWhenRepositoryIsNotWriteable() public function testErrorHandlingInLockIfLockPathBecomesUnwritable() { // skip test on Windows; PHP can't easily set file as unreadable on Windows - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('This test cannot run on Windows.'); } + if (!getenv('USER') || 'root' === getenv('USER')) { + $this->markTestSkipped('This test will fail if run under superuser'); + } + $lockPath = sys_get_temp_dir().'/'.uniqid('', true); $e = null; $wrongMessage = null; @@ -79,7 +83,7 @@ public function testErrorHandlingInLockIfLockPathBecomesUnwritable() $fs->remove($lockPath); } - $this->assertInstanceOf('Symfony\Component\Filesystem\Exception\IOException', $e, sprintf('Expected IOException to be thrown, got %s instead.', get_class($e))); + $this->assertInstanceOf('Symfony\Component\Filesystem\Exception\IOException', $e, sprintf('Expected IOException to be thrown, got %s instead.', \get_class($e))); $this->assertNull($wrongMessage, sprintf('Expected exception message to contain "Permission denied", got "%s" instead.', $wrongMessage)); } diff --git a/vendor/symfony/filesystem/composer.json b/vendor/symfony/filesystem/composer.json index 878a3c80e..0fc8043cc 100644 --- a/vendor/symfony/filesystem/composer.json +++ b/vendor/symfony/filesystem/composer.json @@ -16,7 +16,8 @@ } ], "require": { - "php": "^5.5.9|>=7.0.8" + "php": "^5.5.9|>=7.0.8", + "symfony/polyfill-ctype": "~1.8" }, "autoload": { "psr-4": { "Symfony\\Component\\Filesystem\\": "" }, diff --git a/vendor/symfony/filesystem/phpunit.xml.dist b/vendor/symfony/filesystem/phpunit.xml.dist index 7bba6fc2f..5515fff1a 100644 --- a/vendor/symfony/filesystem/phpunit.xml.dist +++ b/vendor/symfony/filesystem/phpunit.xml.dist @@ -1,7 +1,7 @@ ', '<', '>=', '<=', '==', '!='))) { + if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) { throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator)); } diff --git a/vendor/symfony/finder/Finder.php b/vendor/symfony/finder/Finder.php index 278b9841f..050162970 100644 --- a/vendor/symfony/finder/Finder.php +++ b/vendor/symfony/finder/Finder.php @@ -31,7 +31,7 @@ * * All methods return the current Finder object to allow easy chaining: * - * $finder = Finder::create()->files()->name('*.php')->in(__DIR__); + * $finder = Finder::create()->files()->name('*.php')->in(__DIR__); * * @author Fabien Potencier */ @@ -105,8 +105,8 @@ public function files() * * Usage: * - * $finder->depth('> 1') // the Finder will start matching at level 1. - * $finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point. + * $finder->depth('> 1') // the Finder will start matching at level 1. + * $finder->depth('< 3') // the Finder will descend at most 3 levels of directories below the starting point. * * @param string|int $level The depth level expression * @@ -127,10 +127,10 @@ public function depth($level) * * The date must be something that strtotime() is able to parse: * - * $finder->date('since yesterday'); - * $finder->date('until 2 days ago'); - * $finder->date('> now - 2 hours'); - * $finder->date('>= 2005-10-15'); + * $finder->date('since yesterday'); + * $finder->date('until 2 days ago'); + * $finder->date('> now - 2 hours'); + * $finder->date('>= 2005-10-15'); * * @param string $date A date range string * @@ -152,9 +152,9 @@ public function date($date) * * You can use patterns (delimited with / sign), globs or simple strings. * - * $finder->name('*.php') - * $finder->name('/\.php$/') // same as above - * $finder->name('test.php') + * $finder->name('*.php') + * $finder->name('/\.php$/') // same as above + * $finder->name('test.php') * * @param string $pattern A pattern (a regexp, a glob, or a string) * @@ -190,8 +190,8 @@ public function notName($pattern) * * Strings or PCRE patterns can be used: * - * $finder->contains('Lorem ipsum') - * $finder->contains('/Lorem ipsum/i') + * $finder->contains('Lorem ipsum') + * $finder->contains('/Lorem ipsum/i') * * @param string $pattern A pattern (string or regexp) * @@ -211,8 +211,8 @@ public function contains($pattern) * * Strings or PCRE patterns can be used: * - * $finder->notContains('Lorem ipsum') - * $finder->notContains('/Lorem ipsum/i') + * $finder->notContains('Lorem ipsum') + * $finder->notContains('/Lorem ipsum/i') * * @param string $pattern A pattern (string or regexp) * @@ -232,8 +232,8 @@ public function notContains($pattern) * * You can use patterns (delimited with / sign) or simple strings. * - * $finder->path('some/special/dir') - * $finder->path('/some\/special\/dir/') // same as above + * $finder->path('some/special/dir') + * $finder->path('/some\/special\/dir/') // same as above * * Use only / as dirname separator. * @@ -255,8 +255,8 @@ public function path($pattern) * * You can use patterns (delimited with / sign) or simple strings. * - * $finder->notPath('some/special/dir') - * $finder->notPath('/some\/special\/dir/') // same as above + * $finder->notPath('some/special/dir') + * $finder->notPath('/some\/special\/dir/') // same as above * * Use only / as dirname separator. * @@ -276,9 +276,9 @@ public function notPath($pattern) /** * Adds tests for file sizes. * - * $finder->size('> 10K'); - * $finder->size('<= 1Ki'); - * $finder->size(4); + * $finder->size('> 10K'); + * $finder->size('<= 1Ki'); + * $finder->size(4); * * @param string|int $size A size range string or an integer * @@ -541,7 +541,7 @@ public function in($dirs) foreach ((array) $dirs as $dir) { if (is_dir($dir)) { $resolvedDirs[] = $this->normalizeDir($dir); - } elseif ($glob = glob($dir, (defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) { + } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) { $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob)); } else { throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir)); @@ -564,11 +564,11 @@ public function in($dirs) */ public function getIterator() { - if (0 === count($this->dirs) && 0 === count($this->iterators)) { + if (0 === \count($this->dirs) && 0 === \count($this->iterators)) { throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.'); } - if (1 === count($this->dirs) && 0 === count($this->iterators)) { + if (1 === \count($this->dirs) && 0 === \count($this->iterators)) { return $this->searchInDirectory($this->dirs[0]); } @@ -589,7 +589,7 @@ public function getIterator() * * The set can be another Finder, an Iterator, an IteratorAggregate, or even a plain array. * - * @param mixed $iterator + * @param iterable $iterator * * @return $this * @@ -601,7 +601,7 @@ public function append($iterator) $this->iterators[] = $iterator->getIterator(); } elseif ($iterator instanceof \Iterator) { $this->iterators[] = $iterator; - } elseif ($iterator instanceof \Traversable || is_array($iterator)) { + } elseif ($iterator instanceof \Traversable || \is_array($iterator)) { $it = new \ArrayIterator(); foreach ($iterator as $file) { $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file)); @@ -639,7 +639,7 @@ public function count() } /** - * @param $dir + * @param string $dir * * @return \Iterator */ @@ -732,12 +732,20 @@ private function searchInDirectory($dir) /** * Normalizes given directory names by removing trailing slashes. * + * Excluding: (s)ftp:// wrapper + * * @param string $dir * * @return string */ private function normalizeDir($dir) { - return rtrim($dir, '/'.\DIRECTORY_SEPARATOR); + $dir = rtrim($dir, '/'.\DIRECTORY_SEPARATOR); + + if (preg_match('#^s?ftp://#', $dir)) { + $dir .= '/'; + } + + return $dir; } } diff --git a/vendor/symfony/finder/Glob.php b/vendor/symfony/finder/Glob.php index df8b86fa5..27d9ce3d1 100644 --- a/vendor/symfony/finder/Glob.php +++ b/vendor/symfony/finder/Glob.php @@ -14,14 +14,14 @@ /** * Glob matches globbing patterns against text. * - * if match_glob("foo.*", "foo.bar") echo "matched\n"; + * if match_glob("foo.*", "foo.bar") echo "matched\n"; * - * // prints foo.bar and foo.baz - * $regex = glob_to_regex("foo.*"); - * for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t) - * { - * if (/$regex/) echo "matched: $car\n"; - * } + * // prints foo.bar and foo.baz + * $regex = glob_to_regex("foo.*"); + * for (array('foo.bar', 'foo.baz', 'foo', 'bar') as $t) + * { + * if (/$regex/) echo "matched: $car\n"; + * } * * Glob implements glob(3) style matching that can be used to match * against text, rather than fetching names from a filesystem. @@ -51,7 +51,7 @@ public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardS $escaping = false; $inCurlies = 0; $regex = ''; - $sizeGlob = strlen($glob); + $sizeGlob = \strlen($glob); for ($i = 0; $i < $sizeGlob; ++$i) { $car = $glob[$i]; if ($firstByte && $strictLeadingDot && '.' !== $car) { diff --git a/vendor/symfony/finder/Iterator/CustomFilterIterator.php b/vendor/symfony/finder/Iterator/CustomFilterIterator.php index 399b6a971..6666e07ec 100644 --- a/vendor/symfony/finder/Iterator/CustomFilterIterator.php +++ b/vendor/symfony/finder/Iterator/CustomFilterIterator.php @@ -32,7 +32,7 @@ class CustomFilterIterator extends FilterIterator public function __construct(\Iterator $iterator, array $filters) { foreach ($filters as $filter) { - if (!is_callable($filter)) { + if (!\is_callable($filter)) { throw new \InvalidArgumentException('Invalid PHP callback.'); } } @@ -51,7 +51,7 @@ public function accept() $fileinfo = $this->current(); foreach ($this->filters as $filter) { - if (false === call_user_func($filter, $fileinfo)) { + if (false === \call_user_func($filter, $fileinfo)) { return false; } } diff --git a/vendor/symfony/finder/Iterator/PathFilterIterator.php b/vendor/symfony/finder/Iterator/PathFilterIterator.php index dadfc8ed7..3fda557be 100644 --- a/vendor/symfony/finder/Iterator/PathFilterIterator.php +++ b/vendor/symfony/finder/Iterator/PathFilterIterator.php @@ -28,7 +28,7 @@ public function accept() { $filename = $this->current()->getRelativePathname(); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $filename = str_replace('\\', '/', $filename); } diff --git a/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php b/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php index c1c0e2f18..3e6ef86ad 100644 --- a/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php +++ b/vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php @@ -52,8 +52,8 @@ public function __construct($path, $flags, $ignoreUnreadableDirs = false) parent::__construct($path, $flags); $this->ignoreUnreadableDirs = $ignoreUnreadableDirs; $this->rootPath = $path; - if ('/' !== DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) { - $this->directorySeparator = DIRECTORY_SEPARATOR; + if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) { + $this->directorySeparator = \DIRECTORY_SEPARATOR; } } diff --git a/vendor/symfony/finder/Iterator/SortableIterator.php b/vendor/symfony/finder/Iterator/SortableIterator.php index c2f54b937..53f8e31c6 100644 --- a/vendor/symfony/finder/Iterator/SortableIterator.php +++ b/vendor/symfony/finder/Iterator/SortableIterator.php @@ -63,7 +63,7 @@ public function __construct(\Traversable $iterator, $sort) $this->sort = function ($a, $b) { return $a->getMTime() - $b->getMTime(); }; - } elseif (is_callable($sort)) { + } elseif (\is_callable($sort)) { $this->sort = $sort; } else { throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.'); diff --git a/vendor/symfony/finder/SplFileInfo.php b/vendor/symfony/finder/SplFileInfo.php index 19f95e26b..0f4e025b2 100644 --- a/vendor/symfony/finder/SplFileInfo.php +++ b/vendor/symfony/finder/SplFileInfo.php @@ -66,12 +66,11 @@ public function getRelativePathname() */ public function getContents() { - $level = error_reporting(0); + set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); $content = file_get_contents($this->getPathname()); - error_reporting($level); + restore_error_handler(); if (false === $content) { - $error = error_get_last(); - throw new \RuntimeException($error['message']); + throw new \RuntimeException($error); } return $content; diff --git a/vendor/symfony/finder/Tests/FinderTest.php b/vendor/symfony/finder/Tests/FinderTest.php index c7908fa86..fbdcc36e6 100644 --- a/vendor/symfony/finder/Tests/FinderTest.php +++ b/vendor/symfony/finder/Tests/FinderTest.php @@ -58,7 +58,7 @@ public function testRemoveTrailingSlash() public function testSymlinksNotResolved() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('symlinks are not supported on Windows'); } @@ -265,7 +265,7 @@ public function testFilter() public function testFollowLinks() { - if ('\\' == DIRECTORY_SEPARATOR) { + if ('\\' == \DIRECTORY_SEPARATOR) { $this->markTestSkipped('symlinks are not supported on Windows'); } @@ -280,9 +280,9 @@ public function testIn() $iterator = $finder->files()->name('*.php')->depth('< 1')->in(array(self::$tmpDir, __DIR__))->getIterator(); $expected = array( - self::$tmpDir.DIRECTORY_SEPARATOR.'test.php', - __DIR__.DIRECTORY_SEPARATOR.'FinderTest.php', - __DIR__.DIRECTORY_SEPARATOR.'GlobTest.php', + self::$tmpDir.\DIRECTORY_SEPARATOR.'test.php', + __DIR__.\DIRECTORY_SEPARATOR.'FinderTest.php', + __DIR__.\DIRECTORY_SEPARATOR.'GlobTest.php', ); $this->assertIterator($expected, $iterator); @@ -384,7 +384,7 @@ public function testRelativePathname() $paths[] = $file->getRelativePathname(); } - $ref = array('test.php', 'toto', 'test.py', 'foo', 'foo'.DIRECTORY_SEPARATOR.'bar.tmp', 'foo bar'); + $ref = array('test.php', 'toto', 'test.py', 'foo', 'foo'.\DIRECTORY_SEPARATOR.'bar.tmp', 'foo bar'); sort($paths); sort($ref); @@ -395,7 +395,7 @@ public function testRelativePathname() public function testAppendWithAFinder() { $finder = $this->buildFinder(); - $finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo'); + $finder->files()->in(self::$tmpDir.\DIRECTORY_SEPARATOR.'foo'); $finder1 = $this->buildFinder(); $finder1->directories()->in(self::$tmpDir); @@ -408,7 +408,7 @@ public function testAppendWithAFinder() public function testAppendWithAnArray() { $finder = $this->buildFinder(); - $finder->files()->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo'); + $finder->files()->in(self::$tmpDir.\DIRECTORY_SEPARATOR.'foo'); $finder->append($this->toAbsolute(array('foo', 'toto'))); @@ -423,7 +423,7 @@ public function testAppendReturnsAFinder() public function testAppendDoesNotRequireIn() { $finder = $this->buildFinder(); - $finder->in(self::$tmpDir.DIRECTORY_SEPARATOR.'foo'); + $finder->in(self::$tmpDir.\DIRECTORY_SEPARATOR.'foo'); $finder1 = Finder::create()->append($finder); @@ -444,7 +444,7 @@ public function testCountDirectories() public function testCountFiles() { - $files = Finder::create()->files()->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'); + $files = Finder::create()->files()->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'); $i = 0; foreach ($files as $file) { @@ -460,7 +460,7 @@ public function testCountFiles() public function testCountWithoutIn() { $finder = Finder::create()->files(); - count($finder); + \count($finder); } public function testHasResults() @@ -483,7 +483,7 @@ public function testNoResults() public function testContains($matchPatterns, $noMatchPatterns, $expected) { $finder = $this->buildFinder(); - $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures') + $finder->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures') ->name('*.txt')->sortByName() ->contains($matchPatterns) ->notContains($noMatchPatterns); @@ -546,15 +546,15 @@ public function testMultipleLocationsWithSubDirectories() { $locations = array( __DIR__.'/Fixtures/one', - self::$tmpDir.DIRECTORY_SEPARATOR.'toto', + self::$tmpDir.\DIRECTORY_SEPARATOR.'toto', ); $finder = $this->buildFinder(); $finder->in($locations)->depth('< 10')->name('*.neon'); $expected = array( - __DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'c.neon', - __DIR__.'/Fixtures/one'.DIRECTORY_SEPARATOR.'b'.DIRECTORY_SEPARATOR.'d.neon', + __DIR__.'/Fixtures/one'.\DIRECTORY_SEPARATOR.'b'.\DIRECTORY_SEPARATOR.'c.neon', + __DIR__.'/Fixtures/one'.\DIRECTORY_SEPARATOR.'b'.\DIRECTORY_SEPARATOR.'d.neon', ); $this->assertIterator($expected, $finder); @@ -575,10 +575,10 @@ public function testIteratorKeys() public function testRegexSpecialCharsLocationWithPathRestrictionContainingStartFlag() { $finder = $this->buildFinder(); - $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.'r+e.gex[c]a(r)s') + $finder->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.'r+e.gex[c]a(r)s') ->path('/^dir/'); - $expected = array('r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir', 'r+e.gex[c]a(r)s'.DIRECTORY_SEPARATOR.'dir'.DIRECTORY_SEPARATOR.'bar.dat'); + $expected = array('r+e.gex[c]a(r)s'.\DIRECTORY_SEPARATOR.'dir', 'r+e.gex[c]a(r)s'.\DIRECTORY_SEPARATOR.'dir'.\DIRECTORY_SEPARATOR.'bar.dat'); $this->assertIterator($this->toAbsoluteFixtures($expected), $finder); } @@ -612,7 +612,7 @@ public function getRegexNameTestData() public function testPath($matchPatterns, $noMatchPatterns, array $expected) { $finder = $this->buildFinder(); - $finder->in(__DIR__.DIRECTORY_SEPARATOR.'Fixtures') + $finder->in(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures') ->path($matchPatterns) ->notPath($noMatchPatterns); @@ -624,41 +624,41 @@ public function getTestPathData() return array( array('', '', array()), array('/^A\/B\/C/', '/C$/', - array('A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat'), + array('A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat'), ), array('/^A\/B/', 'foobar', array( - 'A'.DIRECTORY_SEPARATOR.'B', - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat', - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', + 'A'.\DIRECTORY_SEPARATOR.'B', + 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C', + 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat', + 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat', ), ), array('A/B/C', 'foobar', array( - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', - 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', - 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy', + 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C', + 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat', + 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C', + 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat.copy', ), ), array('A/B', 'foobar', array( //dirs - 'A'.DIRECTORY_SEPARATOR.'B', - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', - 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B', - 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C', + 'A'.\DIRECTORY_SEPARATOR.'B', + 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C', + 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B', + 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C', //files - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat', - 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', - 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat.copy', - 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat.copy', + 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat', + 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat', + 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat.copy', + 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat.copy', ), ), array('/^with space\//', 'foobar', array( - 'with space'.DIRECTORY_SEPARATOR.'foo.txt', + 'with space'.\DIRECTORY_SEPARATOR.'foo.txt', ), ), ); @@ -666,7 +666,7 @@ public function getTestPathData() public function testAccessDeniedException() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('chmod is not supported on Windows'); } @@ -674,7 +674,7 @@ public function testAccessDeniedException() $finder->files()->in(self::$tmpDir); // make 'foo' directory non-readable - $testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo'; + $testDir = self::$tmpDir.\DIRECTORY_SEPARATOR.'foo'; chmod($testDir, 0333); if (false === $couldRead = is_readable($testDir)) { @@ -706,7 +706,7 @@ public function testAccessDeniedException() public function testIgnoredAccessDeniedException() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('chmod is not supported on Windows'); } @@ -714,7 +714,7 @@ public function testIgnoredAccessDeniedException() $finder->files()->ignoreUnreadableDirs()->in(self::$tmpDir); // make 'foo' directory non-readable - $testDir = self::$tmpDir.DIRECTORY_SEPARATOR.'foo'; + $testDir = self::$tmpDir.\DIRECTORY_SEPARATOR.'foo'; chmod($testDir, 0333); if (false === ($couldRead = is_readable($testDir))) { diff --git a/vendor/symfony/finder/Tests/GlobTest.php b/vendor/symfony/finder/Tests/GlobTest.php index d48ac1fc5..3a5aab312 100644 --- a/vendor/symfony/finder/Tests/GlobTest.php +++ b/vendor/symfony/finder/Tests/GlobTest.php @@ -32,9 +32,9 @@ public function testGlobToRegexDoubleStarStrictDots() $regex = Glob::toRegex('/**/*.neon'); foreach ($finder->in(__DIR__) as $k => $v) { - $k = str_replace(DIRECTORY_SEPARATOR, '/', $k); - if (preg_match($regex, substr($k, strlen(__DIR__)))) { - $match[] = substr($k, 10 + strlen(__DIR__)); + $k = str_replace(\DIRECTORY_SEPARATOR, '/', $k); + if (preg_match($regex, substr($k, \strlen(__DIR__)))) { + $match[] = substr($k, 10 + \strlen(__DIR__)); } } sort($match); @@ -49,9 +49,9 @@ public function testGlobToRegexDoubleStarNonStrictDots() $regex = Glob::toRegex('/**/*.neon', false); foreach ($finder->in(__DIR__) as $k => $v) { - $k = str_replace(DIRECTORY_SEPARATOR, '/', $k); - if (preg_match($regex, substr($k, strlen(__DIR__)))) { - $match[] = substr($k, 10 + strlen(__DIR__)); + $k = str_replace(\DIRECTORY_SEPARATOR, '/', $k); + if (preg_match($regex, substr($k, \strlen(__DIR__)))) { + $match[] = substr($k, 10 + \strlen(__DIR__)); } } sort($match); @@ -66,9 +66,9 @@ public function testGlobToRegexDoubleStarWithoutLeadingSlash() $regex = Glob::toRegex('/Fixtures/one/**'); foreach ($finder->in(__DIR__) as $k => $v) { - $k = str_replace(DIRECTORY_SEPARATOR, '/', $k); - if (preg_match($regex, substr($k, strlen(__DIR__)))) { - $match[] = substr($k, 10 + strlen(__DIR__)); + $k = str_replace(\DIRECTORY_SEPARATOR, '/', $k); + if (preg_match($regex, substr($k, \strlen(__DIR__)))) { + $match[] = substr($k, 10 + \strlen(__DIR__)); } } sort($match); @@ -83,9 +83,9 @@ public function testGlobToRegexDoubleStarWithoutLeadingSlashNotStrictLeadingDot( $regex = Glob::toRegex('/Fixtures/one/**', false); foreach ($finder->in(__DIR__) as $k => $v) { - $k = str_replace(DIRECTORY_SEPARATOR, '/', $k); - if (preg_match($regex, substr($k, strlen(__DIR__)))) { - $match[] = substr($k, 10 + strlen(__DIR__)); + $k = str_replace(\DIRECTORY_SEPARATOR, '/', $k); + if (preg_match($regex, substr($k, \strlen(__DIR__)))) { + $match[] = substr($k, 10 + \strlen(__DIR__)); } } sort($match); diff --git a/vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php index 1ec705182..3226f706c 100644 --- a/vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php +++ b/vendor/symfony/finder/Tests/Iterator/DateRangeFilterIteratorTest.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Finder\Tests\Iterator; -use Symfony\Component\Finder\Iterator\DateRangeFilterIterator; use Symfony\Component\Finder\Comparator\DateComparator; +use Symfony\Component\Finder\Iterator\DateRangeFilterIterator; class DateRangeFilterIteratorTest extends RealIteratorTestCase { diff --git a/vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php b/vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php index c724a75c6..89f042aef 100644 --- a/vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php +++ b/vendor/symfony/finder/Tests/Iterator/IteratorTestCase.php @@ -19,9 +19,9 @@ protected function assertIterator($expected, \Traversable $iterator) { // set iterator_to_array $use_key to false to avoid values merge // this made FinderTest::testAppendWithAnArray() fail with GnuFinderAdapter - $values = array_map(function (\SplFileInfo $fileinfo) { return str_replace('/', DIRECTORY_SEPARATOR, $fileinfo->getPathname()); }, iterator_to_array($iterator, false)); + $values = array_map(function (\SplFileInfo $fileinfo) { return str_replace('/', \DIRECTORY_SEPARATOR, $fileinfo->getPathname()); }, iterator_to_array($iterator, false)); - $expected = array_map(function ($path) { return str_replace('/', DIRECTORY_SEPARATOR, $path); }, $expected); + $expected = array_map(function ($path) { return str_replace('/', \DIRECTORY_SEPARATOR, $path); }, $expected); sort($values); sort($expected); @@ -52,7 +52,7 @@ protected function assertOrderedIteratorForGroups($expected, \Traversable $itera foreach ($expected as $subarray) { $temp = array(); - while (count($values) && count($temp) < count($subarray)) { + while (\count($values) && \count($temp) < \count($subarray)) { $temp[] = array_shift($values); } sort($temp); diff --git a/vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php b/vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php index cfe31c90f..a5ac93a46 100644 --- a/vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php +++ b/vendor/symfony/finder/Tests/Iterator/MockSplFileInfo.php @@ -25,16 +25,16 @@ class MockSplFileInfo extends \SplFileInfo public function __construct($param) { - if (is_string($param)) { + if (\is_string($param)) { parent::__construct($param); - } elseif (is_array($param)) { + } elseif (\is_array($param)) { $defaults = array( - 'name' => 'file.txt', - 'contents' => null, - 'mode' => null, - 'type' => null, - 'relativePath' => null, - 'relativePathname' => null, + 'name' => 'file.txt', + 'contents' => null, + 'mode' => null, + 'type' => null, + 'relativePath' => null, + 'relativePathname' => null, ); $defaults = array_merge($defaults, $param); parent::__construct($defaults['name']); @@ -92,7 +92,7 @@ public function setMode($mode) public function setType($type) { - if (is_string($type)) { + if (\is_string($type)) { switch ($type) { case 'directory': case 'd': diff --git a/vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php index 6e10550c0..38ed966a6 100644 --- a/vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php +++ b/vendor/symfony/finder/Tests/Iterator/PathFilterIteratorTest.php @@ -31,37 +31,37 @@ public function getTestFilterData() //PATH: A/B/C/abc.dat $inner[] = new MockSplFileInfo(array( 'name' => 'abc.dat', - 'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', + 'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat', )); //PATH: A/B/ab.dat $inner[] = new MockSplFileInfo(array( 'name' => 'ab.dat', - 'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat', + 'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat', )); //PATH: A/a.dat $inner[] = new MockSplFileInfo(array( 'name' => 'a.dat', - 'relativePathname' => 'A'.DIRECTORY_SEPARATOR.'a.dat', + 'relativePathname' => 'A'.\DIRECTORY_SEPARATOR.'a.dat', )); //PATH: copy/A/B/C/abc.dat.copy $inner[] = new MockSplFileInfo(array( 'name' => 'abc.dat.copy', - 'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'C'.DIRECTORY_SEPARATOR.'abc.dat', + 'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'C'.\DIRECTORY_SEPARATOR.'abc.dat', )); //PATH: copy/A/B/ab.dat.copy $inner[] = new MockSplFileInfo(array( 'name' => 'ab.dat.copy', - 'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'B'.DIRECTORY_SEPARATOR.'ab.dat', + 'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'B'.\DIRECTORY_SEPARATOR.'ab.dat', )); //PATH: copy/A/a.dat.copy $inner[] = new MockSplFileInfo(array( 'name' => 'a.dat.copy', - 'relativePathname' => 'copy'.DIRECTORY_SEPARATOR.'A'.DIRECTORY_SEPARATOR.'a.dat', + 'relativePathname' => 'copy'.\DIRECTORY_SEPARATOR.'A'.\DIRECTORY_SEPARATOR.'a.dat', )); return array( diff --git a/vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php b/vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php index 94253c7ee..b0223b782 100644 --- a/vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php +++ b/vendor/symfony/finder/Tests/Iterator/RealIteratorTestCase.php @@ -18,7 +18,7 @@ abstract class RealIteratorTestCase extends IteratorTestCase public static function setUpBeforeClass() { - self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder'; + self::$tmpDir = realpath(sys_get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder'; self::$files = array( '.git/', @@ -44,7 +44,7 @@ public static function setUpBeforeClass() } foreach (self::$files as $file) { - if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) { + if (\DIRECTORY_SEPARATOR === $file[\strlen($file) - 1]) { mkdir($file); } else { touch($file); @@ -60,11 +60,20 @@ public static function setUpBeforeClass() public static function tearDownAfterClass() { - foreach (array_reverse(self::$files) as $file) { - if (DIRECTORY_SEPARATOR === $file[strlen($file) - 1]) { - @rmdir($file); + $paths = new \RecursiveIteratorIterator( + new \RecursiveDirectoryIterator(self::$tmpDir, \RecursiveDirectoryIterator::SKIP_DOTS), + \RecursiveIteratorIterator::CHILD_FIRST + ); + + foreach ($paths as $path) { + if ($path->isDir()) { + if ($path->isLink()) { + @unlink($path); + } else { + @rmdir($path); + } } else { - @unlink($file); + @unlink($path); } } } @@ -75,24 +84,24 @@ protected static function toAbsolute($files = null) * Without the call to setUpBeforeClass() property can be null. */ if (!self::$tmpDir) { - self::$tmpDir = realpath(sys_get_temp_dir()).DIRECTORY_SEPARATOR.'symfony_finder'; + self::$tmpDir = realpath(sys_get_temp_dir()).\DIRECTORY_SEPARATOR.'symfony_finder'; } - if (is_array($files)) { + if (\is_array($files)) { $f = array(); foreach ($files as $file) { - if (is_array($file)) { + if (\is_array($file)) { $f[] = self::toAbsolute($file); } else { - $f[] = self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $file); + $f[] = self::$tmpDir.\DIRECTORY_SEPARATOR.str_replace('/', \DIRECTORY_SEPARATOR, $file); } } return $f; } - if (is_string($files)) { - return self::$tmpDir.DIRECTORY_SEPARATOR.str_replace('/', DIRECTORY_SEPARATOR, $files); + if (\is_string($files)) { + return self::$tmpDir.\DIRECTORY_SEPARATOR.str_replace('/', \DIRECTORY_SEPARATOR, $files); } return self::$tmpDir; @@ -102,7 +111,7 @@ protected static function toAbsoluteFixtures($files) { $f = array(); foreach ($files as $file) { - $f[] = realpath(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'Fixtures'.DIRECTORY_SEPARATOR.$file); + $f[] = realpath(__DIR__.\DIRECTORY_SEPARATOR.'..'.\DIRECTORY_SEPARATOR.'Fixtures'.\DIRECTORY_SEPARATOR.$file); } return $f; diff --git a/vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php index 3a3ddc4dd..0c9aca24b 100644 --- a/vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php +++ b/vendor/symfony/finder/Tests/Iterator/RecursiveDirectoryIteratorTest.php @@ -43,8 +43,8 @@ public function testSeekOnFtp() } $contains = array( - 'ftp://speedtest.tele2.net'.DIRECTORY_SEPARATOR.'1000GB.zip', - 'ftp://speedtest.tele2.net'.DIRECTORY_SEPARATOR.'100GB.zip', + 'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'1000GB.zip', + 'ftp://speedtest.tele2.net'.\DIRECTORY_SEPARATOR.'100GB.zip', ); $actual = array(); diff --git a/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php index 6d75b0f2f..068fc7b0b 100644 --- a/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php +++ b/vendor/symfony/finder/Tests/Iterator/SizeRangeFilterIteratorTest.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Finder\Tests\Iterator; -use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator; use Symfony\Component\Finder\Comparator\NumberComparator; +use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator; class SizeRangeFilterIteratorTest extends RealIteratorTestCase { diff --git a/vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php b/vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php index 444654a28..a35a12b5b 100644 --- a/vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php +++ b/vendor/symfony/finder/Tests/Iterator/SortableIteratorTest.php @@ -30,10 +30,10 @@ public function testConstructor() */ public function testAccept($mode, $expected) { - if (!is_callable($mode)) { + if (!\is_callable($mode)) { switch ($mode) { case SortableIterator::SORT_BY_ACCESSED_TIME: - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { touch(self::toAbsolute('.git')); } else { file_get_contents(self::toAbsolute('.git')); @@ -62,7 +62,7 @@ public function testAccept($mode, $expected) || SortableIterator::SORT_BY_CHANGED_TIME === $mode || SortableIterator::SORT_BY_MODIFIED_TIME === $mode ) { - if ('\\' === DIRECTORY_SEPARATOR && SortableIterator::SORT_BY_MODIFIED_TIME !== $mode) { + if ('\\' === \DIRECTORY_SEPARATOR && SortableIterator::SORT_BY_MODIFIED_TIME !== $mode) { $this->markTestSkipped('Sorting by atime or ctime is not supported on Windows'); } $this->assertOrderedIteratorForGroups($expected, $iterator); diff --git a/vendor/symfony/finder/phpunit.xml.dist b/vendor/symfony/finder/phpunit.xml.dist index 0e1a8669b..078847af9 100644 --- a/vendor/symfony/finder/phpunit.xml.dist +++ b/vendor/symfony/finder/phpunit.xml.dist @@ -1,7 +1,7 @@ 0 ? $parts[1] : ''; + $attributes[$parts[0]] = isset($parts[1]) && \strlen($parts[1]) > 0 ? $parts[1] : ''; } } @@ -65,14 +65,14 @@ public static function fromString($itemValue) } /** - * Returns header value's string representation. + * Returns header value's string representation. * * @return string */ public function __toString() { $string = $this->value.($this->quality < 1 ? ';q='.$this->quality : ''); - if (count($this->attributes) > 0) { + if (\count($this->attributes) > 0) { $string .= ';'.implode(';', array_map(function ($name, $value) { return sprintf(preg_match('/[,;=]/', $value) ? '%s="%s"' : '%s=%s', $name, $value); }, array_keys($this->attributes), $this->attributes)); diff --git a/vendor/symfony/http-foundation/ApacheRequest.php b/vendor/symfony/http-foundation/ApacheRequest.php index 84803ebae..4e99186dc 100644 --- a/vendor/symfony/http-foundation/ApacheRequest.php +++ b/vendor/symfony/http-foundation/ApacheRequest.php @@ -35,7 +35,7 @@ protected function prepareBaseUrl() if (false === strpos($this->server->get('REQUEST_URI'), $baseUrl)) { // assume mod_rewrite - return rtrim(dirname($baseUrl), '/\\'); + return rtrim(\dirname($baseUrl), '/\\'); } return $baseUrl; diff --git a/vendor/symfony/http-foundation/BinaryFileResponse.php b/vendor/symfony/http-foundation/BinaryFileResponse.php index 101022304..97023278e 100644 --- a/vendor/symfony/http-foundation/BinaryFileResponse.php +++ b/vendor/symfony/http-foundation/BinaryFileResponse.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpFoundation; -use Symfony\Component\HttpFoundation\File\File; use Symfony\Component\HttpFoundation\File\Exception\FileException; +use Symfony\Component\HttpFoundation\File\File; /** * BinaryFileResponse represents an HTTP response delivering a file. @@ -31,8 +31,8 @@ class BinaryFileResponse extends Response * @var File */ protected $file; - protected $offset; - protected $maxlen; + protected $offset = 0; + protected $maxlen = -1; protected $deleteFileAfterSend = false; /** @@ -40,7 +40,7 @@ class BinaryFileResponse extends Response * @param int $status The response status code * @param array $headers An array of response headers * @param bool $public Files are public by default - * @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename + * @param string|null $contentDisposition The type of Content-Disposition to set automatically with the filename * @param bool $autoEtag Whether the ETag header should be automatically set * @param bool $autoLastModified Whether the Last-Modified header should be automatically set */ @@ -60,7 +60,7 @@ public function __construct($file, $status = 200, $headers = array(), $public = * @param int $status The response status code * @param array $headers An array of response headers * @param bool $public Files are public by default - * @param null|string $contentDisposition The type of Content-Disposition to set automatically with the filename + * @param string|null $contentDisposition The type of Content-Disposition to set automatically with the filename * @param bool $autoEtag Whether the ETag header should be automatically set * @param bool $autoLastModified Whether the Last-Modified header should be automatically set * @@ -165,7 +165,7 @@ public function setContentDisposition($disposition, $filename = '', $filenameFal for ($i = 0, $filenameLength = mb_strlen($filename, $encoding); $i < $filenameLength; ++$i) { $char = mb_substr($filename, $i, 1, $encoding); - if ('%' === $char || ord($char) < 32 || ord($char) > 126) { + if ('%' === $char || \ord($char) < 32 || \ord($char) > 126) { $filenameFallback .= '_'; } else { $filenameFallback .= $char; @@ -221,12 +221,12 @@ public function prepare(Request $request) foreach (explode(',', $request->headers->get('X-Accel-Mapping', '')) as $mapping) { $mapping = explode('=', $mapping, 2); - if (2 === count($mapping)) { + if (2 === \count($mapping)) { $pathPrefix = trim($mapping[0]); $location = trim($mapping[1]); - if (substr($path, 0, strlen($pathPrefix)) === $pathPrefix) { - $path = $location.substr($path, strlen($pathPrefix)); + if (substr($path, 0, \strlen($pathPrefix)) === $pathPrefix) { + $path = $location.substr($path, \strlen($pathPrefix)); break; } } diff --git a/vendor/symfony/http-foundation/CHANGELOG.md b/vendor/symfony/http-foundation/CHANGELOG.md index ee5b6cecf..97b279df1 100644 --- a/vendor/symfony/http-foundation/CHANGELOG.md +++ b/vendor/symfony/http-foundation/CHANGELOG.md @@ -1,6 +1,12 @@ CHANGELOG ========= +3.4.14 +------ + + * [BC BREAK] Support for the IIS-only `X_ORIGINAL_URL` and `X_REWRITE_URL` + HTTP headers has been dropped for security reasons. + 3.4.0 ----- diff --git a/vendor/symfony/http-foundation/Cookie.php b/vendor/symfony/http-foundation/Cookie.php index d202dc6c1..c38aa409d 100644 --- a/vendor/symfony/http-foundation/Cookie.php +++ b/vendor/symfony/http-foundation/Cookie.php @@ -128,7 +128,7 @@ public function __construct($name, $value = null, $expire = 0, $path = '/', $dom $sameSite = strtolower($sameSite); } - if (!in_array($sameSite, array(self::SAMESITE_LAX, self::SAMESITE_STRICT, null), true)) { + if (!\in_array($sameSite, array(self::SAMESITE_LAX, self::SAMESITE_STRICT, null), true)) { throw new \InvalidArgumentException('The "sameSite" parameter value is not valid.'); } @@ -266,7 +266,7 @@ public function isHttpOnly() */ public function isCleared() { - return $this->expire < time(); + return 0 !== $this->expire && $this->expire < time(); } /** diff --git a/vendor/symfony/http-foundation/File/Exception/UnexpectedTypeException.php b/vendor/symfony/http-foundation/File/Exception/UnexpectedTypeException.php index 0444b8778..62005d3b6 100644 --- a/vendor/symfony/http-foundation/File/Exception/UnexpectedTypeException.php +++ b/vendor/symfony/http-foundation/File/Exception/UnexpectedTypeException.php @@ -15,6 +15,6 @@ class UnexpectedTypeException extends FileException { public function __construct($value, $expectedType) { - parent::__construct(sprintf('Expected argument of type %s, %s given', $expectedType, is_object($value) ? get_class($value) : gettype($value))); + parent::__construct(sprintf('Expected argument of type %s, %s given', $expectedType, \is_object($value) ? \get_class($value) : \gettype($value))); } } diff --git a/vendor/symfony/http-foundation/File/File.php b/vendor/symfony/http-foundation/File/File.php index e2a67684f..34220588a 100644 --- a/vendor/symfony/http-foundation/File/File.php +++ b/vendor/symfony/http-foundation/File/File.php @@ -13,8 +13,8 @@ use Symfony\Component\HttpFoundation\File\Exception\FileException; use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; -use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser; use Symfony\Component\HttpFoundation\File\MimeType\ExtensionGuesser; +use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser; /** * A file in the file system. @@ -93,9 +93,11 @@ public function move($directory, $name = null) { $target = $this->getTargetFile($directory, $name); - if (!@rename($this->getPathname(), $target)) { - $error = error_get_last(); - throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message']))); + set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); + $renamed = rename($this->getPathname(), $target); + restore_error_handler(); + if (!$renamed) { + throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error))); } @chmod($target, 0666 & ~umask()); @@ -113,7 +115,7 @@ protected function getTargetFile($directory, $name = null) throw new FileException(sprintf('Unable to write in the "%s" directory', $directory)); } - $target = rtrim($directory, '/\\').DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name)); + $target = rtrim($directory, '/\\').\DIRECTORY_SEPARATOR.(null === $name ? $this->getBasename() : $this->getName($name)); return new self($target, false); } diff --git a/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php index 3c3581046..34e015ee5 100644 --- a/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/FileBinaryMimeTypeGuesser.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; +use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; /** * Guesses the mime type with the binary "file" (only available on *nix). @@ -49,7 +49,7 @@ public static function isSupported() return $supported; } - if ('\\' === DIRECTORY_SEPARATOR || !function_exists('passthru') || !function_exists('escapeshellarg')) { + if ('\\' === \DIRECTORY_SEPARATOR || !\function_exists('passthru') || !\function_exists('escapeshellarg')) { return $supported = false; } diff --git a/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php index 9b42835e4..bf1ee9f5d 100644 --- a/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/FileinfoMimeTypeGuesser.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; +use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; /** * Guesses the mime type using the PECL extension FileInfo. @@ -40,7 +40,7 @@ public function __construct($magicFile = null) */ public static function isSupported() { - return function_exists('finfo_open'); + return \function_exists('finfo_open'); } /** diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php index e3ef45ef6..dae47a7c0 100644 --- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php +++ b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesser.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; +use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; /** * A singleton mime type guesser. @@ -80,13 +80,8 @@ public static function reset() */ private function __construct() { - if (FileBinaryMimeTypeGuesser::isSupported()) { - $this->register(new FileBinaryMimeTypeGuesser()); - } - - if (FileinfoMimeTypeGuesser::isSupported()) { - $this->register(new FileinfoMimeTypeGuesser()); - } + $this->register(new FileBinaryMimeTypeGuesser()); + $this->register(new FileinfoMimeTypeGuesser()); } /** @@ -125,18 +120,14 @@ public function guess($path) throw new AccessDeniedException($path); } - if (!$this->guessers) { - $msg = 'Unable to guess the mime type as no guessers are available'; - if (!FileinfoMimeTypeGuesser::isSupported()) { - $msg .= ' (Did you enable the php_fileinfo extension?)'; - } - throw new \LogicException($msg); - } - foreach ($this->guessers as $guesser) { if (null !== $mimeType = $guesser->guess($path)) { return $mimeType; } } + + if (2 === \count($this->guessers) && !FileBinaryMimeTypeGuesser::isSupported() && !FileinfoMimeTypeGuesser::isSupported()) { + throw new \LogicException('Unable to guess the mime type as no guessers are available (Did you enable the php_fileinfo extension?)'); + } } } diff --git a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php index f8c3ad228..5ac1acb82 100644 --- a/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php +++ b/vendor/symfony/http-foundation/File/MimeType/MimeTypeGuesserInterface.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpFoundation\File\MimeType; -use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; use Symfony\Component\HttpFoundation\File\Exception\AccessDeniedException; +use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException; /** * Guesses the mime type of a file. diff --git a/vendor/symfony/http-foundation/File/UploadedFile.php b/vendor/symfony/http-foundation/File/UploadedFile.php index 082d8d534..de6ce75cc 100644 --- a/vendor/symfony/http-foundation/File/UploadedFile.php +++ b/vendor/symfony/http-foundation/File/UploadedFile.php @@ -192,9 +192,11 @@ public function move($directory, $name = null) $target = $this->getTargetFile($directory, $name); - if (!@move_uploaded_file($this->getPathname(), $target)) { - $error = error_get_last(); - throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error['message']))); + set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; }); + $moved = move_uploaded_file($this->getPathname(), $target); + restore_error_handler(); + if (!$moved) { + throw new FileException(sprintf('Could not move the file "%s" to "%s" (%s)', $this->getPathname(), $target, strip_tags($error))); } @chmod($target, 0666 & ~umask()); @@ -220,9 +222,9 @@ public static function getMaxFilesize() $max = ltrim($iniMax, '+'); if (0 === strpos($max, '0x')) { - $max = intval($max, 16); + $max = \intval($max, 16); } elseif (0 === strpos($max, '0')) { - $max = intval($max, 8); + $max = \intval($max, 8); } else { $max = (int) $max; } diff --git a/vendor/symfony/http-foundation/FileBag.php b/vendor/symfony/http-foundation/FileBag.php index 5edd0e621..c135ad641 100644 --- a/vendor/symfony/http-foundation/FileBag.php +++ b/vendor/symfony/http-foundation/FileBag.php @@ -45,7 +45,7 @@ public function replace(array $files = array()) */ public function set($key, $value) { - if (!is_array($value) && !$value instanceof UploadedFile) { + if (!\is_array($value) && !$value instanceof UploadedFile) { throw new \InvalidArgumentException('An uploaded file must be an array or an instance of UploadedFile.'); } @@ -76,7 +76,7 @@ protected function convertFileInformation($file) } $file = $this->fixPhpFilesArray($file); - if (is_array($file)) { + if (\is_array($file)) { $keys = array_keys($file); sort($keys); @@ -113,14 +113,14 @@ protected function convertFileInformation($file) */ protected function fixPhpFilesArray($data) { - if (!is_array($data)) { + if (!\is_array($data)) { return $data; } $keys = array_keys($data); sort($keys); - if (self::$fileKeys != $keys || !isset($data['name']) || !is_array($data['name'])) { + if (self::$fileKeys != $keys || !isset($data['name']) || !\is_array($data['name'])) { return $data; } diff --git a/vendor/symfony/http-foundation/HeaderBag.php b/vendor/symfony/http-foundation/HeaderBag.php index 7aaa52ae5..5445e80c8 100644 --- a/vendor/symfony/http-foundation/HeaderBag.php +++ b/vendor/symfony/http-foundation/HeaderBag.php @@ -101,11 +101,11 @@ public function add(array $headers) /** * Returns a header value by name. * - * @param string $key The header name - * @param string|string[] $default The default value - * @param bool $first Whether to return the first value or all header values + * @param string $key The header name + * @param string|string[]|null $default The default value + * @param bool $first Whether to return the first value or all header values * - * @return string|string[] The first header value or default value if $first is true, an array of values otherwise + * @return string|string[]|null The first header value or default value if $first is true, an array of values otherwise */ public function get($key, $default = null, $first = true) { @@ -181,7 +181,7 @@ public function has($key) */ public function contains($key, $value) { - return in_array($value, $this->get($key, null, false)); + return \in_array($value, $this->get($key, null, false)); } /** @@ -206,7 +206,7 @@ public function remove($key) * @param string $key The parameter key * @param \DateTime $default The default value * - * @return null|\DateTime The parsed DateTime or the default value if the header does not exist + * @return \DateTime|null The parsed DateTime or the default value if the header does not exist * * @throws \RuntimeException When the HTTP header is not parseable */ @@ -289,7 +289,7 @@ public function getIterator() */ public function count() { - return count($this->headers); + return \count($this->headers); } protected function getCacheControlHeader() diff --git a/vendor/symfony/http-foundation/IpUtils.php b/vendor/symfony/http-foundation/IpUtils.php index 86d135b2d..a1bfa9088 100644 --- a/vendor/symfony/http-foundation/IpUtils.php +++ b/vendor/symfony/http-foundation/IpUtils.php @@ -37,7 +37,7 @@ private function __construct() */ public static function checkIp($requestIp, $ips) { - if (!is_array($ips)) { + if (!\is_array($ips)) { $ips = array($ips); } @@ -116,7 +116,7 @@ public static function checkIp6($requestIp, $ip) return self::$checkedIps[$cacheKey]; } - if (!((extension_loaded('sockets') && defined('AF_INET6')) || @inet_pton('::1'))) { + if (!((\extension_loaded('sockets') && \defined('AF_INET6')) || @inet_pton('::1'))) { throw new \RuntimeException('Unable to check Ipv6. Check that PHP was not compiled with option "disable-ipv6".'); } diff --git a/vendor/symfony/http-foundation/JsonResponse.php b/vendor/symfony/http-foundation/JsonResponse.php index 137ac33c4..d741ce099 100644 --- a/vendor/symfony/http-foundation/JsonResponse.php +++ b/vendor/symfony/http-foundation/JsonResponse.php @@ -101,7 +101,7 @@ public function setCallback($callback = null) ); $parts = explode('.', $callback); foreach ($parts as $part) { - if (!preg_match($pattern, $part) || in_array($part, $reserved, true)) { + if (!preg_match($pattern, $part) || \in_array($part, $reserved, true)) { throw new \InvalidArgumentException('The callback name is not valid.'); } } @@ -139,7 +139,7 @@ public function setJson($json) */ public function setData($data = array()) { - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { // HHVM does not trigger any warnings and let exceptions // thrown from a JsonSerializable object pass through. // If only PHP did the same... @@ -156,7 +156,7 @@ public function setData($data = array()) try { $data = json_encode($data, $this->encodingOptions); } catch (\Exception $e) { - if ('Exception' === get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) { + if ('Exception' === \get_class($e) && 0 === strpos($e->getMessage(), 'Failed calling ')) { throw $e->getPrevious() ?: $e; } throw $e; diff --git a/vendor/symfony/http-foundation/ParameterBag.php b/vendor/symfony/http-foundation/ParameterBag.php index 257ef8bce..19d7ee913 100644 --- a/vendor/symfony/http-foundation/ParameterBag.php +++ b/vendor/symfony/http-foundation/ParameterBag.php @@ -174,7 +174,7 @@ public function getInt($key, $default = 0) * Returns the parameter value converted to boolean. * * @param string $key The parameter key - * @param mixed $default The default value if the parameter key does not exist + * @param bool $default The default value if the parameter key does not exist * * @return bool The filtered value */ @@ -200,12 +200,12 @@ public function filter($key, $default = null, $filter = FILTER_DEFAULT, $options $value = $this->get($key, $default); // Always turn $options into an array - this allows filter_var option shortcuts. - if (!is_array($options) && $options) { + if (!\is_array($options) && $options) { $options = array('flags' => $options); } // Add a convenience check for arrays. - if (is_array($value) && !isset($options['flags'])) { + if (\is_array($value) && !isset($options['flags'])) { $options['flags'] = FILTER_REQUIRE_ARRAY; } @@ -229,6 +229,6 @@ public function getIterator() */ public function count() { - return count($this->parameters); + return \count($this->parameters); } } diff --git a/vendor/symfony/http-foundation/Request.php b/vendor/symfony/http-foundation/Request.php index 164fb4e0e..89611660a 100644 --- a/vendor/symfony/http-foundation/Request.php +++ b/vendor/symfony/http-foundation/Request.php @@ -302,7 +302,7 @@ public static function createFromGlobals() // stores the Content-Type and Content-Length header values in // HTTP_CONTENT_TYPE and HTTP_CONTENT_LENGTH fields. $server = $_SERVER; - if ('cli-server' === PHP_SAPI) { + if ('cli-server' === \PHP_SAPI) { if (array_key_exists('HTTP_CONTENT_LENGTH', $_SERVER)) { $server['CONTENT_LENGTH'] = $_SERVER['HTTP_CONTENT_LENGTH']; } @@ -314,7 +314,7 @@ public static function createFromGlobals() $request = self::createRequestFromFactory($_GET, $_POST, array(), $_COOKIE, $_FILES, $server); if (0 === strpos($request->headers->get('CONTENT_TYPE'), 'application/x-www-form-urlencoded') - && in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH')) + && \in_array(strtoupper($request->server->get('REQUEST_METHOD', 'GET')), array('PUT', 'DELETE', 'PATCH')) ) { parse_str($request->getContent(), $data); $request->request = new ParameterBag($data); @@ -377,7 +377,7 @@ public static function create($uri, $method = 'GET', $parameters = array(), $coo if (isset($components['port'])) { $server['SERVER_PORT'] = $components['port']; - $server['HTTP_HOST'] = $server['HTTP_HOST'].':'.$components['port']; + $server['HTTP_HOST'] .= ':'.$components['port']; } if (isset($components['user'])) { @@ -566,7 +566,7 @@ public function overrideGlobals() foreach ($this->headers->all() as $key => $value) { $key = strtoupper(str_replace('-', '_', $key)); - if (in_array($key, array('CONTENT_TYPE', 'CONTENT_LENGTH'))) { + if (\in_array($key, array('CONTENT_TYPE', 'CONTENT_LENGTH'))) { $_SERVER[$key] = implode(', ', $value); } else { $_SERVER['HTTP_'.$key] = implode(', ', $value); @@ -598,7 +598,7 @@ public static function setTrustedProxies(array $proxies/*, int $trustedHeaderSet { self::$trustedProxies = $proxies; - if (2 > func_num_args()) { + if (2 > \func_num_args()) { @trigger_error(sprintf('The %s() method expects a bit field of Request::HEADER_* as second argument since Symfony 3.3. Defining it will be required in 4.0. ', __METHOD__), E_USER_DEPRECATED); return; @@ -641,7 +641,7 @@ public static function getTrustedHeaderSet() public static function setTrustedHosts(array $hostPatterns) { self::$trustedHostPatterns = array_map(function ($hostPattern) { - return sprintf('#%s#i', $hostPattern); + return sprintf('{%s}i', $hostPattern); }, $hostPatterns); // we need to reset trusted hosts on trusted host patterns change self::$trustedHosts = array(); @@ -718,7 +718,7 @@ public static function setTrustedHeaderName($key, $value) */ public static function getTrustedHeaderName($key) { - if (2 > func_num_args() || func_get_arg(1)) { + if (2 > \func_num_args() || func_get_arg(1)) { @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the Request::getTrustedHeaderSet() method instead.', __METHOD__), E_USER_DEPRECATED); } @@ -1186,7 +1186,7 @@ public function getRelativeUriForPath($path) } $sourceDirs = explode('/', isset($basePath[0]) && '/' === $basePath[0] ? substr($basePath, 1) : $basePath); - $targetDirs = explode('/', isset($path[0]) && '/' === $path[0] ? substr($path, 1) : $path); + $targetDirs = explode('/', substr($path, 1)); array_pop($sourceDirs); $targetFile = array_pop($targetDirs); @@ -1199,7 +1199,7 @@ public function getRelativeUriForPath($path) } $targetDirs[] = $targetFile; - $path = str_repeat('../', count($sourceDirs)).implode('/', $targetDirs); + $path = str_repeat('../', \count($sourceDirs)).implode('/', $targetDirs); // A reference to the same base directory or an empty subdirectory must be prefixed with "./". // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used @@ -1242,7 +1242,7 @@ public function getQueryString() public function isSecure() { if ($this->isFromTrustedProxy() && $proto = $this->getTrustedValues(self::HEADER_CLIENT_PROTO)) { - return in_array(strtolower($proto[0]), array('https', 'on', 'ssl', '1'), true); + return \in_array(strtolower($proto[0]), array('https', 'on', 'ssl', '1'), true); } $https = $this->server->get('HTTPS'); @@ -1292,10 +1292,10 @@ public function getHost() throw new SuspiciousOperationException(sprintf('Invalid Host "%s".', $host)); } - if (count(self::$trustedHostPatterns) > 0) { + if (\count(self::$trustedHostPatterns) > 0) { // to avoid host header injection attacks, you should provide a list of trusted host patterns - if (in_array($host, self::$trustedHosts)) { + if (\in_array($host, self::$trustedHosts)) { return $host; } @@ -1353,7 +1353,10 @@ public function getMethod() if ($method = $this->headers->get('X-HTTP-METHOD-OVERRIDE')) { $this->method = strtoupper($method); } elseif (self::$httpMethodParameterOverride) { - $this->method = strtoupper($this->request->get('_method', $this->query->get('_method', 'POST'))); + $method = $this->request->get('_method', $this->query->get('_method', 'POST')); + if (\is_string($method)) { + $this->method = strtoupper($method); + } } } } @@ -1378,7 +1381,7 @@ public function getRealMethod() * * @param string $format The format * - * @return string The associated mime type (null if not found) + * @return string|null The associated mime type (null if not found) */ public function getMimeType($format) { @@ -1416,7 +1419,7 @@ public function getFormat($mimeType) { $canonicalMimeType = null; if (false !== $pos = strpos($mimeType, ';')) { - $canonicalMimeType = substr($mimeType, 0, $pos); + $canonicalMimeType = trim(substr($mimeType, 0, $pos)); } if (null === static::$formats) { @@ -1424,10 +1427,10 @@ public function getFormat($mimeType) } foreach (static::$formats as $format => $mimeTypes) { - if (in_array($mimeType, (array) $mimeTypes)) { + if (\in_array($mimeType, (array) $mimeTypes)) { return $format; } - if (null !== $canonicalMimeType && in_array($canonicalMimeType, (array) $mimeTypes)) { + if (null !== $canonicalMimeType && \in_array($canonicalMimeType, (array) $mimeTypes)) { return $format; } } @@ -1445,7 +1448,7 @@ public function setFormat($format, $mimeTypes) static::initializeFormats(); } - static::$formats[$format] = is_array($mimeTypes) ? $mimeTypes : array($mimeTypes); + static::$formats[$format] = \is_array($mimeTypes) ? $mimeTypes : array($mimeTypes); } /** @@ -1457,7 +1460,7 @@ public function setFormat($format, $mimeTypes) * * _format request attribute * * $default * - * @param string $default The default format + * @param string|null $default The default format * * @return string The request format */ @@ -1557,15 +1560,15 @@ public function isMethod($method) */ public function isMethodSafe(/* $andCacheable = true */) { - if (!func_num_args() || func_get_arg(0)) { + if (!\func_num_args() || func_get_arg(0)) { // This deprecation should be turned into a BadMethodCallException in 4.0 (without adding the argument in the signature) // then setting $andCacheable to false should be deprecated in 4.1 @trigger_error('Checking only for cacheable HTTP methods with Symfony\Component\HttpFoundation\Request::isMethodSafe() is deprecated since Symfony 3.2 and will throw an exception in 4.0. Disable checking only for cacheable methods by calling the method with `false` as first argument or use the Request::isMethodCacheable() instead.', E_USER_DEPRECATED); - return in_array($this->getMethod(), array('GET', 'HEAD')); + return \in_array($this->getMethod(), array('GET', 'HEAD')); } - return in_array($this->getMethod(), array('GET', 'HEAD', 'OPTIONS', 'TRACE')); + return \in_array($this->getMethod(), array('GET', 'HEAD', 'OPTIONS', 'TRACE')); } /** @@ -1575,7 +1578,7 @@ public function isMethodSafe(/* $andCacheable = true */) */ public function isMethodIdempotent() { - return in_array($this->getMethod(), array('HEAD', 'GET', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'PURGE')); + return \in_array($this->getMethod(), array('HEAD', 'GET', 'PUT', 'DELETE', 'TRACE', 'OPTIONS', 'PURGE')); } /** @@ -1583,11 +1586,11 @@ public function isMethodIdempotent() * * @see https://tools.ietf.org/html/rfc7231#section-4.2.3 * - * @return bool + * @return bool True for GET and HEAD, false otherwise */ public function isMethodCacheable() { - return in_array($this->getMethod(), array('GET', 'HEAD')); + return \in_array($this->getMethod(), array('GET', 'HEAD')); } /** @@ -1625,7 +1628,7 @@ public function getProtocolVersion() */ public function getContent($asResource = false) { - $currentContentIsResource = is_resource($this->content); + $currentContentIsResource = \is_resource($this->content); if (\PHP_VERSION_ID < 50600 && false === $this->content) { throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.'); } @@ -1638,7 +1641,7 @@ public function getContent($asResource = false) } // Content passed in parameter (test) - if (is_string($this->content)) { + if (\is_string($this->content)) { $resource = fopen('php://temp', 'r+'); fwrite($resource, $this->content); rewind($resource); @@ -1706,7 +1709,7 @@ public function getPreferredLanguage(array $locales = null) $extendedPreferredLanguages[] = $language; if (false !== $position = strpos($language, '_')) { $superLanguage = substr($language, 0, $position); - if (!in_array($superLanguage, $preferredLanguages)) { + if (!\in_array($superLanguage, $preferredLanguages)) { $extendedPreferredLanguages[] = $superLanguage; } } @@ -1737,11 +1740,11 @@ public function getLanguages() // Language not listed in ISO 639 that are not variants // of any listed language, which can be registered with the // i-prefix, such as i-cherokee - if (count($codes) > 1) { + if (\count($codes) > 1) { $lang = $codes[1]; } } else { - for ($i = 0, $max = count($codes); $i < $max; ++$i) { + for ($i = 0, $max = \count($codes); $i < $max; ++$i) { if (0 === $i) { $lang = strtolower($codes[0]); } else { @@ -1826,28 +1829,23 @@ protected function prepareRequestUri() { $requestUri = ''; - if ($this->headers->has('X_ORIGINAL_URL')) { - // IIS with Microsoft Rewrite Module - $requestUri = $this->headers->get('X_ORIGINAL_URL'); - $this->headers->remove('X_ORIGINAL_URL'); - $this->server->remove('HTTP_X_ORIGINAL_URL'); - $this->server->remove('UNENCODED_URL'); - $this->server->remove('IIS_WasUrlRewritten'); - } elseif ($this->headers->has('X_REWRITE_URL')) { - // IIS with ISAPI_Rewrite - $requestUri = $this->headers->get('X_REWRITE_URL'); - $this->headers->remove('X_REWRITE_URL'); - } elseif ('1' == $this->server->get('IIS_WasUrlRewritten') && '' != $this->server->get('UNENCODED_URL')) { + if ('1' == $this->server->get('IIS_WasUrlRewritten') && '' != $this->server->get('UNENCODED_URL')) { // IIS7 with URL Rewrite: make sure we get the unencoded URL (double slash problem) $requestUri = $this->server->get('UNENCODED_URL'); $this->server->remove('UNENCODED_URL'); $this->server->remove('IIS_WasUrlRewritten'); } elseif ($this->server->has('REQUEST_URI')) { $requestUri = $this->server->get('REQUEST_URI'); + // HTTP proxy reqs setup request URI with scheme and host [and port] + the URL path, only use URL path - $schemeAndHttpHost = $this->getSchemeAndHttpHost(); - if (0 === strpos($requestUri, $schemeAndHttpHost)) { - $requestUri = substr($requestUri, strlen($schemeAndHttpHost)); + $uriComponents = parse_url($requestUri); + + if (isset($uriComponents['path'])) { + $requestUri = $uriComponents['path']; + } + + if (isset($uriComponents['query'])) { + $requestUri .= '?'.$uriComponents['query']; } } elseif ($this->server->has('ORIG_PATH_INFO')) { // IIS 5.0, PHP as CGI @@ -1887,7 +1885,7 @@ protected function prepareBaseUrl() $segs = explode('/', trim($file, '/')); $segs = array_reverse($segs); $index = 0; - $last = count($segs); + $last = \count($segs); $baseUrl = ''; do { $seg = $segs[$index]; @@ -1907,9 +1905,9 @@ protected function prepareBaseUrl() return $prefix; } - if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, rtrim(dirname($baseUrl), '/'.DIRECTORY_SEPARATOR).'/')) { + if ($baseUrl && false !== $prefix = $this->getUrlencodedPrefix($requestUri, rtrim(\dirname($baseUrl), '/'.\DIRECTORY_SEPARATOR).'/')) { // directory portion of $baseUrl matches - return rtrim($prefix, '/'.DIRECTORY_SEPARATOR); + return rtrim($prefix, '/'.\DIRECTORY_SEPARATOR); } $truncatedRequestUri = $requestUri; @@ -1926,11 +1924,11 @@ protected function prepareBaseUrl() // If using mod_rewrite or ISAPI_Rewrite strip the script filename // out of baseUrl. $pos !== 0 makes sure it is not matching a value // from PATH_INFO or QUERY_STRING - if (strlen($requestUri) >= strlen($baseUrl) && (false !== $pos = strpos($requestUri, $baseUrl)) && 0 !== $pos) { - $baseUrl = substr($requestUri, 0, $pos + strlen($baseUrl)); + if (\strlen($requestUri) >= \strlen($baseUrl) && (false !== $pos = strpos($requestUri, $baseUrl)) && 0 !== $pos) { + $baseUrl = substr($requestUri, 0, $pos + \strlen($baseUrl)); } - return rtrim($baseUrl, '/'.DIRECTORY_SEPARATOR); + return rtrim($baseUrl, '/'.\DIRECTORY_SEPARATOR); } /** @@ -1947,12 +1945,12 @@ protected function prepareBasePath() $filename = basename($this->server->get('SCRIPT_FILENAME')); if (basename($baseUrl) === $filename) { - $basePath = dirname($baseUrl); + $basePath = \dirname($baseUrl); } else { $basePath = $baseUrl; } - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $basePath = str_replace('\\', '/', $basePath); } @@ -1982,7 +1980,7 @@ protected function preparePathInfo() return $requestUri; } - $pathInfo = substr($requestUri, strlen($baseUrl)); + $pathInfo = substr($requestUri, \strlen($baseUrl)); if (false === $pathInfo || '' === $pathInfo) { // If substr() returns false then PATH_INFO is set to an empty string return '/'; @@ -2044,7 +2042,7 @@ private function getUrlencodedPrefix($string, $prefix) return false; } - $len = strlen($prefix); + $len = \strlen($prefix); if (preg_match(sprintf('#^(%%[[:xdigit:]]{2}|.){%d}#', $len), $string, $match)) { return $match[0]; @@ -2056,7 +2054,7 @@ private function getUrlencodedPrefix($string, $prefix) private static function createRequestFromFactory(array $query = array(), array $request = array(), array $attributes = array(), array $cookies = array(), array $files = array(), array $server = array(), $content = null) { if (self::$requestFactory) { - $request = call_user_func(self::$requestFactory, $query, $request, $attributes, $cookies, $files, $server, $content); + $request = \call_user_func(self::$requestFactory, $query, $request, $attributes, $cookies, $files, $server, $content); if (!$request instanceof self) { throw new \LogicException('The Request factory must return an instance of Symfony\Component\HttpFoundation\Request.'); @@ -2094,7 +2092,15 @@ private function getTrustedValues($type, $ip = null) if (self::$trustedHeaders[self::HEADER_FORWARDED] && $this->headers->has(self::$trustedHeaders[self::HEADER_FORWARDED])) { $forwardedValues = $this->headers->get(self::$trustedHeaders[self::HEADER_FORWARDED]); - $forwardedValues = preg_match_all(sprintf('{(?:%s)=(?:"?\[?)([a-zA-Z0-9\.:_\-/]*+)}', self::$forwardedParams[$type]), $forwardedValues, $matches) ? $matches[1] : array(); + $forwardedValues = preg_match_all(sprintf('{(?:%s)="?([a-zA-Z0-9\.:_\-/\[\]]*+)}', self::$forwardedParams[$type]), $forwardedValues, $matches) ? $matches[1] : array(); + if (self::HEADER_CLIENT_PORT === $type) { + foreach ($forwardedValues as $k => $v) { + if (']' === substr($v, -1) || false === $v = strrchr($v, ':')) { + $v = $this->isSecure() ? ':443' : ':80'; + } + $forwardedValues[$k] = '0.0.0.0'.$v; + } + } } if (null !== $ip) { @@ -2127,9 +2133,17 @@ private function normalizeAndFilterClientIps(array $clientIps, $ip) $firstTrustedIp = null; foreach ($clientIps as $key => $clientIp) { - // Remove port (unfortunately, it does happen) - if (preg_match('{((?:\d+\.){3}\d+)\:\d+}', $clientIp, $match)) { - $clientIps[$key] = $clientIp = $match[1]; + if (strpos($clientIp, '.')) { + // Strip :port from IPv4 addresses. This is allowed in Forwarded + // and may occur in X-Forwarded-For. + $i = strpos($clientIp, ':'); + if ($i) { + $clientIps[$key] = $clientIp = substr($clientIp, 0, $i); + } + } elseif (0 === strpos($clientIp, '[')) { + // Strip brackets and :port from IPv6 addresses. + $i = strpos($clientIp, ']', 1); + $clientIps[$key] = $clientIp = substr($clientIp, 1, $i - 1); } if (!filter_var($clientIp, FILTER_VALIDATE_IP)) { diff --git a/vendor/symfony/http-foundation/RequestMatcher.php b/vendor/symfony/http-foundation/RequestMatcher.php index 076d077c7..6b4cef147 100644 --- a/vendor/symfony/http-foundation/RequestMatcher.php +++ b/vendor/symfony/http-foundation/RequestMatcher.php @@ -145,11 +145,11 @@ public function matchAttribute($key, $regexp) */ public function matches(Request $request) { - if ($this->schemes && !in_array($request->getScheme(), $this->schemes, true)) { + if ($this->schemes && !\in_array($request->getScheme(), $this->schemes, true)) { return false; } - if ($this->methods && !in_array($request->getMethod(), $this->methods, true)) { + if ($this->methods && !\in_array($request->getMethod(), $this->methods, true)) { return false; } @@ -173,6 +173,6 @@ public function matches(Request $request) // Note to future implementors: add additional checks above the // foreach above or else your check might not be run! - return 0 === count($this->ips); + return 0 === \count($this->ips); } } diff --git a/vendor/symfony/http-foundation/RequestStack.php b/vendor/symfony/http-foundation/RequestStack.php index 3d9cfd0c6..40123f66f 100644 --- a/vendor/symfony/http-foundation/RequestStack.php +++ b/vendor/symfony/http-foundation/RequestStack.php @@ -92,7 +92,7 @@ public function getMasterRequest() */ public function getParentRequest() { - $pos = count($this->requests) - 2; + $pos = \count($this->requests) - 2; if (!isset($this->requests[$pos])) { return; diff --git a/vendor/symfony/http-foundation/Response.php b/vendor/symfony/http-foundation/Response.php index e05194b01..f267d1e0e 100644 --- a/vendor/symfony/http-foundation/Response.php +++ b/vendor/symfony/http-foundation/Response.php @@ -64,7 +64,12 @@ class Response const HTTP_UNPROCESSABLE_ENTITY = 422; // RFC4918 const HTTP_LOCKED = 423; // RFC4918 const HTTP_FAILED_DEPENDENCY = 424; // RFC4918 + + /** + * @deprecated + */ const HTTP_RESERVED_FOR_WEBDAV_ADVANCED_COLLECTIONS_EXPIRED_PROPOSAL = 425; // RFC2817 + const HTTP_TOO_EARLY = 425; // RFC-ietf-httpbis-replay-04 const HTTP_UPGRADE_REQUIRED = 426; // RFC2817 const HTTP_PRECONDITION_REQUIRED = 428; // RFC6585 const HTTP_TOO_MANY_REQUESTS = 429; // RFC6585 @@ -169,7 +174,7 @@ class Response 422 => 'Unprocessable Entity', // RFC4918 423 => 'Locked', // RFC4918 424 => 'Failed Dependency', // RFC4918 - 425 => 'Reserved for WebDAV advanced collections expired proposal', // RFC2817 + 425 => 'Too Early', // RFC-ietf-httpbis-replay-04 426 => 'Upgrade Required', // RFC2817 428 => 'Precondition Required', // RFC6585 429 => 'Too Many Requests', // RFC6585 @@ -328,12 +333,18 @@ public function sendHeaders() } // headers - foreach ($this->headers->allPreserveCase() as $name => $values) { + foreach ($this->headers->allPreserveCaseWithoutCookies() as $name => $values) { + $replace = 0 === strcasecmp($name, 'Content-Type'); foreach ($values as $value) { - header($name.': '.$value, false, $this->statusCode); + header($name.': '.$value, $replace, $this->statusCode); } } + // cookies + foreach ($this->headers->getCookies() as $cookie) { + header('Set-Cookie: '.$cookie->getName().strstr($cookie, '='), false, $this->statusCode); + } + // status header(sprintf('HTTP/%s %s %s', $this->version, $this->statusCode, $this->statusText), true, $this->statusCode); @@ -362,9 +373,9 @@ public function send() $this->sendHeaders(); $this->sendContent(); - if (function_exists('fastcgi_finish_request')) { + if (\function_exists('fastcgi_finish_request')) { fastcgi_finish_request(); - } elseif (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true)) { + } elseif (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) { static::closeOutputBuffers(0, true); } @@ -384,8 +395,8 @@ public function send() */ public function setContent($content) { - if (null !== $content && !is_string($content) && !is_numeric($content) && !is_callable(array($content, '__toString'))) { - throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', gettype($content))); + if (null !== $content && !\is_string($content) && !is_numeric($content) && !\is_callable(array($content, '__toString'))) { + throw new \UnexpectedValueException(sprintf('The Response content must be a string or object implementing __toString(), "%s" given.', \gettype($content))); } $this->content = (string) $content; @@ -531,7 +542,7 @@ public function getCharset() */ public function isCacheable() { - if (!in_array($this->statusCode, array(200, 203, 300, 301, 302, 404, 410))) { + if (!\in_array($this->statusCode, array(200, 203, 300, 301, 302, 404, 410))) { return false; } @@ -708,6 +719,7 @@ public function expire() { if ($this->isFresh()) { $this->headers->set('Age', $this->getMaxAge()); + $this->headers->remove('Expires'); } return $this; @@ -963,7 +975,7 @@ public function setEtag($etag = null, $weak = false) public function setCache(array $options) { if ($diff = array_diff(array_keys($options), array('etag', 'last_modified', 'max_age', 's_maxage', 'private', 'public', 'immutable'))) { - throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', array_values($diff)))); + throw new \InvalidArgumentException(sprintf('Response does not support the following options: "%s".', implode('", "', $diff))); } if (isset($options['etag'])) { @@ -1102,7 +1114,7 @@ public function isNotModified(Request $request) $modifiedSince = $request->headers->get('If-Modified-Since'); if ($etags = $request->getETags()) { - $notModified = in_array($this->getEtag(), $etags) || in_array('*', $etags); + $notModified = \in_array($this->getEtag(), $etags) || \in_array('*', $etags); } if ($modifiedSince && $lastModified) { @@ -1237,7 +1249,7 @@ public function isNotFound() */ public function isRedirect($location = null) { - return in_array($this->statusCode, array(201, 301, 302, 303, 307, 308)) && (null === $location ?: $location == $this->headers->get('Location')); + return \in_array($this->statusCode, array(201, 301, 302, 303, 307, 308)) && (null === $location ?: $location == $this->headers->get('Location')); } /** @@ -1249,7 +1261,7 @@ public function isRedirect($location = null) */ public function isEmpty() { - return in_array($this->statusCode, array(204, 304)); + return \in_array($this->statusCode, array(204, 304)); } /** @@ -1265,9 +1277,9 @@ public function isEmpty() public static function closeOutputBuffers($targetLevel, $flush) { $status = ob_get_status(true); - $level = count($status); + $level = \count($status); // PHP_OUTPUT_HANDLER_* are not defined on HHVM 3.3 - $flags = defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1; + $flags = \defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1; while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || ($s['flags'] & $flags) === $flags : $s['del'])) { if ($flush) { diff --git a/vendor/symfony/http-foundation/ResponseHeaderBag.php b/vendor/symfony/http-foundation/ResponseHeaderBag.php index 11a859326..00cff7af0 100644 --- a/vendor/symfony/http-foundation/ResponseHeaderBag.php +++ b/vendor/symfony/http-foundation/ResponseHeaderBag.php @@ -210,13 +210,13 @@ public function removeCookie($name, $path = '/', $domain = null) * * @param string $format * - * @return array + * @return Cookie[] * * @throws \InvalidArgumentException When the $format is invalid */ public function getCookies($format = self::COOKIES_FLAT) { - if (!in_array($format, array(self::COOKIES_FLAT, self::COOKIES_ARRAY))) { + if (!\in_array($format, array(self::COOKIES_FLAT, self::COOKIES_ARRAY))) { throw new \InvalidArgumentException(sprintf('Format "%s" invalid (%s).', $format, implode(', ', array(self::COOKIES_FLAT, self::COOKIES_ARRAY)))); } @@ -267,7 +267,7 @@ public function clearCookie($name, $path = '/', $domain = null, $secure = false, */ public function makeDisposition($disposition, $filename, $filenameFallback = '') { - if (!in_array($disposition, array(self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE))) { + if (!\in_array($disposition, array(self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE))) { throw new \InvalidArgumentException(sprintf('The disposition must be either "%s" or "%s".', self::DISPOSITION_ATTACHMENT, self::DISPOSITION_INLINE)); } diff --git a/vendor/symfony/http-foundation/ServerBag.php b/vendor/symfony/http-foundation/ServerBag.php index 19d2022ef..d8ab561aa 100644 --- a/vendor/symfony/http-foundation/ServerBag.php +++ b/vendor/symfony/http-foundation/ServerBag.php @@ -68,7 +68,7 @@ public function getHeaders() if (0 === stripos($authorizationHeader, 'basic ')) { // Decode AUTHORIZATION header into PHP_AUTH_USER and PHP_AUTH_PW when authorization header is basic $exploded = explode(':', base64_decode(substr($authorizationHeader, 6)), 2); - if (2 == count($exploded)) { + if (2 == \count($exploded)) { list($headers['PHP_AUTH_USER'], $headers['PHP_AUTH_PW']) = $exploded; } } elseif (empty($this->parameters['PHP_AUTH_DIGEST']) && (0 === stripos($authorizationHeader, 'digest '))) { diff --git a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php index ea1fda290..fc5fb1410 100644 --- a/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php +++ b/vendor/symfony/http-foundation/Session/Attribute/AttributeBag.php @@ -143,6 +143,6 @@ public function getIterator() */ public function count() { - return count($this->attributes); + return \count($this->attributes); } } diff --git a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php index abbf37ee7..2f1e01a97 100644 --- a/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php +++ b/vendor/symfony/http-foundation/Session/Attribute/NamespacedAttributeBag.php @@ -110,7 +110,7 @@ protected function &resolveAttributePath($name, $writeContext = false) } $parts = explode($this->namespaceCharacter, $name); - if (count($parts) < 2) { + if (\count($parts) < 2) { if (!$writeContext) { return $array; } @@ -120,11 +120,17 @@ protected function &resolveAttributePath($name, $writeContext = false) return $array; } - unset($parts[count($parts) - 1]); + unset($parts[\count($parts) - 1]); foreach ($parts as $part) { if (null !== $array && !array_key_exists($part, $array)) { - $array[$part] = $writeContext ? array() : null; + if (!$writeContext) { + $null = null; + + return $null; + } + + $array[$part] = array(); } $array = &$array[$part]; diff --git a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php index 80e97f17c..f53c9dae6 100644 --- a/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php +++ b/vendor/symfony/http-foundation/Session/Flash/FlashBagInterface.php @@ -24,7 +24,7 @@ interface FlashBagInterface extends SessionBagInterface * Adds a flash message for type. * * @param string $type - * @param string $message + * @param mixed $message */ public function add($type, $message); diff --git a/vendor/symfony/http-foundation/Session/Session.php b/vendor/symfony/http-foundation/Session/Session.php index a46cffbb8..334990687 100644 --- a/vendor/symfony/http-foundation/Session/Session.php +++ b/vendor/symfony/http-foundation/Session/Session.php @@ -11,12 +11,12 @@ namespace Symfony\Component\HttpFoundation\Session; -use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBagInterface; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Flash\FlashBagInterface; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; +use Symfony\Component\HttpFoundation\Session\Storage\SessionStorageInterface; /** * @author Fabien Potencier @@ -29,7 +29,7 @@ class Session implements SessionInterface, \IteratorAggregate, \Countable private $flashName; private $attributeName; private $data = array(); - private $hasBeenStarted; + private $usageIndex = 0; /** * @param SessionStorageInterface $storage A SessionStorageInterface instance @@ -138,17 +138,17 @@ public function getIterator() */ public function count() { - return count($this->getAttributeBag()->all()); + return \count($this->getAttributeBag()->all()); } /** - * @return bool + * @return int * * @internal */ - public function hasBeenStarted() + public function getUsageIndex() { - return $this->hasBeenStarted; + return $this->usageIndex; } /** @@ -158,6 +158,9 @@ public function hasBeenStarted() */ public function isEmpty() { + if ($this->isStarted()) { + ++$this->usageIndex; + } foreach ($this->data as &$data) { if (!empty($data)) { return false; @@ -206,7 +209,9 @@ public function getId() */ public function setId($id) { - $this->storage->setId($id); + if ($this->storage->getId() !== $id) { + $this->storage->setId($id); + } } /** @@ -230,6 +235,8 @@ public function setName($name) */ public function getMetadataBag() { + ++$this->usageIndex; + return $this->storage->getMetadataBag(); } @@ -238,7 +245,7 @@ public function getMetadataBag() */ public function registerBag(SessionBagInterface $bag) { - $this->storage->registerBag(new SessionBagProxy($bag, $this->data, $this->hasBeenStarted)); + $this->storage->registerBag(new SessionBagProxy($bag, $this->data, $this->usageIndex)); } /** diff --git a/vendor/symfony/http-foundation/Session/SessionBagProxy.php b/vendor/symfony/http-foundation/Session/SessionBagProxy.php index 307836d5f..3504bdfe7 100644 --- a/vendor/symfony/http-foundation/Session/SessionBagProxy.php +++ b/vendor/symfony/http-foundation/Session/SessionBagProxy.php @@ -20,13 +20,13 @@ final class SessionBagProxy implements SessionBagInterface { private $bag; private $data; - private $hasBeenStarted; + private $usageIndex; - public function __construct(SessionBagInterface $bag, array &$data, &$hasBeenStarted) + public function __construct(SessionBagInterface $bag, array &$data, &$usageIndex) { $this->bag = $bag; $this->data = &$data; - $this->hasBeenStarted = &$hasBeenStarted; + $this->usageIndex = &$usageIndex; } /** @@ -34,6 +34,8 @@ public function __construct(SessionBagInterface $bag, array &$data, &$hasBeenSta */ public function getBag() { + ++$this->usageIndex; + return $this->bag; } @@ -42,6 +44,11 @@ public function getBag() */ public function isEmpty() { + if (!isset($this->data[$this->bag->getStorageKey()])) { + return true; + } + ++$this->usageIndex; + return empty($this->data[$this->bag->getStorageKey()]); } @@ -58,7 +65,7 @@ public function getName() */ public function initialize(array &$array) { - $this->hasBeenStarted = true; + ++$this->usageIndex; $this->data[$this->bag->getStorageKey()] = &$array; $this->bag->initialize($array); diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php index 6ae135581..0d119498d 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/AbstractSessionHandler.php @@ -131,9 +131,9 @@ public function destroy($sessionId) if (\PHP_VERSION_ID < 70000) { $this->prefetchData = null; } - if (!headers_sent() && ini_get('session.use_cookies')) { + if (!headers_sent() && filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN)) { if (!$this->sessionName) { - throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', get_class($this))); + throw new \LogicException(sprintf('Session name cannot be empty, did you forget to call "parent::open()" in "%s"?.', \get_class($this))); } $sessionCookie = sprintf(' %s=', urlencode($this->sessionName)); $sessionCookieWithId = sprintf('%s%s;', $sessionCookie, urlencode($sessionId)); @@ -159,7 +159,7 @@ public function destroy($sessionId) header($h, false); } } else { - setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), ini_get('session.cookie_secure'), ini_get('session.cookie_httponly')); + setcookie($this->sessionName, '', 0, ini_get('session.cookie_path'), ini_get('session.cookie_domain'), filter_var(ini_get('session.cookie_secure'), FILTER_VALIDATE_BOOLEAN), filter_var(ini_get('session.cookie_httponly'), FILTER_VALIDATE_BOOLEAN)); } } diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php index 90726beb0..1b12c9218 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcacheSessionHandler.php @@ -47,9 +47,7 @@ class MemcacheSessionHandler implements \SessionHandlerInterface public function __construct(\Memcache $memcache, array $options = array()) { if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) { - throw new \InvalidArgumentException(sprintf( - 'The following options are not supported "%s"', implode(', ', $diff) - )); + throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff))); } $this->memcache = $memcache; diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php index dd37eae14..61a7afd90 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/MemcachedSessionHandler.php @@ -50,9 +50,7 @@ public function __construct(\Memcached $memcached, array $options = array()) $this->memcached = $memcached; if ($diff = array_diff(array_keys($options), array('prefix', 'expiretime'))) { - throw new \InvalidArgumentException(sprintf( - 'The following options are not supported "%s"', implode(', ', $diff) - )); + throw new \InvalidArgumentException(sprintf('The following options are not supported "%s"', implode(', ', $diff))); } $this->ttl = isset($options['expiretime']) ? (int) $options['expiretime'] : 86400; diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php index c8737be18..8c0c42fd2 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/PdoSessionHandler.php @@ -71,7 +71,7 @@ class PdoSessionHandler extends AbstractSessionHandler private $pdo; /** - * @var string|null|false DSN string or null for session.save_path or false when lazy connection disabled + * @var string|false|null DSN string or null for session.save_path or false when lazy connection disabled */ private $dsn = false; @@ -178,7 +178,7 @@ public function __construct($pdoOrDsn = null, array $options = array()) $this->pdo = $pdoOrDsn; $this->driver = $this->pdo->getAttribute(\PDO::ATTR_DRIVER_NAME); - } elseif (is_string($pdoOrDsn) && false !== strpos($pdoOrDsn, '://')) { + } elseif (\is_string($pdoOrDsn) && false !== strpos($pdoOrDsn, '://')) { $this->dsn = $this->buildDsnFromUrl($pdoOrDsn); } else { $this->dsn = $pdoOrDsn; @@ -616,6 +616,7 @@ protected function doRead($sessionId) $selectSql = $this->getSelectSql(); $selectStmt = $this->pdo->prepare($selectSql); $selectStmt->bindParam(':id', $sessionId, \PDO::PARAM_STR); + $insertStmt = null; do { $selectStmt->execute(); @@ -628,10 +629,15 @@ protected function doRead($sessionId) return ''; } - return is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0]; + return \is_resource($sessionRows[0][0]) ? stream_get_contents($sessionRows[0][0]) : $sessionRows[0][0]; } - if (!ini_get('session.use_strict_mode') && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) { + if (null !== $insertStmt) { + $this->rollback(); + throw new \RuntimeException('Failed to read session: INSERT reported a duplicate id but next SELECT did not return any data.'); + } + + if (!filter_var(ini_get('session.use_strict_mode'), FILTER_VALIDATE_BOOLEAN) && self::LOCK_TRANSACTIONAL === $this->lockMode && 'sqlite' !== $this->driver) { // In strict mode, session fixation is not possible: new sessions always start with a unique // random id, so that concurrency is not possible and this code path can be skipped. // Exclusive-reading of non-existent rows does not block, so we need to do an insert to block @@ -676,14 +682,16 @@ private function doAdvisoryLock($sessionId) { switch ($this->driver) { case 'mysql': + // MySQL 5.7.5 and later enforces a maximum length on lock names of 64 characters. Previously, no limit was enforced. + $lockId = \substr($sessionId, 0, 64); // should we handle the return value? 0 on timeout, null on error // we use a timeout of 50 seconds which is also the default for innodb_lock_wait_timeout $stmt = $this->pdo->prepare('SELECT GET_LOCK(:key, 50)'); - $stmt->bindValue(':key', $sessionId, \PDO::PARAM_STR); + $stmt->bindValue(':key', $lockId, \PDO::PARAM_STR); $stmt->execute(); $releaseStmt = $this->pdo->prepare('DO RELEASE_LOCK(:key)'); - $releaseStmt->bindValue(':key', $sessionId, \PDO::PARAM_STR); + $releaseStmt->bindValue(':key', $lockId, \PDO::PARAM_STR); return $releaseStmt; case 'pgsql': @@ -733,11 +741,11 @@ private function doAdvisoryLock($sessionId) private function convertStringToInt($string) { if (4 === \PHP_INT_SIZE) { - return (ord($string[3]) << 24) + (ord($string[2]) << 16) + (ord($string[1]) << 8) + ord($string[0]); + return (\ord($string[3]) << 24) + (\ord($string[2]) << 16) + (\ord($string[1]) << 8) + \ord($string[0]); } - $int1 = (ord($string[7]) << 24) + (ord($string[6]) << 16) + (ord($string[5]) << 8) + ord($string[4]); - $int2 = (ord($string[3]) << 24) + (ord($string[2]) << 16) + (ord($string[1]) << 8) + ord($string[0]); + $int1 = (\ord($string[7]) << 24) + (\ord($string[6]) << 16) + (\ord($string[5]) << 8) + \ord($string[4]); + $int2 = (\ord($string[3]) << 24) + (\ord($string[2]) << 16) + (\ord($string[1]) << 8) + \ord($string[0]); return $int2 + ($int1 << 32); } diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php index 228119297..83a1f2c06 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/StrictSessionHandler.php @@ -24,7 +24,7 @@ class StrictSessionHandler extends AbstractSessionHandler public function __construct(\SessionHandlerInterface $handler) { if ($handler instanceof \SessionUpdateTimestampHandlerInterface) { - throw new \LogicException(sprintf('"%s" is already an instance of "SessionUpdateTimestampHandlerInterface", you cannot wrap it with "%s".', get_class($handler), self::class)); + throw new \LogicException(sprintf('"%s" is already an instance of "SessionUpdateTimestampHandlerInterface", you cannot wrap it with "%s".', \get_class($handler), self::class)); } $this->handler = $handler; diff --git a/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php b/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php index 1541ec4e0..127e47f21 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php +++ b/vendor/symfony/http-foundation/Session/Storage/Handler/WriteCheckSessionHandler.php @@ -11,8 +11,6 @@ namespace Symfony\Component\HttpFoundation\Session\Storage\Handler; -@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.', WriteCheckSessionHandler::class), E_USER_DEPRECATED); - /** * Wraps another SessionHandlerInterface to only write the session when it has been modified. * @@ -31,6 +29,8 @@ class WriteCheckSessionHandler implements \SessionHandlerInterface public function __construct(\SessionHandlerInterface $wrappedSessionHandler) { + @trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Implement `SessionUpdateTimestampHandlerInterface` or extend `AbstractSessionHandler` instead.', self::class), E_USER_DEPRECATED); + $this->wrappedSessionHandler = $wrappedSessionHandler; } diff --git a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php index 6416a03fd..a18f812d5 100644 --- a/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php +++ b/vendor/symfony/http-foundation/Session/Storage/NativeSessionStorage.php @@ -137,7 +137,7 @@ public function start() throw new \RuntimeException('Failed to start the session: already started by PHP.'); } - if (ini_get('session.use_cookies') && headers_sent($file, $line)) { + if (filter_var(ini_get('session.use_cookies'), FILTER_VALIDATE_BOOLEAN) && headers_sent($file, $line)) { throw new \RuntimeException(sprintf('Failed to start the session because headers have already been sent by "%s" at line %d.', $file, $line)); } @@ -230,29 +230,22 @@ public function save() unset($_SESSION[$key]); } - // Register custom error handler to catch a possible failure warning during session write - set_error_handler(function ($errno, $errstr, $errfile, $errline) { - throw new \ErrorException($errstr, $errno, E_WARNING, $errfile, $errline); - }, E_WARNING); + // Register error handler to add information about the current save handler + $previousHandler = set_error_handler(function ($type, $msg, $file, $line) use (&$previousHandler) { + if (E_WARNING === $type && 0 === strpos($msg, 'session_write_close():')) { + $handler = $this->saveHandler instanceof SessionHandlerProxy ? $this->saveHandler->getHandler() : $this->saveHandler; + $msg = sprintf('session_write_close(): Failed to write session data with "%s" handler', \get_class($handler)); + } + + return $previousHandler ? $previousHandler($type, $msg, $file, $line) : false; + }); try { - $e = null; session_write_close(); - } catch (\ErrorException $e) { } finally { restore_error_handler(); $_SESSION = $session; } - if (null !== $e) { - // The default PHP error message is not very helpful, as it does not give any information on the current save handler. - // Therefore, we catch this error and trigger a warning with a better error message - $handler = $this->getSaveHandler(); - if ($handler instanceof SessionHandlerProxy) { - $handler = $handler->getHandler(); - } - - trigger_error(sprintf('session_write_close(): Failed to write session data with %s handler', get_class($handler)), E_USER_WARNING); - } $this->closed = true; $this->started = false; @@ -411,8 +404,6 @@ public function setSaveHandler($saveHandler = null) } if ($this->saveHandler instanceof SessionHandlerProxy) { - session_set_save_handler($this->saveHandler->getHandler(), false); - } elseif ($this->saveHandler instanceof \SessionHandlerInterface) { session_set_save_handler($this->saveHandler, false); } } diff --git a/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php b/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php index 53c1209a1..b11cc397a 100644 --- a/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php +++ b/vendor/symfony/http-foundation/Session/Storage/Proxy/SessionHandlerProxy.php @@ -14,7 +14,7 @@ /** * @author Drak */ -class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface +class SessionHandlerProxy extends AbstractProxy implements \SessionHandlerInterface, \SessionUpdateTimestampHandlerInterface { protected $handler; @@ -82,4 +82,20 @@ public function gc($maxlifetime) { return (bool) $this->handler->gc($maxlifetime); } + + /** + * {@inheritdoc} + */ + public function validateId($sessionId) + { + return !$this->handler instanceof \SessionUpdateTimestampHandlerInterface || $this->handler->validateId($sessionId); + } + + /** + * {@inheritdoc} + */ + public function updateTimestamp($sessionId, $data) + { + return $this->handler instanceof \SessionUpdateTimestampHandlerInterface ? $this->handler->updateTimestamp($sessionId, $data) : $this->write($sessionId, $data); + } } diff --git a/vendor/symfony/http-foundation/StreamedResponse.php b/vendor/symfony/http-foundation/StreamedResponse.php index 92868d33e..3a55d5d2b 100644 --- a/vendor/symfony/http-foundation/StreamedResponse.php +++ b/vendor/symfony/http-foundation/StreamedResponse.php @@ -17,7 +17,7 @@ * A StreamedResponse uses a callback for its content. * * The callback should use the standard PHP functions like echo - * to stream the response back to the client. The flush() method + * to stream the response back to the client. The flush() function * can also be used if needed. * * @see flush() @@ -111,7 +111,7 @@ public function sendContent() throw new \LogicException('The Response callback must not be null.'); } - call_user_func($this->callback); + \call_user_func($this->callback); return $this; } @@ -129,6 +129,8 @@ public function setContent($content) throw new \LogicException('The content cannot be set on a StreamedResponse instance.'); } + $this->streamed = true; + return $this; } diff --git a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php b/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php index 1b9e58991..d21791f00 100644 --- a/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/BinaryFileResponseTest.php @@ -208,6 +208,19 @@ public function provideFullFileRanges() ); } + public function testUnpreparedResponseSendsFullFile() + { + $response = BinaryFileResponse::create(__DIR__.'/File/Fixtures/test.gif', 200); + + $data = file_get_contents(__DIR__.'/File/Fixtures/test.gif'); + + $this->expectOutputString($data); + $response = clone $response; + $response->sendContent(); + + $this->assertEquals(200, $response->getStatusCode()); + } + /** * @dataProvider provideInvalidRanges */ diff --git a/vendor/symfony/http-foundation/Tests/CookieTest.php b/vendor/symfony/http-foundation/Tests/CookieTest.php index a47b71e1d..14c45c9a6 100644 --- a/vendor/symfony/http-foundation/Tests/CookieTest.php +++ b/vendor/symfony/http-foundation/Tests/CookieTest.php @@ -157,6 +157,18 @@ public function testCookieIsCleared() $cookie = new Cookie('foo', 'bar', time() - 20); $this->assertTrue($cookie->isCleared(), '->isCleared() returns true if the cookie has expired'); + + $cookie = new Cookie('foo', 'bar'); + + $this->assertFalse($cookie->isCleared()); + + $cookie = new Cookie('foo', 'bar', 0); + + $this->assertFalse($cookie->isCleared()); + + $cookie = new Cookie('foo', 'bar', -1); + + $this->assertFalse($cookie->isCleared()); } public function testToString() diff --git a/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php b/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php index b3f1f026a..bb88807ab 100644 --- a/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php +++ b/vendor/symfony/http-foundation/Tests/File/MimeType/MimeTypeTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\HttpFoundation\Tests\File\MimeType; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser; use Symfony\Component\HttpFoundation\File\MimeType\FileBinaryMimeTypeGuesser; +use Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser; /** * @requires extension fileinfo @@ -59,7 +59,7 @@ public function testGuessWithIncorrectPath() public function testGuessWithNonReadablePath() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Can not verify chmod operations on Windows'); } diff --git a/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php b/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php index 36f122fe7..1a88d4835 100644 --- a/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php +++ b/vendor/symfony/http-foundation/Tests/File/UploadedFileTest.php @@ -46,7 +46,7 @@ public function testFileUploadsWithNoMimeType() $this->assertEquals('application/octet-stream', $file->getClientMimeType()); - if (extension_loaded('fileinfo')) { + if (\extension_loaded('fileinfo')) { $this->assertEquals('image/gif', $file->getMimeType()); } } diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/common.inc b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/common.inc index ba101d357..0bdf9e4b7 100644 --- a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/common.inc +++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/common.inc @@ -22,6 +22,10 @@ error_reporting(-1); ini_set('html_errors', 0); ini_set('display_errors', 1); +if (filter_var(ini_get('xdebug.default_enable'), FILTER_VALIDATE_BOOLEAN)) { + xdebug_disable(); +} + header_remove('X-Powered-By'); header('Content-Type: text/plain; charset=utf-8'); diff --git a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.expected b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.expected index 4e9c4c075..14e44a398 100644 --- a/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.expected +++ b/vendor/symfony/http-foundation/Tests/Fixtures/response-functional/cookie_urlencode.expected @@ -4,7 +4,7 @@ Array [0] => Content-Type: text/plain; charset=utf-8 [1] => Cache-Control: no-cache, private [2] => Date: Sat, 12 Nov 1955 20:04:00 GMT - [3] => Set-Cookie: %3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D=%3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D; path=/ + [3] => Set-Cookie: ?*():@&+$/%#[]=%3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D; path=/ [4] => Set-Cookie: ?*():@&+$/%#[]=%3F%2A%28%29%3A%40%26%2B%24%2F%25%23%5B%5D; path=/ ) shutdown diff --git a/vendor/symfony/http-foundation/Tests/HeaderBagTest.php b/vendor/symfony/http-foundation/Tests/HeaderBagTest.php index 6d19ceb00..c5a437f99 100644 --- a/vendor/symfony/http-foundation/Tests/HeaderBagTest.php +++ b/vendor/symfony/http-foundation/Tests/HeaderBagTest.php @@ -192,7 +192,7 @@ public function testGetIterator() $this->assertEquals(array($headers[$key]), $val); } - $this->assertEquals(count($headers), $i); + $this->assertEquals(\count($headers), $i); } public function testCount() @@ -200,6 +200,6 @@ public function testCount() $headers = array('foo' => 'bar', 'HELLO' => 'WORLD'); $headerBag = new HeaderBag($headers); - $this->assertCount(count($headers), $headerBag); + $this->assertCount(\count($headers), $headerBag); } } diff --git a/vendor/symfony/http-foundation/Tests/IpUtilsTest.php b/vendor/symfony/http-foundation/Tests/IpUtilsTest.php index 7a93f9947..232a2040f 100644 --- a/vendor/symfony/http-foundation/Tests/IpUtilsTest.php +++ b/vendor/symfony/http-foundation/Tests/IpUtilsTest.php @@ -47,7 +47,7 @@ public function getIpv4Data() */ public function testIpv6($matches, $remoteAddr, $cidr) { - if (!defined('AF_INET6')) { + if (!\defined('AF_INET6')) { $this->markTestSkipped('Only works when PHP is compiled without the option "disable-ipv6".'); } @@ -78,7 +78,7 @@ public function getIpv6Data() */ public function testAnIpv6WithOptionDisabledIpv6() { - if (defined('AF_INET6')) { + if (\defined('AF_INET6')) { $this->markTestSkipped('Only works when PHP is compiled with the option "disable-ipv6".'); } diff --git a/vendor/symfony/http-foundation/Tests/JsonResponseTest.php b/vendor/symfony/http-foundation/Tests/JsonResponseTest.php index 201839f89..6687fde5b 100644 --- a/vendor/symfony/http-foundation/Tests/JsonResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/JsonResponseTest.php @@ -16,6 +16,15 @@ class JsonResponseTest extends TestCase { + protected function setUp() + { + parent::setUp(); + + if (!\defined('HHVM_VERSION')) { + $this->iniSet('serialize_precision', 14); + } + } + public function testConstructorEmptyCreatesJsonObject() { $response = new JsonResponse(); diff --git a/vendor/symfony/http-foundation/Tests/ParameterBagTest.php b/vendor/symfony/http-foundation/Tests/ParameterBagTest.php index ab908d8d3..dccfd4f30 100644 --- a/vendor/symfony/http-foundation/Tests/ParameterBagTest.php +++ b/vendor/symfony/http-foundation/Tests/ParameterBagTest.php @@ -171,7 +171,7 @@ public function testGetIterator() $this->assertEquals($parameters[$key], $val); } - $this->assertEquals(count($parameters), $i); + $this->assertEquals(\count($parameters), $i); } public function testCount() @@ -179,7 +179,7 @@ public function testCount() $parameters = array('foo' => 'bar', 'hello' => 'world'); $bag = new ParameterBag($parameters); - $this->assertCount(count($parameters), $bag); + $this->assertCount(\count($parameters), $bag); } public function testGetBoolean() diff --git a/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php b/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php index b5d80048f..10d764a77 100644 --- a/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php +++ b/vendor/symfony/http-foundation/Tests/RequestMatcherTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\HttpFoundation\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\RequestMatcher; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestMatcher; class RequestMatcherTest extends TestCase { diff --git a/vendor/symfony/http-foundation/Tests/RequestTest.php b/vendor/symfony/http-foundation/Tests/RequestTest.php index 230ad1567..539bb69cf 100644 --- a/vendor/symfony/http-foundation/Tests/RequestTest.php +++ b/vendor/symfony/http-foundation/Tests/RequestTest.php @@ -13,16 +13,16 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Exception\SuspiciousOperationException; -use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; -use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Session\Session; +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; class RequestTest extends TestCase { protected function tearDown() { - // reset Request::setTrustedProxies(array(), -1); + Request::setTrustedHosts(array()); } public function testInitialize() @@ -232,6 +232,55 @@ public function testCreate() $this->assertEquals(80, $request->getPort()); $this->assertEquals('test.com', $request->getHttpHost()); $this->assertFalse($request->isSecure()); + + // Fragment should not be included in the URI + $request = Request::create('http://test.com/foo#bar'); + $this->assertEquals('http://test.com/foo', $request->getUri()); + } + + public function testCreateWithRequestUri() + { + $request = Request::create('http://test.com:80/foo'); + $request->server->set('REQUEST_URI', 'http://test.com:80/foo'); + $this->assertEquals('http://test.com/foo', $request->getUri()); + $this->assertEquals('/foo', $request->getPathInfo()); + $this->assertEquals('test.com', $request->getHost()); + $this->assertEquals('test.com', $request->getHttpHost()); + $this->assertEquals(80, $request->getPort()); + $this->assertFalse($request->isSecure()); + + $request = Request::create('http://test.com:8080/foo'); + $request->server->set('REQUEST_URI', 'http://test.com:8080/foo'); + $this->assertEquals('http://test.com:8080/foo', $request->getUri()); + $this->assertEquals('/foo', $request->getPathInfo()); + $this->assertEquals('test.com', $request->getHost()); + $this->assertEquals('test.com:8080', $request->getHttpHost()); + $this->assertEquals(8080, $request->getPort()); + $this->assertFalse($request->isSecure()); + + $request = Request::create('http://test.com/foo?bar=foo', 'GET', array('bar' => 'baz')); + $request->server->set('REQUEST_URI', 'http://test.com/foo?bar=foo'); + $this->assertEquals('http://test.com/foo?bar=baz', $request->getUri()); + $this->assertEquals('/foo', $request->getPathInfo()); + $this->assertEquals('bar=baz', $request->getQueryString()); + $this->assertEquals('test.com', $request->getHost()); + $this->assertEquals('test.com', $request->getHttpHost()); + $this->assertEquals(80, $request->getPort()); + $this->assertFalse($request->isSecure()); + + $request = Request::create('https://test.com:443/foo'); + $request->server->set('REQUEST_URI', 'https://test.com:443/foo'); + $this->assertEquals('https://test.com/foo', $request->getUri()); + $this->assertEquals('/foo', $request->getPathInfo()); + $this->assertEquals('test.com', $request->getHost()); + $this->assertEquals('test.com', $request->getHttpHost()); + $this->assertEquals(443, $request->getPort()); + $this->assertTrue($request->isSecure()); + + // Fragment should not be included in the URI + $request = Request::create('http://test.com/foo#bar'); + $request->server->set('REQUEST_URI', 'http://test.com/foo#bar'); + $this->assertEquals('http://test.com/foo', $request->getUri()); } public function testCreateCheckPrecedence() @@ -332,6 +381,9 @@ public function testGetFormatFromMimeTypeWithParameters() { $request = new Request(); $this->assertEquals('json', $request->getFormat('application/json; charset=utf-8')); + $this->assertEquals('json', $request->getFormat('application/json;charset=utf-8')); + $this->assertEquals('json', $request->getFormat('application/json ; charset=utf-8')); + $this->assertEquals('json', $request->getFormat('application/json ;charset=utf-8')); } /** @@ -848,6 +900,11 @@ public function testGetSetMethod() $request->setMethod('POST'); $request->headers->set('X-HTTP-METHOD-OVERRIDE', 'delete'); $this->assertEquals('DELETE', $request->getMethod(), '->getMethod() returns the method from X-HTTP-Method-Override if defined and POST'); + + $request = new Request(); + $request->setMethod('POST'); + $request->query->set('_method', array('delete', 'patch')); + $this->assertSame('POST', $request->getMethod(), '->getMethod() returns the request method if invalid type is defined in query'); } /** @@ -895,7 +952,7 @@ public function getClientIpsForwardedProvider() public function getClientIpsProvider() { - // $expected $remoteAddr $httpForwardedFor $trustedProxies + // $expected $remoteAddr $httpForwardedFor $trustedProxies return array( // simple IPv4 array(array('88.88.88.88'), '88.88.88.88', null, null), @@ -909,8 +966,8 @@ public function getClientIpsProvider() // forwarded for with remote IPv4 addr not trusted array(array('127.0.0.1'), '127.0.0.1', '88.88.88.88', null), - // forwarded for with remote IPv4 addr trusted - array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88', array('127.0.0.1')), + // forwarded for with remote IPv4 addr trusted + comma + array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88,', array('127.0.0.1')), // forwarded for with remote IPv4 and all FF addrs trusted array(array('88.88.88.88'), '127.0.0.1', '88.88.88.88', array('127.0.0.1', '88.88.88.88')), // forwarded for with remote IPv4 range trusted @@ -1014,7 +1071,7 @@ public function testGetClientIpsWithAgreeingHeaders($httpForwarded, $httpXForwar 'HTTP_X_FORWARDED_FOR' => $httpXForwardedFor, ); - Request::setTrustedProxies(array('88.88.88.88'), Request::HEADER_X_FORWARDED_ALL); + Request::setTrustedProxies(array('88.88.88.88'), -1); $request->initialize(array(), array(), array(), array(), array(), $server); @@ -1900,57 +1957,13 @@ public function iisRequestUriProvider() { return array( array( - array( - 'X_ORIGINAL_URL' => '/foo/bar', - ), - array(), - '/foo/bar', - ), - array( - array( - 'X_REWRITE_URL' => '/foo/bar', - ), array(), - '/foo/bar', - ), - array( - array(), - array( - 'IIS_WasUrlRewritten' => '1', - 'UNENCODED_URL' => '/foo/bar', - ), - '/foo/bar', - ), - array( - array( - 'X_ORIGINAL_URL' => '/foo/bar', - ), - array( - 'HTTP_X_ORIGINAL_URL' => '/foo/bar', - ), - '/foo/bar', - ), - array( - array( - 'X_ORIGINAL_URL' => '/foo/bar', - ), array( 'IIS_WasUrlRewritten' => '1', 'UNENCODED_URL' => '/foo/bar', ), '/foo/bar', ), - array( - array( - 'X_ORIGINAL_URL' => '/foo/bar', - ), - array( - 'HTTP_X_ORIGINAL_URL' => '/foo/bar', - 'IIS_WasUrlRewritten' => '1', - 'UNENCODED_URL' => '/foo/bar', - ), - '/foo/bar', - ), array( array(), array( @@ -2007,9 +2020,15 @@ public function testTrustedHosts() $request->headers->set('host', 'subdomain.trusted.com'); $this->assertEquals('subdomain.trusted.com', $request->getHost()); + } - // reset request for following tests - Request::setTrustedHosts(array()); + public function testSetTrustedHostsDoesNotBreakOnSpecialCharacters() + { + Request::setTrustedHosts(array('localhost(\.local){0,1}#,example.com', 'localhost')); + + $request = Request::create('/'); + $request->headers->set('host', 'localhost'); + $this->assertSame('localhost', $request->getHost()); } public function testFactory() @@ -2310,6 +2329,55 @@ public function testNonstandardRequests($requestUri, $queryString, $expectedPath $this->assertEquals($expectedBaseUrl, $request->getBaseUrl()); $this->assertEquals($expectedBasePath, $request->getBasePath()); } + + public function testTrustedHost() + { + Request::setTrustedProxies(array('1.1.1.1'), -1); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('Forwarded', 'host=localhost:8080'); + $request->headers->set('X-Forwarded-Host', 'localhost:8080'); + + $this->assertSame('localhost:8080', $request->getHttpHost()); + $this->assertSame(8080, $request->getPort()); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('Forwarded', 'host="[::1]:443"'); + $request->headers->set('X-Forwarded-Host', '[::1]:443'); + $request->headers->set('X-Forwarded-Port', 443); + + $this->assertSame('[::1]:443', $request->getHttpHost()); + $this->assertSame(443, $request->getPort()); + } + + public function testTrustedPort() + { + Request::setTrustedProxies(array('1.1.1.1'), -1); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('Forwarded', 'host=localhost:8080'); + $request->headers->set('X-Forwarded-Port', 8080); + + $this->assertSame(8080, $request->getPort()); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('Forwarded', 'host=localhost'); + $request->headers->set('X-Forwarded-Port', 80); + + $this->assertSame(80, $request->getPort()); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '1.1.1.1'); + $request->headers->set('Forwarded', 'host="[::1]"'); + $request->headers->set('X-Forwarded-Proto', 'https'); + $request->headers->set('X-Forwarded-Port', 443); + + $this->assertSame(443, $request->getPort()); + } } class RequestContentProxy extends Request diff --git a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php b/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php index 7b5e720af..06e2d41d0 100644 --- a/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php +++ b/vendor/symfony/http-foundation/Tests/ResponseHeaderBagTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\HttpFoundation\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\ResponseHeaderBag; use Symfony\Component\HttpFoundation\Cookie; +use Symfony\Component\HttpFoundation\ResponseHeaderBag; /** * @group time-sensitive diff --git a/vendor/symfony/http-foundation/Tests/ResponseTest.php b/vendor/symfony/http-foundation/Tests/ResponseTest.php index 350d972a9..43fa9b70a 100644 --- a/vendor/symfony/http-foundation/Tests/ResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/ResponseTest.php @@ -126,7 +126,7 @@ public function testMustRevalidateWithProxyRevalidateCacheControlHeader() public function testSetNotModified() { - $response = new Response(); + $response = new Response('foo'); $modified = $response->setNotModified(); $this->assertObjectHasAttribute('headers', $modified); $this->assertObjectHasAttribute('content', $modified); @@ -135,6 +135,11 @@ public function testSetNotModified() $this->assertObjectHasAttribute('statusText', $modified); $this->assertObjectHasAttribute('charset', $modified); $this->assertEquals(304, $modified->getStatusCode()); + + ob_start(); + $modified->sendContent(); + $string = ob_get_clean(); + $this->assertEmpty($string); } public function testIsSuccessful() @@ -357,6 +362,11 @@ public function testExpire() $response->headers->set('Expires', -1); $response->expire(); $this->assertNull($response->headers->get('Age'), '->expire() does not set the Age when the response is expired'); + + $response = new Response(); + $response->headers->set('Expires', date(DATE_RFC2822, time() + 600)); + $response->expire(); + $this->assertNull($response->headers->get('Expires'), '->expire() removes the Expires header when the response is fresh'); } public function testGetTtl() @@ -926,7 +936,7 @@ protected function provideResponse() */ public function ianaCodesReasonPhrasesProvider() { - if (!in_array('https', stream_get_wrappers(), true)) { + if (!\in_array('https', stream_get_wrappers(), true)) { $this->markTestSkipped('The "https" wrapper is not available'); } @@ -954,7 +964,7 @@ public function ianaCodesReasonPhrasesProvider() $value = $xpath->query('.//ns:value', $record)->item(0)->nodeValue; $description = $xpath->query('.//ns:description', $record)->item(0)->nodeValue; - if (in_array($description, array('Unassigned', '(Unused)'), true)) { + if (\in_array($description, array('Unassigned', '(Unused)'), true)) { continue; } diff --git a/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php index 724a0b984..43644e23e 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Attribute/AttributeBagTest.php @@ -176,11 +176,11 @@ public function testGetIterator() ++$i; } - $this->assertEquals(count($this->array), $i); + $this->assertEquals(\count($this->array), $i); } public function testCount() { - $this->assertCount(count($this->array), $this->bag); + $this->assertCount(\count($this->array), $this->bag); } } diff --git a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php index f074ce1b2..ec4cd5ad1 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Attribute/NamespacedAttributeBagTest.php @@ -82,6 +82,17 @@ public function testHas($key, $value, $exists) $this->assertEquals($exists, $this->bag->has($key)); } + /** + * @dataProvider attributesProvider + */ + public function testHasNoSideEffect($key, $value, $expected) + { + $expected = json_encode($this->bag->all()); + $this->bag->has($key); + + $this->assertEquals($expected, json_encode($this->bag->all())); + } + /** * @dataProvider attributesProvider */ @@ -96,6 +107,17 @@ public function testGetDefaults() $this->assertEquals('default', $this->bag->get('user2.login', 'default')); } + /** + * @dataProvider attributesProvider + */ + public function testGetNoSideEffect($key, $value, $expected) + { + $expected = json_encode($this->bag->all()); + $this->bag->get($key); + + $this->assertEquals($expected, json_encode($this->bag->all())); + } + /** * @dataProvider attributesProvider */ diff --git a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php b/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php index c4e75b1b1..905a1f751 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Flash/FlashBagTest.php @@ -74,6 +74,18 @@ public function testPeek() $this->assertEquals(array('A previous flash message'), $this->bag->peek('notice')); } + public function testAdd() + { + $tab = array('bar' => 'baz'); + $this->bag->add('string_message', 'lorem'); + $this->bag->add('object_message', new \stdClass()); + $this->bag->add('array_message', $tab); + + $this->assertEquals(array('lorem'), $this->bag->get('string_message')); + $this->assertEquals(array(new \stdClass()), $this->bag->get('object_message')); + $this->assertEquals(array($tab), $this->bag->get('array_message')); + } + public function testGet() { $this->assertEquals(array(), $this->bag->get('non_existing')); @@ -112,6 +124,19 @@ public function testKeys() $this->assertEquals(array('notice'), $this->bag->keys()); } + public function testSetAll() + { + $this->bag->add('one_flash', 'Foo'); + $this->bag->add('another_flash', 'Bar'); + $this->assertTrue($this->bag->has('one_flash')); + $this->assertTrue($this->bag->has('another_flash')); + $this->bag->setAll(array('unique_flash' => 'FooBar')); + $this->assertFalse($this->bag->has('one_flash')); + $this->assertFalse($this->bag->has('another_flash')); + $this->assertSame(array('unique_flash' => 'FooBar'), $this->bag->all()); + $this->assertSame(array(), $this->bag->all()); + } + public function testPeekAll() { $this->bag->set('notice', 'Foo'); diff --git a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php index 41720e4b6..63351e575 100644 --- a/vendor/symfony/http-foundation/Tests/Session/SessionTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/SessionTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\HttpFoundation\Tests\Session; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Session; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; +use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; +use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; /** @@ -70,6 +70,27 @@ public function testSetId() $this->assertEquals('0123456789abcdef', $this->session->getId()); } + public function testSetIdAfterStart() + { + $this->session->start(); + $id = $this->session->getId(); + + $e = null; + try { + $this->session->setId($id); + } catch (\Exception $e) { + } + + $this->assertNull($e); + + try { + $this->session->setId('different'); + } catch (\Exception $e) { + } + + $this->assertInstanceOf('\LogicException', $e); + } + public function testSetName() { $this->assertEquals('MOCKSESSID', $this->session->getName()); @@ -206,7 +227,7 @@ public function testGetIterator() ++$i; } - $this->assertEquals(count($attributes), $i); + $this->assertEquals(\count($attributes), $i); } public function testGetCount() diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php index dda43c805..d3d31762a 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcacheSessionHandlerTest.php @@ -33,7 +33,7 @@ class MemcacheSessionHandlerTest extends TestCase protected function setUp() { - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcache class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php index 2e7be359e..2a1148010 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MemcachedSessionHandlerTest.php @@ -32,7 +32,7 @@ class MemcachedSessionHandlerTest extends TestCase protected function setUp() { - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $this->markTestSkipped('PHPUnit_MockObject cannot mock the Memcached class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php index da051096c..186fc0a2d 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/MongoDbSessionHandlerTest.php @@ -32,11 +32,11 @@ protected function setUp() { parent::setUp(); - if (extension_loaded('mongodb')) { + if (\extension_loaded('mongodb')) { if (!class_exists('MongoDB\Client')) { $this->markTestSkipped('The mongodb/mongodb package is required.'); } - } elseif (!extension_loaded('mongo')) { + } elseif (!\extension_loaded('mongo')) { $this->markTestSkipped('The Mongo or MongoDB extension is required.'); } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php index 718fd0f83..9a2212b8b 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/NullSessionHandlerTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage\Handler; use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler; use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage; -use Symfony\Component\HttpFoundation\Session\Session; /** * Test class for NullSessionHandler. diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php index 0a0e44905..853e96d28 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Handler/PdoSessionHandlerTest.php @@ -136,7 +136,7 @@ public function testReadWriteReadWithNullByte() public function testReadConvertsStreamToString() { - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); } @@ -157,10 +157,10 @@ public function testReadConvertsStreamToString() public function testReadLockedConvertsStreamToString() { - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $this->markTestSkipped('PHPUnit_MockObject cannot mock the PDOStatement class on HHVM. See https://github.com/sebastianbergmann/phpunit-mock-objects/pull/289'); } - if (ini_get('session.use_strict_mode')) { + if (filter_var(ini_get('session.use_strict_mode'), FILTER_VALIDATE_BOOLEAN)) { $this->markTestSkipped('Strict mode needs no locking for new sessions.'); } @@ -396,8 +396,8 @@ public function getAttribute($attribute) public function prepare($statement, $driverOptions = array()) { - return is_callable($this->prepareResult) - ? call_user_func($this->prepareResult, $statement, $driverOptions) + return \is_callable($this->prepareResult) + ? \call_user_func($this->prepareResult, $statement, $driverOptions) : $this->prepareResult; } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php index 82df5543e..893e120ce 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/MockArraySessionStorageTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; +use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; /** * Test class for MockArraySessionStorage. @@ -48,7 +48,7 @@ protected function setUp() $this->data = array( $this->attributes->getStorageKey() => array('foo' => 'bar'), $this->flashes->getStorageKey() => array('notice' => 'hello'), - ); + ); $this->storage = new MockArraySessionStorage(); $this->storage->registerBag($this->flashes); diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php index 53accd384..169579817 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/MockFileSessionStorageTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage; -use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; +use Symfony\Component\HttpFoundation\Session\Flash\FlashBag; +use Symfony\Component\HttpFoundation\Session\Storage\MockFileSessionStorage; /** * Test class for MockFileSessionStorage. diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php index 382707b0c..52da2947c 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/NativeSessionStorageTest.php @@ -184,7 +184,7 @@ public function testCookieOptions() public function testSessionOptions() { - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $this->markTestSkipped('HHVM is not handled in this test case.'); } diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php index 958dc0bc0..7cb63c5aa 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/PhpBridgeSessionStorageTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\HttpFoundation\Tests\Session\Storage; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage; use Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag; +use Symfony\Component\HttpFoundation\Session\Storage\PhpBridgeSessionStorage; /** * Test class for PhpSessionStorage. diff --git a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php index 682825356..0b48250e0 100644 --- a/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php +++ b/vendor/symfony/http-foundation/Tests/Session/Storage/Proxy/SessionHandlerProxyTest.php @@ -121,4 +121,37 @@ public function testGc() $this->proxy->gc(86400); } + + /** + * @requires PHPUnit 5.1 + */ + public function testValidateId() + { + $mock = $this->getMockBuilder(array('SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'))->getMock(); + $mock->expects($this->once()) + ->method('validateId'); + + $proxy = new SessionHandlerProxy($mock); + $proxy->validateId('id'); + + $this->assertTrue($this->proxy->validateId('id')); + } + + /** + * @requires PHPUnit 5.1 + */ + public function testUpdateTimestamp() + { + $mock = $this->getMockBuilder(array('SessionHandlerInterface', 'SessionUpdateTimestampHandlerInterface'))->getMock(); + $mock->expects($this->once()) + ->method('updateTimestamp'); + + $proxy = new SessionHandlerProxy($mock); + $proxy->updateTimestamp('id', 'data'); + + $this->mock->expects($this->once()) + ->method('write'); + + $this->proxy->updateTimestamp('id', 'data'); + } } diff --git a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php b/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php index c2ded996f..699222e37 100644 --- a/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php +++ b/vendor/symfony/http-foundation/Tests/StreamedResponseTest.php @@ -123,4 +123,22 @@ public function testReturnThis() $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders()); $this->assertInstanceOf('Symfony\Component\HttpFoundation\StreamedResponse', $response->sendHeaders()); } + + public function testSetNotModified() + { + $response = new StreamedResponse(function () { echo 'foo'; }); + $modified = $response->setNotModified(); + $this->assertObjectHasAttribute('headers', $modified); + $this->assertObjectHasAttribute('content', $modified); + $this->assertObjectHasAttribute('version', $modified); + $this->assertObjectHasAttribute('statusCode', $modified); + $this->assertObjectHasAttribute('statusText', $modified); + $this->assertObjectHasAttribute('charset', $modified); + $this->assertEquals(304, $modified->getStatusCode()); + + ob_start(); + $modified->sendContent(); + $string = ob_get_clean(); + $this->assertEmpty($string); + } } diff --git a/vendor/symfony/http-foundation/phpunit.xml.dist b/vendor/symfony/http-foundation/phpunit.xml.dist index c1d61f8bf..f57bc9e62 100644 --- a/vendor/symfony/http-foundation/phpunit.xml.dist +++ b/vendor/symfony/http-foundation/phpunit.xml.dist @@ -1,7 +1,7 @@ getAlias()) { - throw new \LogicException(sprintf( - 'Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', - $expectedAlias, $extension->getAlias() - )); + throw new \LogicException(sprintf('Users will expect the alias of the default extension of a bundle to be the underscored version of the bundle name ("%s"). You can override "Bundle::getContainerExtension()" if you want to use "%s" or another alias.', $expectedAlias, $extension->getAlias())); } $this->extension = $extension; @@ -99,9 +94,7 @@ public function getContainerExtension() } /** - * Gets the Bundle namespace. - * - * @return string The Bundle namespace + * {@inheritdoc} */ public function getNamespace() { @@ -113,33 +106,27 @@ public function getNamespace() } /** - * Gets the Bundle directory path. - * - * @return string The Bundle absolute path + * {@inheritdoc} */ public function getPath() { if (null === $this->path) { $reflected = new \ReflectionObject($this); - $this->path = dirname($reflected->getFileName()); + $this->path = \dirname($reflected->getFileName()); } return $this->path; } /** - * Returns the bundle parent name. - * - * @return string|null The Bundle parent name it overrides or null if no parent + * {@inheritdoc} */ public function getParent() { } /** - * Returns the bundle name (the class short name). - * - * @return string The Bundle name + * {@inheritdoc} */ final public function getName() { diff --git a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmer.php b/vendor/symfony/http-kernel/CacheWarmer/CacheWarmer.php index dba35a639..52dc2ad2c 100644 --- a/vendor/symfony/http-kernel/CacheWarmer/CacheWarmer.php +++ b/vendor/symfony/http-kernel/CacheWarmer/CacheWarmer.php @@ -20,7 +20,7 @@ abstract class CacheWarmer implements CacheWarmerInterface { protected function writeCacheFile($file, $content) { - $tmpFile = @tempnam(dirname($file), basename($file)); + $tmpFile = @tempnam(\dirname($file), basename($file)); if (false !== @file_put_contents($tmpFile, $content) && @rename($tmpFile, $file)) { @chmod($file, 0666 & ~umask()); diff --git a/vendor/symfony/http-kernel/Client.php b/vendor/symfony/http-kernel/Client.php index 7979722d1..324710bb8 100644 --- a/vendor/symfony/http-kernel/Client.php +++ b/vendor/symfony/http-kernel/Client.php @@ -12,10 +12,10 @@ namespace Symfony\Component\HttpKernel; use Symfony\Component\BrowserKit\Client as BaseClient; +use Symfony\Component\BrowserKit\CookieJar; +use Symfony\Component\BrowserKit\History; use Symfony\Component\BrowserKit\Request as DomRequest; use Symfony\Component\BrowserKit\Response as DomResponse; -use Symfony\Component\BrowserKit\History; -use Symfony\Component\BrowserKit\CookieJar; use Symfony\Component\HttpFoundation\File\UploadedFile; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; @@ -81,17 +81,18 @@ protected function doRequest($request) */ protected function getScript($request) { - $kernel = str_replace("'", "\\'", serialize($this->kernel)); - $request = str_replace("'", "\\'", serialize($request)); + $kernel = var_export(serialize($this->kernel), true); + $request = var_export(serialize($request), true); + $errorReporting = error_reporting(); $requires = ''; foreach (get_declared_classes() as $class) { if (0 === strpos($class, 'ComposerAutoloaderInit')) { $r = new \ReflectionClass($class); - $file = dirname(dirname($r->getFileName())).'/autoload.php'; + $file = \dirname(\dirname($r->getFileName())).'/autoload.php'; if (file_exists($file)) { - $requires .= "require_once '".str_replace("'", "\\'", $file)."';\n"; + $requires .= 'require_once '.var_export($file, true).";\n"; } } } @@ -107,8 +108,8 @@ protected function getScript($request) $requires -\$kernel = unserialize('$kernel'); -\$request = unserialize('$request'); +\$kernel = unserialize($kernel); +\$request = unserialize($request); EOF; return $code.$this->getHandleScript(); @@ -160,7 +161,7 @@ protected function filterFiles(array $files) { $filtered = array(); foreach ($files as $key => $value) { - if (is_array($value)) { + if (\is_array($value)) { $filtered[$key] = $this->filterFiles($value); } elseif ($value instanceof UploadedFile) { if ($value->isValid() && $value->getSize() > UploadedFile::getMaxFilesize()) { diff --git a/vendor/symfony/http-kernel/Config/FileLocator.php b/vendor/symfony/http-kernel/Config/FileLocator.php index fb1f913bd..c047ba3da 100644 --- a/vendor/symfony/http-kernel/Config/FileLocator.php +++ b/vendor/symfony/http-kernel/Config/FileLocator.php @@ -26,7 +26,7 @@ class FileLocator extends BaseFileLocator /** * @param KernelInterface $kernel A KernelInterface instance - * @param null|string $path The path the global resource directory + * @param string|null $path The path the global resource directory * @param array $paths An array of paths where to look for resources */ public function __construct(KernelInterface $kernel, $path = null, array $paths = array()) diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver.php index 2c17125c5..fc316920c 100644 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver.php +++ b/vendor/symfony/http-kernel/Controller/ArgumentResolver.php @@ -56,7 +56,7 @@ public function getArguments(Request $request, $controller) $resolved = $resolver->resolve($request, $metadata); if (!$resolved instanceof \Generator) { - throw new \InvalidArgumentException(sprintf('%s::resolve() must yield at least one value.', get_class($resolver))); + throw new \InvalidArgumentException(sprintf('%s::resolve() must yield at least one value.', \get_class($resolver))); } foreach ($resolved as $append) { @@ -69,10 +69,10 @@ public function getArguments(Request $request, $controller) $representative = $controller; - if (is_array($representative)) { - $representative = sprintf('%s::%s()', get_class($representative[0]), $representative[1]); - } elseif (is_object($representative)) { - $representative = get_class($representative); + if (\is_array($representative)) { + $representative = sprintf('%s::%s()', \get_class($representative[0]), $representative[1]); + } elseif (\is_object($representative)) { + $representative = \get_class($representative); } throw new \RuntimeException(sprintf('Controller "%s" requires that you provide a value for the "$%s" argument. Either the argument is nullable and no null value has been provided, no default value has been provided or because there is a non optional argument after this one.', $representative, $metadata->getName())); diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php index 7bc195f23..3294ec862 100644 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php +++ b/vendor/symfony/http-kernel/Controller/ArgumentResolver/ServiceValueResolver.php @@ -47,6 +47,10 @@ public function supports(Request $request, ArgumentMetadata $argument) $controller = ltrim($controller, '\\'); } + if (!$this->container->has($controller) && false !== $i = strrpos($controller, ':')) { + $controller = substr($controller, 0, $i).strtolower(substr($controller, $i)); + } + return $this->container->has($controller) && $this->container->get($controller)->has($argument->getName()); } @@ -63,6 +67,11 @@ public function resolve(Request $request, ArgumentMetadata $argument) $controller = ltrim($controller, '\\'); } + if (!$this->container->has($controller)) { + $i = strrpos($controller, ':'); + $controller = substr($controller, 0, $i).strtolower(substr($controller, $i)); + } + yield $this->container->get($controller)->get($argument->getName()); } } diff --git a/vendor/symfony/http-kernel/Controller/ArgumentResolver/VariadicValueResolver.php b/vendor/symfony/http-kernel/Controller/ArgumentResolver/VariadicValueResolver.php index 56ae5f191..7ee2d7af5 100644 --- a/vendor/symfony/http-kernel/Controller/ArgumentResolver/VariadicValueResolver.php +++ b/vendor/symfony/http-kernel/Controller/ArgumentResolver/VariadicValueResolver.php @@ -37,8 +37,8 @@ public function resolve(Request $request, ArgumentMetadata $argument) { $values = $request->attributes->get($argument->getName()); - if (!is_array($values)) { - throw new \InvalidArgumentException(sprintf('The action argument "...$%1$s" is required to be an array, the request attribute "%1$s" contains a type of "%2$s" instead.', $argument->getName(), gettype($values))); + if (!\is_array($values)) { + throw new \InvalidArgumentException(sprintf('The action argument "...$%1$s" is required to be an array, the request attribute "%1$s" contains a type of "%2$s" instead.', $argument->getName(), \gettype($values))); } foreach ($values as $value) { diff --git a/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php b/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php index 186583d7b..bc53e94be 100644 --- a/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php +++ b/vendor/symfony/http-kernel/Controller/ContainerControllerResolver.php @@ -40,7 +40,7 @@ public function getController(Request $request) { $controller = parent::getController($request); - if (is_array($controller) && isset($controller[0]) && is_string($controller[0]) && $this->container->has($controller[0])) { + if (\is_array($controller) && isset($controller[0]) && \is_string($controller[0]) && $this->container->has($controller[0])) { $controller[0] = $this->instantiateController($controller[0]); } diff --git a/vendor/symfony/http-kernel/Controller/ControllerResolver.php b/vendor/symfony/http-kernel/Controller/ControllerResolver.php index b9d9f9fa2..6d898e783 100644 --- a/vendor/symfony/http-kernel/Controller/ControllerResolver.php +++ b/vendor/symfony/http-kernel/Controller/ControllerResolver.php @@ -65,29 +65,29 @@ public function getController(Request $request) return false; } - if (is_array($controller)) { + if (\is_array($controller)) { return $controller; } - if (is_object($controller)) { + if (\is_object($controller)) { if (method_exists($controller, '__invoke')) { return $controller; } - throw new \InvalidArgumentException(sprintf('Controller "%s" for URI "%s" is not callable.', get_class($controller), $request->getPathInfo())); + throw new \InvalidArgumentException(sprintf('Controller "%s" for URI "%s" is not callable.', \get_class($controller), $request->getPathInfo())); } if (false === strpos($controller, ':')) { if (method_exists($controller, '__invoke')) { return $this->instantiateController($controller); - } elseif (function_exists($controller)) { + } elseif (\function_exists($controller)) { return $controller; } } $callable = $this->createController($controller); - if (!is_callable($callable)) { + if (!\is_callable($callable)) { throw new \InvalidArgumentException(sprintf('The controller for URI "%s" is not callable. %s', $request->getPathInfo(), $this->getControllerError($callable))); } @@ -101,11 +101,11 @@ public function getController(Request $request) */ public function getArguments(Request $request, $controller) { - @trigger_error(sprintf('%s is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED); - if (is_array($controller)) { + if (\is_array($controller)) { $r = new \ReflectionMethod($controller[0], $controller[1]); - } elseif (is_object($controller) && !$controller instanceof \Closure) { + } elseif (\is_object($controller) && !$controller instanceof \Closure) { $r = new \ReflectionObject($controller); $r = $r->getMethod('__invoke'); } else { @@ -126,13 +126,13 @@ public function getArguments(Request $request, $controller) */ protected function doGetArguments(Request $request, $controller, array $parameters) { - @trigger_error(sprintf('%s is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Implement the %s and inject it in the HttpKernel instead.', __METHOD__, ArgumentResolverInterface::class), E_USER_DEPRECATED); $attributes = $request->attributes->all(); $arguments = array(); foreach ($parameters as $param) { if (array_key_exists($param->name, $attributes)) { - if ($this->supportsVariadic && $param->isVariadic() && is_array($attributes[$param->name])) { + if ($this->supportsVariadic && $param->isVariadic() && \is_array($attributes[$param->name])) { $arguments = array_merge($arguments, array_values($attributes[$param->name])); } else { $arguments[] = $attributes[$param->name]; @@ -144,10 +144,10 @@ protected function doGetArguments(Request $request, $controller, array $paramete } elseif ($this->supportsScalarTypes && $param->hasType() && $param->allowsNull()) { $arguments[] = null; } else { - if (is_array($controller)) { - $repr = sprintf('%s::%s()', get_class($controller[0]), $controller[1]); - } elseif (is_object($controller)) { - $repr = get_class($controller); + if (\is_array($controller)) { + $repr = sprintf('%s::%s()', \get_class($controller[0]), $controller[1]); + } elseif (\is_object($controller)) { + $repr = \get_class($controller); } else { $repr = $controller; } @@ -197,7 +197,7 @@ protected function instantiateController($class) private function getControllerError($callable) { - if (is_string($callable)) { + if (\is_string($callable)) { if (false !== strpos($callable, '::')) { $callable = explode('::', $callable); } @@ -206,26 +206,26 @@ private function getControllerError($callable) return sprintf('Class "%s" does not have a method "__invoke".', $callable); } - if (!function_exists($callable)) { + if (!\function_exists($callable)) { return sprintf('Function "%s" does not exist.', $callable); } } - if (!is_array($callable)) { - return sprintf('Invalid type for controller given, expected string or array, got "%s".', gettype($callable)); + if (!\is_array($callable)) { + return sprintf('Invalid type for controller given, expected string or array, got "%s".', \gettype($callable)); } - if (2 !== count($callable)) { + if (2 !== \count($callable)) { return 'Invalid format for controller, expected array(controller, method) or controller::method.'; } list($controller, $method) = $callable; - if (is_string($controller) && !class_exists($controller)) { + if (\is_string($controller) && !class_exists($controller)) { return sprintf('Class "%s" does not exist.', $controller); } - $className = is_object($controller) ? get_class($controller) : $controller; + $className = \is_object($controller) ? \get_class($controller) : $controller; if (method_exists($controller, $method)) { return sprintf('Method "%s" on class "%s" should be public and non-abstract.', $method, $className); @@ -238,7 +238,7 @@ private function getControllerError($callable) foreach ($collection as $item) { $lev = levenshtein($method, $item); - if ($lev <= strlen($method) / 3 || false !== strpos($item, $method)) { + if ($lev <= \strlen($method) / 3 || false !== strpos($item, $method)) { $alternatives[] = $item; } } @@ -247,7 +247,7 @@ private function getControllerError($callable) $message = sprintf('Expected method "%s" on class "%s"', $method, $className); - if (count($alternatives) > 0) { + if (\count($alternatives) > 0) { $message .= sprintf(', did you mean "%s"?', implode('", "', $alternatives)); } else { $message .= sprintf('. Available methods: "%s".', implode('", "', $collection)); diff --git a/vendor/symfony/http-kernel/Controller/TraceableArgumentResolver.php b/vendor/symfony/http-kernel/Controller/TraceableArgumentResolver.php index 6fb0fa66a..39848127b 100644 --- a/vendor/symfony/http-kernel/Controller/TraceableArgumentResolver.php +++ b/vendor/symfony/http-kernel/Controller/TraceableArgumentResolver.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpKernel\Controller; -use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Stopwatch\Stopwatch; /** * @author Fabien Potencier diff --git a/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php b/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php index 750107714..6f39f81d2 100644 --- a/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php +++ b/vendor/symfony/http-kernel/Controller/TraceableControllerResolver.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpKernel\Controller; -use Symfony\Component\Stopwatch\Stopwatch; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Stopwatch\Stopwatch; /** * @author Fabien Potencier @@ -60,7 +60,7 @@ public function getController(Request $request) */ public function getArguments(Request $request, $controller) { - @trigger_error(sprintf('The %s method is deprecated as of 3.1 and will be removed in 4.0. Please use the %s instead.', __METHOD__, TraceableArgumentResolver::class), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.1 and will be removed in 4.0. Please use the %s instead.', __METHOD__, TraceableArgumentResolver::class), E_USER_DEPRECATED); $ret = $this->argumentResolver->getArguments($request, $controller); diff --git a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php b/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php index d1e7af206..b46be7e8b 100644 --- a/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php +++ b/vendor/symfony/http-kernel/ControllerMetadata/ArgumentMetadataFactory.php @@ -49,16 +49,16 @@ public function createArgumentMetadata($controller) { $arguments = array(); - if (is_array($controller)) { + if (\is_array($controller)) { $reflection = new \ReflectionMethod($controller[0], $controller[1]); - } elseif (is_object($controller) && !$controller instanceof \Closure) { + } elseif (\is_object($controller) && !$controller instanceof \Closure) { $reflection = (new \ReflectionObject($controller))->getMethod('__invoke'); } else { $reflection = new \ReflectionFunction($controller); } foreach ($reflection->getParameters() as $param) { - $arguments[] = new ArgumentMetadata($param->getName(), $this->getType($param), $this->isVariadic($param), $this->hasDefaultValue($param), $this->getDefaultValue($param), $param->allowsNull()); + $arguments[] = new ArgumentMetadata($param->getName(), $this->getType($param, $reflection), $this->isVariadic($param), $this->hasDefaultValue($param), $this->getDefaultValue($param), $param->allowsNull()); } return $arguments; @@ -105,25 +105,37 @@ private function getDefaultValue(\ReflectionParameter $parameter) * * @param \ReflectionParameter $parameter * - * @return null|string + * @return string|null */ - private function getType(\ReflectionParameter $parameter) + private function getType(\ReflectionParameter $parameter, \ReflectionFunctionAbstract $function) { if ($this->supportsParameterType) { if (!$type = $parameter->getType()) { return; } - $typeName = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString(); - if ('array' === $typeName && !$type->isBuiltin()) { + $name = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString(); + if ('array' === $name && !$type->isBuiltin()) { // Special case for HHVM with variadics return; } - - return $typeName; + } elseif (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $parameter, $name)) { + $name = $name[1]; + } else { + return; } + $lcName = strtolower($name); - if (preg_match('/^(?:[^ ]++ ){4}([a-zA-Z_\x7F-\xFF][^ ]++)/', $parameter, $info)) { - return $info[1]; + if ('self' !== $lcName && 'parent' !== $lcName) { + return $name; + } + if (!$function instanceof \ReflectionMethod) { + return; + } + if ('self' === $lcName) { + return $function->getDeclaringClass()->name; + } + if ($parent = $function->getDeclaringClass()->getParentClass()) { + return $parent->name; } } } diff --git a/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php b/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php index 5675f0736..abfd939f5 100644 --- a/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/ConfigDataCollector.php @@ -11,10 +11,10 @@ namespace Symfony\Component\HttpKernel\DataCollector; -use Symfony\Component\HttpKernel\KernelInterface; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Kernel; +use Symfony\Component\HttpKernel\KernelInterface; use Symfony\Component\VarDumper\Caster\LinkStub; /** @@ -67,11 +67,11 @@ public function collect(Request $request, Response $response, \Exception $except 'php_architecture' => PHP_INT_SIZE * 8, 'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', 'php_timezone' => date_default_timezone_get(), - 'xdebug_enabled' => extension_loaded('xdebug'), - 'apcu_enabled' => extension_loaded('apcu') && ini_get('apc.enabled'), - 'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'), + 'xdebug_enabled' => \extension_loaded('xdebug'), + 'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN), + 'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN), 'bundles' => array(), - 'sapi_name' => PHP_SAPI, + 'sapi_name' => \PHP_SAPI, ); if (isset($this->kernel)) { diff --git a/vendor/symfony/http-kernel/DataCollector/DataCollector.php b/vendor/symfony/http-kernel/DataCollector/DataCollector.php index 30887ab91..6d1a822e4 100644 --- a/vendor/symfony/http-kernel/DataCollector/DataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/DataCollector.php @@ -115,7 +115,7 @@ protected function getCasters() '*' => function ($v, array $a, Stub $s, $isNested) { if (!$v instanceof Stub) { foreach ($a as $k => $v) { - if (is_object($v) && !$v instanceof \DateTimeInterface && !$v instanceof Stub) { + if (\is_object($v) && !$v instanceof \DateTimeInterface && !$v instanceof Stub) { $a[$k] = new CutStub($v); } } diff --git a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php index 27a9a8252..7e2430c4b 100644 --- a/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/DumpDataCollector.php @@ -18,8 +18,8 @@ use Symfony\Component\VarDumper\Cloner\Data; use Symfony\Component\VarDumper\Cloner\VarCloner; use Symfony\Component\VarDumper\Dumper\CliDumper; -use Symfony\Component\VarDumper\Dumper\HtmlDumper; use Symfony\Component\VarDumper\Dumper\DataDumperInterface; +use Symfony\Component\VarDumper\Dumper\HtmlDumper; use Twig\Template; /** @@ -105,7 +105,7 @@ public function dump(Data $data) $src = explode("\n", $src); $fileExcerpt = array(); - for ($i = max($line - 3, 1), $max = min($line + 3, count($src)); $i <= $max; ++$i) { + for ($i = max($line - 3, 1), $max = min($line + 3, \count($src)); $i <= $max; ++$i) { $fileExcerpt[] = ''.$this->htmlEncode($src[$i - 1]).''; } @@ -171,7 +171,7 @@ public function reset() } $this->data = array(); $this->dataCount = 0; - $this->isCollected = false; + $this->isCollected = true; $this->clonesCount = 0; $this->clonesIndex = 0; } @@ -200,7 +200,7 @@ public function unserialize($data) parent::unserialize($data); $charset = array_pop($this->data); $fileLinkFormat = array_pop($this->data); - $this->dataCount = count($this->data); + $this->dataCount = \count($this->data); self::__construct($this->stopwatch, $fileLinkFormat, $charset); } @@ -244,13 +244,13 @@ public function __destruct() $this->isCollected = true; $h = headers_list(); - $i = count($h); + $i = \count($h); array_unshift($h, 'Content-Type: '.ini_get('default_mimetype')); while (0 !== stripos($h[$i], 'Content-Type:')) { --$i; } - if (!\in_array(PHP_SAPI, array('cli', 'phpdbg'), true) && stripos($h[$i], 'html')) { + if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true) && stripos($h[$i], 'html')) { $this->dumper = new HtmlDumper('php://output', $this->charset); $this->dumper->setDisplayOptions(array('fileLinkFormat' => $this->fileLinkFormat)); } else { @@ -276,7 +276,7 @@ private function doDump($data, $name, $file, $line) $s = $this->style('meta', '%s'); $f = strip_tags($this->style('', $file)); $name = strip_tags($this->style('', $name)); - if ($fmt && $link = is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line)) { + if ($fmt && $link = \is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line)) { $name = sprintf(''.$s.'', strip_tags($this->style('', $link)), $f, $name); } else { $name = sprintf(''.$s.'', $f, $name); diff --git a/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php b/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php index 0a095ab68..81076fd72 100644 --- a/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/EventDataCollector.php @@ -11,10 +11,10 @@ namespace Symfony\Component\HttpKernel\DataCollector; +use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; -use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcherInterface; /** * EventDataCollector. diff --git a/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php b/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php index 03bfa5d84..97b8a8620 100644 --- a/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/LoggerDataCollector.php @@ -222,7 +222,7 @@ private function isSilencedOrDeprecationErrorLog(array $log) return true; } - if ($exception instanceof \ErrorException && in_array($exception->getSeverity(), array(E_DEPRECATED, E_USER_DEPRECATED), true)) { + if ($exception instanceof \ErrorException && \in_array($exception->getSeverity(), array(E_DEPRECATED, E_USER_DEPRECATED), true)) { return true; } diff --git a/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php b/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php index 8d8cc1a04..310b2f91a 100644 --- a/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/MemoryDataCollector.php @@ -98,9 +98,9 @@ private function convertToBytes($memoryLimit) $memoryLimit = strtolower($memoryLimit); $max = strtolower(ltrim($memoryLimit, '+')); if (0 === strpos($max, '0x')) { - $max = intval($max, 16); + $max = \intval($max, 16); } elseif (0 === strpos($max, '0')) { - $max = intval($max, 8); + $max = \intval($max, 8); } else { $max = (int) $max; } diff --git a/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php b/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php index 54d17d28c..10492e446 100644 --- a/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/RequestDataCollector.php @@ -11,14 +11,14 @@ namespace Symfony\Component\HttpKernel\DataCollector; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * @author Fabien Potencier @@ -42,7 +42,7 @@ public function collect(Request $request, Response $response, \Exception $except $route = ''; foreach ($request->attributes->all() as $key => $value) { if ('_route' === $key) { - $route = is_object($value) ? $value->getPath() : $value; + $route = \is_object($value) ? $value->getPath() : $value; $attributes[$key] = $route; } else { $attributes[$key] = $value; @@ -116,7 +116,7 @@ public function collect(Request $request, Response $response, \Exception $except } foreach ($this->data as $key => $value) { - if (!is_array($value)) { + if (!\is_array($value)) { continue; } if ('request_headers' === $key || 'response_headers' === $key) { @@ -149,7 +149,7 @@ public function collect(Request $request, Response $response, \Exception $except )); } - $this->data['identifier'] = $this->data['route'] ?: (is_array($this->data['controller']) ? $this->data['controller']['class'].'::'.$this->data['controller']['method'].'()' : $this->data['controller']); + $this->data['identifier'] = $this->data['route'] ?: (\is_array($this->data['controller']) ? $this->data['controller']['class'].'::'.$this->data['controller']['method'].'()' : $this->data['controller']); } public function lateCollect() @@ -350,25 +350,25 @@ public function getName() */ protected function parseController($controller) { - if (is_string($controller) && false !== strpos($controller, '::')) { + if (\is_string($controller) && false !== strpos($controller, '::')) { $controller = explode('::', $controller); } - if (is_array($controller)) { + if (\is_array($controller)) { try { $r = new \ReflectionMethod($controller[0], $controller[1]); return array( - 'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0], + 'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0], 'method' => $controller[1], 'file' => $r->getFileName(), 'line' => $r->getStartLine(), ); } catch (\ReflectionException $e) { - if (is_callable($controller)) { + if (\is_callable($controller)) { // using __call or __callStatic return array( - 'class' => is_object($controller[0]) ? get_class($controller[0]) : $controller[0], + 'class' => \is_object($controller[0]) ? \get_class($controller[0]) : $controller[0], 'method' => $controller[1], 'file' => 'n/a', 'line' => 'n/a', @@ -380,15 +380,28 @@ protected function parseController($controller) if ($controller instanceof \Closure) { $r = new \ReflectionFunction($controller); - return array( + $controller = array( 'class' => $r->getName(), 'method' => null, 'file' => $r->getFileName(), 'line' => $r->getStartLine(), ); + + if (false !== strpos($r->name, '{closure}')) { + return $controller; + } + $controller['method'] = $r->name; + + if ($class = $r->getClosureScopeClass()) { + $controller['class'] = $class->name; + } else { + return $r->name; + } + + return $controller; } - if (is_object($controller)) { + if (\is_object($controller)) { $r = new \ReflectionClass($controller); return array( @@ -399,6 +412,6 @@ protected function parseController($controller) ); } - return is_string($controller) ? $controller : 'n/a'; + return \is_string($controller) ? $controller : 'n/a'; } } diff --git a/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php b/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php index afd34f8af..481747b3c 100644 --- a/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php +++ b/vendor/symfony/http-kernel/DataCollector/RouterDataCollector.php @@ -11,9 +11,9 @@ namespace Symfony\Component\HttpKernel\DataCollector; +use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\RedirectResponse; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; /** diff --git a/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php b/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php index a71c00db9..e30b3a502 100644 --- a/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php +++ b/vendor/symfony/http-kernel/DataCollector/Util/ValueExporter.php @@ -35,15 +35,15 @@ public function exportValue($value, $depth = 1, $deep = false) return sprintf('__PHP_Incomplete_Class(%s)', $this->getClassNameFromIncomplete($value)); } - if (is_object($value)) { + if (\is_object($value)) { if ($value instanceof \DateTimeInterface) { - return sprintf('Object(%s) - %s', get_class($value), $value->format(\DateTime::ATOM)); + return sprintf('Object(%s) - %s', \get_class($value), $value->format(\DateTime::ATOM)); } - return sprintf('Object(%s)', get_class($value)); + return sprintf('Object(%s)', \get_class($value)); } - if (is_array($value)) { + if (\is_array($value)) { if (empty($value)) { return '[]'; } @@ -52,7 +52,7 @@ public function exportValue($value, $depth = 1, $deep = false) $a = array(); foreach ($value as $k => $v) { - if (is_array($v)) { + if (\is_array($v)) { $deep = true; } $a[] = sprintf('%s => %s', $k, $this->exportValue($v, $depth + 1, $deep)); @@ -64,14 +64,14 @@ public function exportValue($value, $depth = 1, $deep = false) $s = sprintf('[%s]', implode(', ', $a)); - if (80 > strlen($s)) { + if (80 > \strlen($s)) { return $s; } return sprintf("[\n%s%s\n]", $indent, implode(sprintf(",\n%s", $indent), $a)); } - if (is_resource($value)) { + if (\is_resource($value)) { return sprintf('Resource(%s#%d)', get_resource_type($value), $value); } diff --git a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php index 1a72ac7e2..b3c2595b0 100644 --- a/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php +++ b/vendor/symfony/http-kernel/Debug/FileLinkFormatter.php @@ -34,8 +34,8 @@ class FileLinkFormatter implements \Serializable public function __construct($fileLinkFormat = null, RequestStack $requestStack = null, $baseDir = null, $urlFormat = null) { $fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format'); - if ($fileLinkFormat && !is_array($fileLinkFormat)) { - $i = strpos($f = $fileLinkFormat, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: strlen($f); + if ($fileLinkFormat && !\is_array($fileLinkFormat)) { + $i = strpos($f = $fileLinkFormat, '&', max(strrpos($f, '%f'), strrpos($f, '%l'))) ?: \strlen($f); $fileLinkFormat = array(substr($f, 0, $i)) + preg_split('/&([^>]++)>/', substr($f, $i), -1, PREG_SPLIT_DELIM_CAPTURE); } @@ -50,7 +50,7 @@ public function format($file, $line) if ($fmt = $this->getFileLinkFormat()) { for ($i = 1; isset($fmt[$i]); ++$i) { if (0 === strpos($file, $k = $fmt[$i++])) { - $file = substr_replace($file, $fmt[$i], 0, strlen($k)); + $file = substr_replace($file, $fmt[$i], 0, \strlen($k)); break; } } @@ -100,8 +100,8 @@ private function getFileLinkFormat() } return array( - $request->getSchemeAndHttpHost().$request->getBaseUrl().$this->urlFormat, - $this->baseDir.DIRECTORY_SEPARATOR, '', + $request->getSchemeAndHttpHost().$request->getBasePath().$this->urlFormat, + $this->baseDir.\DIRECTORY_SEPARATOR, '', ); } } diff --git a/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php b/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php index fbc49dffc..ddf4fa7ce 100644 --- a/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php +++ b/vendor/symfony/http-kernel/Debug/TraceableEventDispatcher.php @@ -12,8 +12,8 @@ namespace Symfony\Component\HttpKernel\Debug; use Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher as BaseTraceableEventDispatcher; -use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\EventDispatcher\Event; +use Symfony\Component\HttpKernel\KernelEvents; /** * Collects some data about event listeners. diff --git a/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php b/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php index b1ecebdc9..645e8f30f 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/AddAnnotatedClassesToCachePass.php @@ -13,8 +13,8 @@ use Composer\Autoload\ClassLoader; use Symfony\Component\Debug\DebugClassLoader; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel; /** @@ -96,7 +96,7 @@ private function getClassesInComposerClassMaps() $classes = array(); foreach (spl_autoload_functions() as $function) { - if (!is_array($function)) { + if (!\is_array($function)) { continue; } @@ -104,7 +104,7 @@ private function getClassesInComposerClassMaps() $function = $function[0]->getClassLoader(); } - if (is_array($function) && $function[0] instanceof ClassLoader) { + if (\is_array($function) && $function[0] instanceof ClassLoader) { $classes += array_filter($function[0]->getClassMap()); } } diff --git a/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php b/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php index ac52c8732..06a39c8bc 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/FragmentRendererPass.php @@ -11,9 +11,9 @@ namespace Symfony\Component\HttpKernel\DependencyInjection; +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass; use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\Fragment\FragmentRendererInterface; diff --git a/vendor/symfony/http-kernel/DependencyInjection/LoggerPass.php b/vendor/symfony/http-kernel/DependencyInjection/LoggerPass.php index 2ad7f3222..b6df1f6e6 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/LoggerPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/LoggerPass.php @@ -12,9 +12,9 @@ namespace Symfony\Component\HttpKernel\DependencyInjection; use Psr\Log\LoggerInterface; -use Symfony\Component\HttpKernel\Log\Logger; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\HttpKernel\Log\Logger; /** * Registers the default logger if necessary. diff --git a/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php b/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php index dcd73828d..1dbf7f7be 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/MergeExtensionConfigurationPass.php @@ -31,7 +31,7 @@ public function __construct(array $extensions) public function process(ContainerBuilder $container) { foreach ($this->extensions as $extension) { - if (!count($container->getExtensionConfig($extension))) { + if (!\count($container->getExtensionConfig($extension))) { $container->loadFromExtension($extension, array()); } } diff --git a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php b/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php index cb88594e3..cb05f6fbe 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/RegisterControllerArgumentLocatorsPass.php @@ -60,7 +60,7 @@ public function process(ContainerBuilder $container) while ($def instanceof ChildDefinition) { $def = $container->findDefinition($def->getParent()); $class = $class ?: $def->getClass(); - $bindings = $def->getBindings(); + $bindings += $def->getBindings(); } $class = $parameterBag->resolveValue($class); diff --git a/vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php b/vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php index ab50cec35..e230a67ea 100644 --- a/vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php +++ b/vendor/symfony/http-kernel/DependencyInjection/RemoveEmptyControllerArgumentLocatorsPass.php @@ -48,7 +48,7 @@ public function process(ContainerBuilder $container) // any methods listed for call-at-instantiation cannot be actions $reason = false; $action = substr(strrchr($controller, ':'), 1); - $id = substr($controller, 0, -1 - strlen($action)); + $id = substr($controller, 0, -1 - \strlen($action)); $controllerDef = $container->getDefinition($id); foreach ($controllerDef->getMethodCalls() as list($method)) { if (0 === strcasecmp($action, $method)) { diff --git a/vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php b/vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php index 2b08f2d77..043e0584a 100644 --- a/vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php +++ b/vendor/symfony/http-kernel/Event/FilterControllerArgumentsEvent.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpKernel\Event; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\HttpKernelInterface; /** * Allows filtering of controller arguments. diff --git a/vendor/symfony/http-kernel/Event/FilterControllerEvent.php b/vendor/symfony/http-kernel/Event/FilterControllerEvent.php index 84cbc2eaf..a4cfd6258 100644 --- a/vendor/symfony/http-kernel/Event/FilterControllerEvent.php +++ b/vendor/symfony/http-kernel/Event/FilterControllerEvent.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpKernel\Event; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\HttpKernelInterface; /** * Allows filtering of a controller callable. diff --git a/vendor/symfony/http-kernel/Event/FilterResponseEvent.php b/vendor/symfony/http-kernel/Event/FilterResponseEvent.php index 53a7efce7..1b80e34ba 100644 --- a/vendor/symfony/http-kernel/Event/FilterResponseEvent.php +++ b/vendor/symfony/http-kernel/Event/FilterResponseEvent.php @@ -11,9 +11,9 @@ namespace Symfony\Component\HttpKernel\Event; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\HttpKernelInterface; /** * Allows to filter a Response object. diff --git a/vendor/symfony/http-kernel/Event/GetResponseEvent.php b/vendor/symfony/http-kernel/Event/GetResponseEvent.php index f7745ea3d..c25a0f1cf 100644 --- a/vendor/symfony/http-kernel/Event/GetResponseEvent.php +++ b/vendor/symfony/http-kernel/Event/GetResponseEvent.php @@ -29,7 +29,7 @@ class GetResponseEvent extends KernelEvent /** * Returns the response object. * - * @return Response + * @return Response|null */ public function getResponse() { diff --git a/vendor/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php b/vendor/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php index f70ce09e0..d68eaa18c 100644 --- a/vendor/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php +++ b/vendor/symfony/http-kernel/Event/GetResponseForControllerResultEvent.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpKernel\Event; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\HttpKernelInterface; /** * Allows to create a response for the return value of a controller. diff --git a/vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php b/vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php index 751b74515..6199838fc 100644 --- a/vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php +++ b/vendor/symfony/http-kernel/Event/GetResponseForExceptionEvent.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpKernel\Event; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\HttpKernelInterface; /** * Allows to create a response for a thrown exception. diff --git a/vendor/symfony/http-kernel/Event/KernelEvent.php b/vendor/symfony/http-kernel/Event/KernelEvent.php index 992f6b4dc..cccf01f3d 100644 --- a/vendor/symfony/http-kernel/Event/KernelEvent.php +++ b/vendor/symfony/http-kernel/Event/KernelEvent.php @@ -11,9 +11,9 @@ namespace Symfony\Component\HttpKernel\Event; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\EventDispatcher\Event; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\HttpKernelInterface; /** * Base class for events thrown in the HttpKernel component. diff --git a/vendor/symfony/http-kernel/Event/PostResponseEvent.php b/vendor/symfony/http-kernel/Event/PostResponseEvent.php index 2406fddbe..0981e64c9 100644 --- a/vendor/symfony/http-kernel/Event/PostResponseEvent.php +++ b/vendor/symfony/http-kernel/Event/PostResponseEvent.php @@ -11,9 +11,9 @@ namespace Symfony\Component\HttpKernel\Event; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\HttpKernelInterface; /** * Allows to execute logic after a response was sent. diff --git a/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php b/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php index dff29ee80..41187d412 100644 --- a/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php +++ b/vendor/symfony/http-kernel/EventListener/AbstractSessionListener.php @@ -11,12 +11,13 @@ namespace Symfony\Component\HttpKernel\EventListener; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\Event\FinishRequestEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Sets the session in the request. @@ -25,6 +26,8 @@ */ abstract class AbstractSessionListener implements EventSubscriberInterface { + private $sessionUsageStack = array(); + public function onKernelRequest(GetResponseEvent $event) { if (!$event->isMasterRequest()) { @@ -33,6 +36,7 @@ public function onKernelRequest(GetResponseEvent $event) $request = $event->getRequest(); $session = $this->getSession(); + $this->sessionUsageStack[] = $session instanceof Session ? $session->getUsageIndex() : null; if (null === $session || $request->hasSession()) { return; } @@ -50,7 +54,7 @@ public function onKernelResponse(FilterResponseEvent $event) return; } - if ($session->isStarted() || ($session instanceof Session && $session->hasBeenStarted())) { + if ($session instanceof Session ? $session->getUsageIndex() !== end($this->sessionUsageStack) : $session->isStarted()) { $event->getResponse() ->setPrivate() ->setMaxAge(0) @@ -58,12 +62,23 @@ public function onKernelResponse(FilterResponseEvent $event) } } + /** + * @internal + */ + public function onFinishRequest(FinishRequestEvent $event) + { + if ($event->isMasterRequest()) { + array_pop($this->sessionUsageStack); + } + } + public static function getSubscribedEvents() { return array( KernelEvents::REQUEST => array('onKernelRequest', 128), // low priority to come after regular response listeners, same as SaveSessionListener KernelEvents::RESPONSE => array('onKernelResponse', -1000), + KernelEvents::FINISH_REQUEST => array('onFinishRequest'), ); } diff --git a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php b/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php index 82061fd6e..cb5da50bd 100644 --- a/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php +++ b/vendor/symfony/http-kernel/EventListener/AbstractTestSessionListener.php @@ -11,13 +11,13 @@ namespace Symfony\Component\HttpKernel\EventListener; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\SessionInterface; -use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpKernel\KernelEvents; /** * TestSessionListener. @@ -71,6 +71,13 @@ public function onKernelResponse(FilterResponseEvent $event) if ($session instanceof Session ? !$session->isEmpty() || (null !== $this->sessionId && $session->getId() !== $this->sessionId) : $wasStarted) { $params = session_get_cookie_params(); + + foreach ($event->getResponse()->headers->getCookies() as $cookie) { + if ($session->getName() === $cookie->getName() && $params['path'] === $cookie->getPath() && $params['domain'] == $cookie->getDomain()) { + return; + } + } + $event->getResponse()->headers->setCookie(new Cookie($session->getName(), $session->getId(), 0 === $params['lifetime'] ? 0 : time() + $params['lifetime'], $params['path'], $params['domain'], $params['secure'], $params['httponly'])); $this->sessionId = $session->getId(); } diff --git a/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php b/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php index f21fc6ab7..5ec528417 100644 --- a/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php +++ b/vendor/symfony/http-kernel/EventListener/AddRequestFormatsListener.php @@ -12,8 +12,8 @@ namespace Symfony\Component\HttpKernel\EventListener; use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\KernelEvents; /** * Adds configured formats to each request. diff --git a/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php b/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php index 2911caa11..04137c746 100644 --- a/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php +++ b/vendor/symfony/http-kernel/EventListener/DebugHandlersListener.php @@ -12,15 +12,15 @@ namespace Symfony\Component\HttpKernel\EventListener; use Psr\Log\LoggerInterface; +use Symfony\Component\Console\ConsoleEvents; +use Symfony\Component\Console\Event\ConsoleEvent; +use Symfony\Component\Console\Output\ConsoleOutputInterface; use Symfony\Component\Debug\ErrorHandler; use Symfony\Component\Debug\ExceptionHandler; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\KernelEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\Console\ConsoleEvents; -use Symfony\Component\Console\Event\ConsoleEvent; -use Symfony\Component\Console\Output\ConsoleOutputInterface; /** * Configures errors and exceptions handlers. @@ -70,14 +70,14 @@ public function configure(Event $event = null) $this->firstCall = $this->hasTerminatedWithException = false; $handler = set_exception_handler('var_dump'); - $handler = is_array($handler) ? $handler[0] : null; + $handler = \is_array($handler) ? $handler[0] : null; restore_exception_handler(); if ($this->logger || null !== $this->throwAt) { if ($handler instanceof ErrorHandler) { if ($this->logger) { $handler->setDefaultLogger($this->logger, $this->levels); - if (is_array($this->levels)) { + if (\is_array($this->levels)) { $levels = 0; foreach ($this->levels as $type => $log) { $levels |= $type; @@ -126,7 +126,7 @@ public function configure(Event $event = null) if ($this->exceptionHandler) { if ($handler instanceof ErrorHandler) { $h = $handler->setExceptionHandler('var_dump'); - if (is_array($h) && $h[0] instanceof ExceptionHandler) { + if (\is_array($h) && $h[0] instanceof ExceptionHandler) { $handler->setExceptionHandler($h); $handler = $h[0]; } else { @@ -147,7 +147,7 @@ public static function getSubscribedEvents() { $events = array(KernelEvents::REQUEST => array('configure', 2048)); - if ('cli' === PHP_SAPI && defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) { + if ('cli' === \PHP_SAPI && \defined('Symfony\Component\Console\ConsoleEvents::COMMAND')) { $events[ConsoleEvents::COMMAND] = array('configure', 2048); } diff --git a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php b/vendor/symfony/http-kernel/EventListener/ExceptionListener.php index 3dfa4cd8e..71de60434 100644 --- a/vendor/symfony/http-kernel/EventListener/ExceptionListener.php +++ b/vendor/symfony/http-kernel/EventListener/ExceptionListener.php @@ -12,18 +12,16 @@ namespace Symfony\Component\HttpKernel\EventListener; use Psr\Log\LoggerInterface; -use Symfony\Component\Debug\ExceptionHandler; use Symfony\Component\Debug\Exception\FlattenException; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; /** * ExceptionListener. @@ -35,30 +33,28 @@ class ExceptionListener implements EventSubscriberInterface protected $controller; protected $logger; protected $debug; - private $charset; - public function __construct($controller, LoggerInterface $logger = null, $debug = false, $charset = null) + public function __construct($controller, LoggerInterface $logger = null, $debug = false) { $this->controller = $controller; $this->logger = $logger; $this->debug = $debug; - $this->charset = $charset; } public function onKernelException(GetResponseForExceptionEvent $event) { $exception = $event->getException(); $request = $event->getRequest(); - $eventDispatcher = func_num_args() > 2 ? func_get_arg(2) : null; + $eventDispatcher = \func_num_args() > 2 ? func_get_arg(2) : null; - $this->logException($exception, sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine())); + $this->logException($exception, sprintf('Uncaught PHP Exception %s: "%s" at %s line %s', \get_class($exception), $exception->getMessage(), $exception->getFile(), $exception->getLine())); $request = $this->duplicateRequest($exception, $request); try { $response = $event->getKernel()->handle($request, HttpKernelInterface::SUB_REQUEST, false); } catch (\Exception $e) { - $this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine())); + $this->logException($e, sprintf('Exception thrown when handling an exception (%s: %s at %s line %s)', \get_class($e), $e->getMessage(), $e->getFile(), $e->getLine())); $wrapper = $e; @@ -68,7 +64,7 @@ public function onKernelException(GetResponseForExceptionEvent $event) } } - $prev = new \ReflectionProperty('Exception', 'previous'); + $prev = new \ReflectionProperty($wrapper instanceof \Exception ? \Exception::class : \Error::class, 'previous'); $prev->setAccessible(true); $prev->setValue($wrapper, $exception); @@ -116,17 +112,13 @@ protected function logException(\Exception $exception, $message) * @param \Exception $exception The thrown exception * @param Request $request The original request * - * @return Request $request The cloned request + * @return Request The cloned request */ protected function duplicateRequest(\Exception $exception, Request $request) { $attributes = array( - 'exception' => $exception = FlattenException::create($exception), - '_controller' => $this->controller ?: function () use ($exception) { - $handler = new ExceptionHandler($this->debug, $this->charset); - - return new Response($handler->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders()); - }, + '_controller' => $this->controller, + 'exception' => FlattenException::create($exception), 'logger' => $this->logger instanceof DebugLoggerInterface ? $this->logger : null, ); $request = $request->duplicate(null, null, $attributes); diff --git a/vendor/symfony/http-kernel/EventListener/FragmentListener.php b/vendor/symfony/http-kernel/EventListener/FragmentListener.php index da518fcc8..574d7c05c 100644 --- a/vendor/symfony/http-kernel/EventListener/FragmentListener.php +++ b/vendor/symfony/http-kernel/EventListener/FragmentListener.php @@ -11,12 +11,12 @@ namespace Symfony\Component\HttpKernel\EventListener; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; +use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\UriSigner; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Handles content fragments represented by special URIs. diff --git a/vendor/symfony/http-kernel/EventListener/LocaleListener.php b/vendor/symfony/http-kernel/EventListener/LocaleListener.php index 427ea82fc..ed0236efc 100644 --- a/vendor/symfony/http-kernel/EventListener/LocaleListener.php +++ b/vendor/symfony/http-kernel/EventListener/LocaleListener.php @@ -11,13 +11,13 @@ namespace Symfony\Component\HttpKernel\EventListener; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpKernel\Event\FinishRequestEvent; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\RequestContextAwareInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * Initializes the locale based on the current request. diff --git a/vendor/symfony/http-kernel/EventListener/ProfilerListener.php b/vendor/symfony/http-kernel/EventListener/ProfilerListener.php index e3e4e7620..2e54a92f0 100644 --- a/vendor/symfony/http-kernel/EventListener/ProfilerListener.php +++ b/vendor/symfony/http-kernel/EventListener/ProfilerListener.php @@ -11,14 +11,14 @@ namespace Symfony\Component\HttpKernel\EventListener; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpFoundation\RequestMatcherInterface; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Event\PostResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Profiler\Profiler; -use Symfony\Component\HttpFoundation\RequestMatcherInterface; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * ProfilerListener collects data for the current request by listening to the kernel events. diff --git a/vendor/symfony/http-kernel/EventListener/ResponseListener.php b/vendor/symfony/http-kernel/EventListener/ResponseListener.php index 6d56197a7..f24784527 100644 --- a/vendor/symfony/http-kernel/EventListener/ResponseListener.php +++ b/vendor/symfony/http-kernel/EventListener/ResponseListener.php @@ -11,9 +11,9 @@ namespace Symfony\Component\HttpKernel\EventListener; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * ResponseListener fixes the Response headers based on the Request. diff --git a/vendor/symfony/http-kernel/EventListener/RouterListener.php b/vendor/symfony/http-kernel/EventListener/RouterListener.php index caaf80f86..ab5c86cdd 100644 --- a/vendor/symfony/http-kernel/EventListener/RouterListener.php +++ b/vendor/symfony/http-kernel/EventListener/RouterListener.php @@ -12,24 +12,25 @@ namespace Symfony\Component\HttpKernel\EventListener; use Psr\Log\LoggerInterface; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\Event\FinishRequestEvent; -use Symfony\Component\HttpKernel\Kernel; -use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpKernel\Kernel; +use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\NoConfigurationException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Matcher\RequestMatcherInterface; +use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\RequestContextAwareInterface; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; -use Symfony\Component\HttpFoundation\Request; /** * Initializes the context from the request and sets request attributes based on a matching route. @@ -129,12 +130,6 @@ public function onKernelRequest(GetResponseEvent $event) unset($parameters['_route'], $parameters['_controller']); $request->attributes->set('_route_params', $parameters); } catch (ResourceNotFoundException $e) { - if ($this->debug && $e instanceof NoConfigurationException) { - $event->setResponse($this->createWelcomeResponse()); - - return; - } - $message = sprintf('No route found for "%s %s"', $request->getMethod(), $request->getPathInfo()); if ($referer = $request->headers->get('referer')) { @@ -149,18 +144,30 @@ public function onKernelRequest(GetResponseEvent $event) } } + public function onKernelException(GetResponseForExceptionEvent $event) + { + if (!$this->debug || !($e = $event->getException()) instanceof NotFoundHttpException) { + return; + } + + if ($e->getPrevious() instanceof NoConfigurationException) { + $event->setResponse($this->createWelcomeResponse()); + } + } + public static function getSubscribedEvents() { return array( KernelEvents::REQUEST => array(array('onKernelRequest', 32)), KernelEvents::FINISH_REQUEST => array(array('onKernelFinishRequest', 0)), + KernelEvents::EXCEPTION => array('onKernelException', -64), ); } private function createWelcomeResponse() { $version = Kernel::VERSION; - $baseDir = realpath($this->projectDir).DIRECTORY_SEPARATOR; + $baseDir = realpath($this->projectDir).\DIRECTORY_SEPARATOR; $docVersion = substr(Kernel::VERSION, 0, 3); ob_start(); diff --git a/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php b/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php index 671db5d82..2c616b918 100644 --- a/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php +++ b/vendor/symfony/http-kernel/EventListener/StreamedResponseListener.php @@ -11,10 +11,10 @@ namespace Symfony\Component\HttpKernel\EventListener; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * StreamedResponseListener is responsible for sending the Response diff --git a/vendor/symfony/http-kernel/EventListener/SurrogateListener.php b/vendor/symfony/http-kernel/EventListener/SurrogateListener.php index 37d1b9d04..634353385 100644 --- a/vendor/symfony/http-kernel/EventListener/SurrogateListener.php +++ b/vendor/symfony/http-kernel/EventListener/SurrogateListener.php @@ -11,11 +11,11 @@ namespace Symfony\Component\HttpKernel\EventListener; +use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\HttpCache\HttpCache; use Symfony\Component\HttpKernel\HttpCache\SurrogateInterface; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventSubscriberInterface; /** * SurrogateListener adds a Surrogate-Control HTTP header when the Response needs to be parsed for Surrogates. diff --git a/vendor/symfony/http-kernel/EventListener/TranslatorListener.php b/vendor/symfony/http-kernel/EventListener/TranslatorListener.php index 6967ad029..2a5fc7128 100644 --- a/vendor/symfony/http-kernel/EventListener/TranslatorListener.php +++ b/vendor/symfony/http-kernel/EventListener/TranslatorListener.php @@ -13,10 +13,10 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpKernel\Event\FinishRequestEvent; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\Translation\TranslatorInterface; /** diff --git a/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php index a8dca41ba..3c8934ff8 100644 --- a/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php +++ b/vendor/symfony/http-kernel/Fragment/AbstractSurrogateFragmentRenderer.php @@ -92,13 +92,13 @@ private function generateSignedFragmentUri($uri, Request $request) // we need to sign the absolute URI, but want to return the path only. $fragmentUri = $this->signer->sign($this->generateFragmentUri($uri, $request, true)); - return substr($fragmentUri, strlen($request->getSchemeAndHttpHost())); + return substr($fragmentUri, \strlen($request->getSchemeAndHttpHost())); } private function containsNonScalars(array $values) { foreach ($values as $value) { - if (is_array($value)) { + if (\is_array($value)) { return $this->containsNonScalars($value); } elseif (!is_scalar($value) && null !== $value) { return true; diff --git a/vendor/symfony/http-kernel/Fragment/FragmentHandler.php b/vendor/symfony/http-kernel/Fragment/FragmentHandler.php index c9d952ffb..f11db73dc 100644 --- a/vendor/symfony/http-kernel/Fragment/FragmentHandler.php +++ b/vendor/symfony/http-kernel/Fragment/FragmentHandler.php @@ -11,9 +11,9 @@ namespace Symfony\Component\HttpKernel\Fragment; +use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\StreamedResponse; -use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpKernel\Controller\ControllerReference; /** diff --git a/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php b/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php index b177c3ac1..bcf4e9944 100644 --- a/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php +++ b/vendor/symfony/http-kernel/Fragment/FragmentRendererInterface.php @@ -12,8 +12,8 @@ namespace Symfony\Component\HttpKernel\Fragment; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Controller\ControllerReference; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Controller\ControllerReference; /** * Interface implemented by all rendering strategies. diff --git a/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php index 7e957d4c9..f7150c197 100644 --- a/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php +++ b/vendor/symfony/http-kernel/Fragment/HIncludeFragmentRenderer.php @@ -13,9 +13,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\Templating\EngineInterface; use Symfony\Component\HttpKernel\Controller\ControllerReference; use Symfony\Component\HttpKernel\UriSigner; +use Symfony\Component\Templating\EngineInterface; use Twig\Environment; use Twig\Error\LoaderError; use Twig\Loader\ExistsLoaderInterface; @@ -89,7 +89,7 @@ public function render($uri, Request $request, array $options = array()) } // we need to sign the absolute URI, but want to return the path only. - $uri = substr($this->signer->sign($this->generateFragmentUri($uri, $request, true)), strlen($request->getSchemeAndHttpHost())); + $uri = substr($this->signer->sign($this->generateFragmentUri($uri, $request, true)), \strlen($request->getSchemeAndHttpHost())); } // We need to replace ampersands in the URI with the encoded form in order to return valid html/xml content. @@ -102,12 +102,12 @@ public function render($uri, Request $request, array $options = array()) $content = $template; } - $attributes = isset($options['attributes']) && is_array($options['attributes']) ? $options['attributes'] : array(); + $attributes = isset($options['attributes']) && \is_array($options['attributes']) ? $options['attributes'] : array(); if (isset($options['id']) && $options['id']) { $attributes['id'] = $options['id']; } $renderedAttributes = ''; - if (count($attributes) > 0) { + if (\count($attributes) > 0) { $flags = ENT_QUOTES | ENT_SUBSTITUTE; foreach ($attributes as $attribute => $value) { $renderedAttributes .= sprintf( @@ -131,7 +131,7 @@ private function templateExists($template) if ($this->templating instanceof EngineInterface) { try { return $this->templating->exists($template); - } catch (\InvalidArgumentException $e) { + } catch (\Exception $e) { return false; } } diff --git a/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php index 3f3a51a59..13fc33562 100644 --- a/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php +++ b/vendor/symfony/http-kernel/Fragment/InlineFragmentRenderer.php @@ -11,13 +11,14 @@ namespace Symfony\Component\HttpKernel\Fragment; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\HttpKernel\HttpCache\SubRequestHandler; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpKernel\KernelEvents; /** * Implements the inline rendering strategy where the Request is rendered by the current HTTP kernel. @@ -76,7 +77,7 @@ public function render($uri, Request $request, array $options = array()) $level = ob_get_level(); try { - return $this->kernel->handle($subRequest, HttpKernelInterface::SUB_REQUEST, false); + return SubRequestHandler::handle($this->kernel, $subRequest, HttpKernelInterface::SUB_REQUEST, false); } catch (\Exception $e) { // we dispatch the exception event to trigger the logging // the response that comes back is simply ignored @@ -109,24 +110,6 @@ protected function createSubRequest($uri, Request $request) $cookies = $request->cookies->all(); $server = $request->server->all(); - // Override the arguments to emulate a sub-request. - // Sub-request object will point to localhost as client ip and real client ip - // will be included into trusted header for client ip - try { - if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) { - $currentXForwardedFor = $request->headers->get('X_FORWARDED_FOR', ''); - - $server['HTTP_X_FORWARDED_FOR'] = ($currentXForwardedFor ? $currentXForwardedFor.', ' : '').$request->getClientIp(); - } elseif (method_exists(Request::class, 'getTrustedHeaderName') && $trustedHeaderName = Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP, false)) { - $currentXForwardedFor = $request->headers->get($trustedHeaderName, ''); - - $server['HTTP_'.$trustedHeaderName] = ($currentXForwardedFor ? $currentXForwardedFor.', ' : '').$request->getClientIp(); - } - } catch (\InvalidArgumentException $e) { - // Do nothing - } - - $server['REMOTE_ADDR'] = '127.0.0.1'; unset($server['HTTP_IF_MODIFIED_SINCE']); unset($server['HTTP_IF_NONE_MATCH']); @@ -139,6 +122,13 @@ protected function createSubRequest($uri, Request $request) $subRequest->setSession($session); } + if ($request->get('_format')) { + $subRequest->attributes->set('_format', $request->get('_format')); + } + if ($request->getDefaultLocale() !== $request->getLocale()) { + $subRequest->setLocale($request->getLocale()); + } + return $subRequest; } diff --git a/vendor/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php b/vendor/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php index d7eeb89a6..0c1b95d4e 100644 --- a/vendor/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php +++ b/vendor/symfony/http-kernel/Fragment/RoutableFragmentRenderer.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpKernel\Fragment; -use Symfony\Component\HttpKernel\Controller\ControllerReference; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Controller\ControllerReference; use Symfony\Component\HttpKernel\EventListener\FragmentListener; /** @@ -80,7 +80,7 @@ protected function generateFragmentUri(ControllerReference $reference, Request $ private function checkNonScalar($values) { foreach ($values as $key => $value) { - if (is_array($value)) { + if (\is_array($value)) { $this->checkNonScalar($value); } elseif (!is_scalar($value) && null !== $value) { throw new \LogicException(sprintf('Controller attributes cannot contain non-scalar/non-null values (value for key "%s" is not a scalar or null).', $key)); diff --git a/vendor/symfony/http-kernel/HttpCache/Esi.php b/vendor/symfony/http-kernel/HttpCache/Esi.php index d09907ea6..69134c71a 100644 --- a/vendor/symfony/http-kernel/HttpCache/Esi.php +++ b/vendor/symfony/http-kernel/HttpCache/Esi.php @@ -71,7 +71,7 @@ public function process(Request $request, Response $response) } $parts = explode(';', $type); - if (!in_array($parts[0], $this->contentTypes)) { + if (!\in_array($parts[0], $this->contentTypes)) { return $response; } diff --git a/vendor/symfony/http-kernel/HttpCache/HttpCache.php b/vendor/symfony/http-kernel/HttpCache/HttpCache.php index 7c5a44f05..ebc5ba686 100644 --- a/vendor/symfony/http-kernel/HttpCache/HttpCache.php +++ b/vendor/symfony/http-kernel/HttpCache/HttpCache.php @@ -15,10 +15,10 @@ namespace Symfony\Component\HttpKernel\HttpCache; -use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\TerminableInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpKernel\TerminableInterface; /** * Cache provides HTTP caching. @@ -93,7 +93,7 @@ public function __construct(HttpKernelInterface $kernel, StoreInterface $store, /** * Gets the current store. * - * @return StoreInterface $store A StoreInterface instance + * @return StoreInterface A StoreInterface instance */ public function getStore() { @@ -165,7 +165,11 @@ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQ // FIXME: catch exceptions and implement a 500 error page here? -> in Varnish, there is a built-in error page mechanism if (HttpKernelInterface::MASTER_REQUEST === $type) { $this->traces = array(); - $this->request = $request; + // Keep a clone of the original request for surrogates so they can access it. + // We must clone here to get a separate instance because the application will modify the request during + // the application flow (we know it always does because we do ourselves by setting REMOTE_ADDR to 127.0.0.1 + // and adding the X-Forwarded-For header, see HttpCache::forward()). + $this->request = clone $request; if (null !== $this->surrogate) { $this->surrogateCacheStrategy = $this->surrogate->createCacheStrategy(); } @@ -366,7 +370,7 @@ protected function validate(Request $request, Response $entry, $catch = false) // return the response and not the cache entry if the response is valid but not cached $etag = $response->getEtag(); - if ($etag && in_array($etag, $requestEtags) && !in_array($etag, $cachedEtags)) { + if ($etag && \in_array($etag, $requestEtags) && !\in_array($etag, $cachedEtags)) { return $response; } @@ -440,30 +444,11 @@ protected function forward(Request $request, $catch = false, Response $entry = n $this->surrogate->addSurrogateCapability($request); } - // modify the X-Forwarded-For header if needed - $forwardedFor = $request->headers->get('X-Forwarded-For'); - if ($forwardedFor) { - $request->headers->set('X-Forwarded-For', $forwardedFor.', '.$request->server->get('REMOTE_ADDR')); - } else { - $request->headers->set('X-Forwarded-For', $request->server->get('REMOTE_ADDR')); - } - - // fix the client IP address by setting it to 127.0.0.1 as HttpCache - // is always called from the same process as the backend. - $request->server->set('REMOTE_ADDR', '127.0.0.1'); - - // make sure HttpCache is a trusted proxy - if (!in_array('127.0.0.1', $trustedProxies = Request::getTrustedProxies())) { - $trustedProxies[] = '127.0.0.1'; - Request::setTrustedProxies($trustedProxies, Request::HEADER_X_FORWARDED_ALL); - } - // always a "master" request (as the real master request can be in cache) - $response = $this->kernel->handle($request, HttpKernelInterface::MASTER_REQUEST, $catch); - // FIXME: we probably need to also catch exceptions if raw === true + $response = SubRequestHandler::handle($this->kernel, $request, HttpKernelInterface::MASTER_REQUEST, $catch); // we don't implement the stale-if-error on Requests, which is nonetheless part of the RFC - if (null !== $entry && in_array($response->getStatusCode(), array(500, 502, 503, 504))) { + if (null !== $entry && \in_array($response->getStatusCode(), array(500, 502, 503, 504))) { if (null === $age = $entry->headers->getCacheControlDirective('stale-if-error')) { $age = $this->options['stale_if_error']; } @@ -602,7 +587,7 @@ private function restoreResponseBody(Request $request, Response $response) $response->setContent(ob_get_clean()); $response->headers->remove('X-Body-Eval'); if (!$response->headers->has('Transfer-Encoding')) { - $response->headers->set('Content-Length', strlen($response->getContent())); + $response->headers->set('Content-Length', \strlen($response->getContent())); } } elseif ($response->headers->has('X-Body-File')) { // Response does not include possibly dynamic content (ESI, SSI), so we need @@ -636,7 +621,7 @@ private function isPrivateRequest(Request $request) $key = strtolower(str_replace('HTTP_', '', $key)); if ('cookie' === $key) { - if (count($request->cookies->all())) { + if (\count($request->cookies->all())) { return true; } } elseif ($request->headers->has($key)) { diff --git a/vendor/symfony/http-kernel/HttpCache/Ssi.php b/vendor/symfony/http-kernel/HttpCache/Ssi.php index 3178c3351..58df17601 100644 --- a/vendor/symfony/http-kernel/HttpCache/Ssi.php +++ b/vendor/symfony/http-kernel/HttpCache/Ssi.php @@ -58,7 +58,7 @@ public function process(Request $request, Response $response) } $parts = explode(';', $type); - if (!in_array($parts[0], $this->contentTypes)) { + if (!\in_array($parts[0], $this->contentTypes)) { return $response; } diff --git a/vendor/symfony/http-kernel/HttpCache/Store.php b/vendor/symfony/http-kernel/HttpCache/Store.php index d20bfaa1b..990091d06 100644 --- a/vendor/symfony/http-kernel/HttpCache/Store.php +++ b/vendor/symfony/http-kernel/HttpCache/Store.php @@ -68,7 +68,7 @@ public function lock(Request $request) if (!isset($this->locks[$key])) { $path = $this->getPath($key); - if (!file_exists(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) { + if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) { return $path; } $h = fopen($path, 'cb'); @@ -187,7 +187,7 @@ public function write(Request $request, Response $response) $response->headers->set('X-Content-Digest', $digest); if (!$response->headers->has('Transfer-Encoding')) { - $response->headers->set('Content-Length', strlen($response->getContent())); + $response->headers->set('Content-Length', \strlen($response->getContent())); } } @@ -375,17 +375,17 @@ private function save($key, $data) @ftruncate($fp, 0); @fseek($fp, 0); $len = @fwrite($fp, $data); - if (strlen($data) !== $len) { + if (\strlen($data) !== $len) { @ftruncate($fp, 0); return false; } } else { - if (!file_exists(dirname($path)) && false === @mkdir(dirname($path), 0777, true) && !is_dir(dirname($path))) { + if (!file_exists(\dirname($path)) && false === @mkdir(\dirname($path), 0777, true) && !is_dir(\dirname($path))) { return false; } - $tmpFile = tempnam(dirname($path), basename($path)); + $tmpFile = tempnam(\dirname($path), basename($path)); if (false === $fp = @fopen($tmpFile, 'wb')) { @unlink($tmpFile); @@ -412,7 +412,7 @@ private function save($key, $data) public function getPath($key) { - return $this->root.DIRECTORY_SEPARATOR.substr($key, 0, 2).DIRECTORY_SEPARATOR.substr($key, 2, 2).DIRECTORY_SEPARATOR.substr($key, 4, 2).DIRECTORY_SEPARATOR.substr($key, 6); + return $this->root.\DIRECTORY_SEPARATOR.substr($key, 0, 2).\DIRECTORY_SEPARATOR.substr($key, 2, 2).\DIRECTORY_SEPARATOR.substr($key, 4, 2).\DIRECTORY_SEPARATOR.substr($key, 6); } /** diff --git a/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php b/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php new file mode 100644 index 000000000..9649072c1 --- /dev/null +++ b/vendor/symfony/http-kernel/HttpCache/SubRequestHandler.php @@ -0,0 +1,108 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\HttpCache; + +use Symfony\Component\HttpFoundation\IpUtils; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\HttpKernelInterface; + +/** + * @author Nicolas Grekas + * + * @internal + */ +class SubRequestHandler +{ + /** + * @return Response + */ + public static function handle(HttpKernelInterface $kernel, Request $request, $type, $catch) + { + // save global state related to trusted headers and proxies + $trustedProxies = Request::getTrustedProxies(); + $trustedHeaderSet = Request::getTrustedHeaderSet(); + if (\method_exists(Request::class, 'getTrustedHeaderName')) { + Request::setTrustedProxies($trustedProxies, -1); + $trustedHeaders = array( + Request::HEADER_FORWARDED => Request::getTrustedHeaderName(Request::HEADER_FORWARDED, false), + Request::HEADER_X_FORWARDED_FOR => Request::getTrustedHeaderName(Request::HEADER_X_FORWARDED_FOR, false), + Request::HEADER_X_FORWARDED_HOST => Request::getTrustedHeaderName(Request::HEADER_X_FORWARDED_HOST, false), + Request::HEADER_X_FORWARDED_PROTO => Request::getTrustedHeaderName(Request::HEADER_X_FORWARDED_PROTO, false), + Request::HEADER_X_FORWARDED_PORT => Request::getTrustedHeaderName(Request::HEADER_X_FORWARDED_PORT, false), + ); + Request::setTrustedProxies($trustedProxies, $trustedHeaderSet); + } else { + $trustedHeaders = array( + Request::HEADER_FORWARDED => 'FORWARDED', + Request::HEADER_X_FORWARDED_FOR => 'X_FORWARDED_FOR', + Request::HEADER_X_FORWARDED_HOST => 'X_FORWARDED_HOST', + Request::HEADER_X_FORWARDED_PROTO => 'X_FORWARDED_PROTO', + Request::HEADER_X_FORWARDED_PORT => 'X_FORWARDED_PORT', + ); + } + + // remove untrusted values + $remoteAddr = $request->server->get('REMOTE_ADDR'); + if (!IpUtils::checkIp($remoteAddr, $trustedProxies)) { + foreach ($trustedHeaders as $key => $name) { + if ($trustedHeaderSet & $key) { + $request->headers->remove($name); + $request->server->remove('HTTP_'.strtoupper(str_replace('-', '_', $name))); + } + } + } + + // compute trusted values, taking any trusted proxies into account + $trustedIps = array(); + $trustedValues = array(); + foreach (array_reverse($request->getClientIps()) as $ip) { + $trustedIps[] = $ip; + $trustedValues[] = sprintf('for="%s"', $ip); + } + if ($ip !== $remoteAddr) { + $trustedIps[] = $remoteAddr; + $trustedValues[] = sprintf('for="%s"', $remoteAddr); + } + + // set trusted values, reusing as much as possible the global trusted settings + if (Request::HEADER_FORWARDED & $trustedHeaderSet) { + $trustedValues[0] .= sprintf(';host="%s";proto=%s', $request->getHttpHost(), $request->getScheme()); + $request->headers->set($name = $trustedHeaders[Request::HEADER_FORWARDED], $v = implode(', ', $trustedValues)); + $request->server->set('HTTP_'.strtoupper(str_replace('-', '_', $name)), $v); + } + if (Request::HEADER_X_FORWARDED_FOR & $trustedHeaderSet) { + $request->headers->set($name = $trustedHeaders[Request::HEADER_X_FORWARDED_FOR], $v = implode(', ', $trustedIps)); + $request->server->set('HTTP_'.strtoupper(str_replace('-', '_', $name)), $v); + } elseif (!(Request::HEADER_FORWARDED & $trustedHeaderSet)) { + Request::setTrustedProxies($trustedProxies, $trustedHeaderSet | Request::HEADER_X_FORWARDED_FOR); + $request->headers->set($name = $trustedHeaders[Request::HEADER_X_FORWARDED_FOR], $v = implode(', ', $trustedIps)); + $request->server->set('HTTP_'.strtoupper(str_replace('-', '_', $name)), $v); + } + + // fix the client IP address by setting it to 127.0.0.1, + // which is the core responsibility of this method + $request->server->set('REMOTE_ADDR', '127.0.0.1'); + + // ensure 127.0.0.1 is set as trusted proxy + if (!IpUtils::checkIp('127.0.0.1', $trustedProxies)) { + Request::setTrustedProxies(array_merge($trustedProxies, array('127.0.0.1')), Request::getTrustedHeaderSet()); + } + + try { + return $kernel->handle($request, $type, $catch); + } finally { + // restore global state + Request::setTrustedProxies($trustedProxies, $trustedHeaderSet); + } + } +} diff --git a/vendor/symfony/http-kernel/HttpKernel.php b/vendor/symfony/http-kernel/HttpKernel.php index 41f8913be..36c673093 100644 --- a/vendor/symfony/http-kernel/HttpKernel.php +++ b/vendor/symfony/http-kernel/HttpKernel.php @@ -11,13 +11,15 @@ namespace Symfony\Component\HttpKernel; +use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Controller\ArgumentResolver; use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; use Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent; -use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Event\FinishRequestEvent; @@ -25,11 +27,9 @@ use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Event\PostResponseEvent; -use Symfony\Component\HttpFoundation\Exception\RequestExceptionInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; +use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface; +use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * HttpKernel notifies events to convert a Request object to a Response one. @@ -265,11 +265,11 @@ private function handleException(\Exception $e, $request, $type) private function varToString($var) { - if (is_object($var)) { - return sprintf('Object(%s)', get_class($var)); + if (\is_object($var)) { + return sprintf('Object(%s)', \get_class($var)); } - if (is_array($var)) { + if (\is_array($var)) { $a = array(); foreach ($var as $k => $v) { $a[] = sprintf('%s => %s', $k, $this->varToString($v)); @@ -278,7 +278,7 @@ private function varToString($var) return sprintf('Array(%s)', implode(', ', $a)); } - if (is_resource($var)) { + if (\is_resource($var)) { return sprintf('Resource(%s)', get_resource_type($var)); } diff --git a/vendor/symfony/http-kernel/Kernel.php b/vendor/symfony/http-kernel/Kernel.php index f584242a1..bfc961f50 100644 --- a/vendor/symfony/http-kernel/Kernel.php +++ b/vendor/symfony/http-kernel/Kernel.php @@ -13,30 +13,30 @@ use Symfony\Bridge\ProxyManager\LazyProxy\Instantiator\RuntimeInstantiator; use Symfony\Bridge\ProxyManager\LazyProxy\PhpDumper\ProxyDumper; +use Symfony\Component\ClassLoader\ClassCollectionLoader; +use Symfony\Component\Config\ConfigCache; +use Symfony\Component\Config\Loader\DelegatingLoader; +use Symfony\Component\Config\Loader\LoaderResolver; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\PassConfig; -use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\Dumper\PhpDumper; -use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; -use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; +use Symfony\Component\DependencyInjection\Loader\ClosureLoader; +use Symfony\Component\DependencyInjection\Loader\DirectoryLoader; +use Symfony\Component\DependencyInjection\Loader\GlobFileLoader; use Symfony\Component\DependencyInjection\Loader\IniFileLoader; use Symfony\Component\DependencyInjection\Loader\PhpFileLoader; -use Symfony\Component\DependencyInjection\Loader\GlobFileLoader; -use Symfony\Component\DependencyInjection\Loader\DirectoryLoader; -use Symfony\Component\DependencyInjection\Loader\ClosureLoader; +use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; +use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Config\EnvParametersResource; use Symfony\Component\HttpKernel\Config\FileLocator; -use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; use Symfony\Component\HttpKernel\DependencyInjection\AddAnnotatedClassesToCachePass; -use Symfony\Component\Config\Loader\LoaderResolver; -use Symfony\Component\Config\Loader\DelegatingLoader; -use Symfony\Component\Config\ConfigCache; -use Symfony\Component\ClassLoader\ClassCollectionLoader; +use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass; /** * The Kernel is the heart of the Symfony system. @@ -67,11 +67,11 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl private $requestStackSize = 0; private $resetServices = false; - const VERSION = '3.4.9'; - const VERSION_ID = 30409; + const VERSION = '3.4.19'; + const VERSION_ID = 30419; const MAJOR_VERSION = 3; const MINOR_VERSION = 4; - const RELEASE_VERSION = 9; + const RELEASE_VERSION = 19; const EXTRA_VERSION = ''; const END_OF_MAINTENANCE = '11/2020'; @@ -87,18 +87,10 @@ public function __construct($environment, $debug) $this->debug = (bool) $debug; $this->rootDir = $this->getRootDir(); $this->name = $this->getName(); - - if ($this->debug) { - $this->startTime = microtime(true); - } } public function __clone() { - if ($this->debug) { - $this->startTime = microtime(true); - } - $this->booted = false; $this->container = null; $this->requestStackSize = 0; @@ -106,7 +98,7 @@ public function __clone() } /** - * Boots the current kernel. + * {@inheritdoc} */ public function boot() { @@ -116,10 +108,16 @@ public function boot() $this->container->get('services_resetter')->reset(); } $this->resetServices = false; + if ($this->debug) { + $this->startTime = microtime(true); + } } return; } + if ($this->debug) { + $this->startTime = microtime(true); + } if ($this->debug && !isset($_ENV['SHELL_VERBOSITY']) && !isset($_SERVER['SHELL_VERBOSITY'])) { putenv('SHELL_VERBOSITY=3'); $_ENV['SHELL_VERBOSITY'] = 3; @@ -229,16 +227,16 @@ public function getBundles() public function getBundle($name, $first = true/*, $noDeprecation = false */) { $noDeprecation = false; - if (func_num_args() >= 3) { + if (\func_num_args() >= 3) { $noDeprecation = func_get_arg(2); } if (!$first && !$noDeprecation) { - @trigger_error(sprintf('Passing "false" as the second argument to %s() is deprecated as of 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing "false" as the second argument to "%s()" is deprecated as of 3.4 and will be removed in 4.0.', __METHOD__), E_USER_DEPRECATED); } if (!isset($this->bundleMap[$name])) { - throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, get_class($this))); + throw new \InvalidArgumentException(sprintf('Bundle "%s" does not exist or it is not enabled. Maybe you forgot to add it in the registerBundles() method of your %s.php file?', $name, \get_class($this))); } if (true === $first) { @@ -278,11 +276,7 @@ public function locateResource($name, $dir = null, $first = true) foreach ($bundles as $bundle) { if ($isResource && file_exists($file = $dir.'/'.$bundle->getName().$overridePath)) { if (null !== $resourceBundle) { - throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.', - $file, - $resourceBundle, - $dir.'/'.$bundles[0]->getName().$overridePath - )); + throw new \RuntimeException(sprintf('"%s" resource is hidden by a resource from the "%s" derived bundle. Create a "%s" file to override the bundle resource.', $file, $resourceBundle, $dir.'/'.$bundles[0]->getName().$overridePath)); } if ($first) { @@ -300,7 +294,7 @@ public function locateResource($name, $dir = null, $first = true) } } - if (count($files) > 0) { + if (\count($files) > 0) { return $first && $isResource ? $files[0] : $files; } @@ -345,7 +339,7 @@ public function getRootDir() { if (null === $this->rootDir) { $r = new \ReflectionObject($this); - $this->rootDir = dirname($r->getFileName()); + $this->rootDir = \dirname($r->getFileName()); } return $this->rootDir; @@ -360,12 +354,12 @@ public function getProjectDir() { if (null === $this->projectDir) { $r = new \ReflectionObject($this); - $dir = $rootDir = dirname($r->getFileName()); + $dir = $rootDir = \dirname($r->getFileName()); while (!file_exists($dir.'/composer.json')) { - if ($dir === dirname($dir)) { + if ($dir === \dirname($dir)) { return $this->projectDir = $rootDir; } - $dir = dirname($dir); + $dir = \dirname($dir); } $this->projectDir = $dir; } @@ -514,7 +508,7 @@ protected function initializeBundles() } // look for orphans - if (!empty($directChildren) && count($diff = array_diff_key($directChildren, $this->bundles))) { + if (!empty($directChildren) && \count($diff = array_diff_key($directChildren, $this->bundles))) { $diff = array_keys($diff); throw new \LogicException(sprintf('Bundle "%s" extends bundle "%s", which is not registered.', $directChildren[$diff[0]], $diff[0])); @@ -587,7 +581,7 @@ protected function initializeContainer() $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); $fresh = $oldContainer = false; try { - if (\is_object($this->container = include $cache->getPath())) { + if (file_exists($cache->getPath()) && \is_object($this->container = include $cache->getPath())) { $this->container->set('kernel', $this); $oldContainer = $this->container; $fresh = true; @@ -605,7 +599,7 @@ protected function initializeContainer() if ($this->debug) { $collectedLogs = array(); - $previousHandler = defined('PHPUNIT_COMPOSER_INSTALL'); + $previousHandler = \defined('PHPUNIT_COMPOSER_INSTALL'); $previousHandler = $previousHandler ?: set_error_handler(function ($type, $message, $file, $line) use (&$collectedLogs, &$previousHandler) { if (E_USER_DEPRECATED !== $type && E_DEPRECATED !== $type) { return $previousHandler ? $previousHandler($type, $message, $file, $line) : false; @@ -621,7 +615,7 @@ protected function initializeContainer() // Clean the trace by removing first frames added by the error handler itself. for ($i = 0; isset($backtrace[$i]); ++$i) { if (isset($backtrace[$i]['file'], $backtrace[$i]['line']) && $backtrace[$i]['line'] === $line && $backtrace[$i]['file'] === $file) { - $backtrace = array_slice($backtrace, 1 + $i); + $backtrace = \array_slice($backtrace, 1 + $i); break; } } @@ -650,7 +644,7 @@ protected function initializeContainer() } } - if (null === $oldContainer) { + if (null === $oldContainer && file_exists($cache->getPath())) { $errorLevel = error_reporting(\E_ALL ^ \E_WARNING); try { $oldContainer = include $cache->getPath(); @@ -660,20 +654,20 @@ protected function initializeContainer() error_reporting($errorLevel); } } - $oldContainer = is_object($oldContainer) ? new \ReflectionClass($oldContainer) : false; + $oldContainer = \is_object($oldContainer) ? new \ReflectionClass($oldContainer) : false; $this->dumpContainer($cache, $container, $class, $this->getContainerBaseClass()); $this->container = require $cache->getPath(); $this->container->set('kernel', $this); - if ($oldContainer && get_class($this->container) !== $oldContainer->name) { + if ($oldContainer && \get_class($this->container) !== $oldContainer->name) { // Because concurrent requests might still be using them, // old container files are not removed immediately, // but on a next dump of the container. static $legacyContainers = array(); - $oldContainerDir = dirname($oldContainer->getFileName()); + $oldContainerDir = \dirname($oldContainer->getFileName()); $legacyContainers[$oldContainerDir.'.legacy'] = true; - foreach (glob(dirname($oldContainerDir).DIRECTORY_SEPARATOR.'*.legacy') as $legacyContainer) { + foreach (glob(\dirname($oldContainerDir).\DIRECTORY_SEPARATOR.'*.legacy') as $legacyContainer) { if (!isset($legacyContainers[$legacyContainer]) && @unlink($legacyContainer)) { (new Filesystem())->remove(substr($legacyContainer, 0, -7)); } @@ -698,7 +692,7 @@ protected function getKernelParameters() $bundlesMetadata = array(); foreach ($this->bundles as $name => $bundle) { - $bundles[$name] = get_class($bundle); + $bundles[$name] = \get_class($bundle); $bundlesMetadata[$name] = array( 'parent' => $bundle->getParent(), 'path' => $bundle->getPath(), @@ -735,8 +729,8 @@ protected function getKernelParameters() */ protected function getEnvParameters() { - if (0 === func_num_args() || func_get_arg(0)) { - @trigger_error(sprintf('The %s() method is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax to get the value of any environment variable from configuration files instead.', __METHOD__), E_USER_DEPRECATED); + if (0 === \func_num_args() || func_get_arg(0)) { + @trigger_error(sprintf('The "%s()" method is deprecated as of 3.3 and will be removed in 4.0. Use the %%env()%% syntax to get the value of any environment variable from configuration files instead.', __METHOD__), E_USER_DEPRECATED); } $parameters = array(); @@ -861,14 +855,14 @@ protected function dumpContainer(ConfigCache $cache, ContainerBuilder $container )); $rootCode = array_pop($content); - $dir = dirname($cache->getPath()).'/'; + $dir = \dirname($cache->getPath()).'/'; $fs = new Filesystem(); foreach ($content as $file => $code) { $fs->dumpFile($dir.$file, $code); @chmod($dir.$file, 0666 & ~umask()); } - @unlink(dirname($dir.$file).'.legacy'); + @unlink(\dirname($dir.$file).'.legacy'); $cache->write($rootCode, $container->getResources()); } @@ -906,7 +900,7 @@ protected function getContainerLoader(ContainerInterface $container) */ public static function stripComments($source) { - if (!function_exists('token_get_all')) { + if (!\function_exists('token_get_all')) { return $source; } @@ -934,7 +928,7 @@ public static function stripComments($source) // replace multiple new lines with a single newline $rawChunk .= preg_replace(array('/\n{2,}/S'), "\n", $token[1]); - } elseif (in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { + } elseif (\in_array($token[0], array(T_COMMENT, T_DOC_COMMENT))) { $ignoreSpace = true; } else { $rawChunk .= $token[1]; diff --git a/vendor/symfony/http-kernel/KernelInterface.php b/vendor/symfony/http-kernel/KernelInterface.php index 9ec4e7a9f..d624d1219 100644 --- a/vendor/symfony/http-kernel/KernelInterface.php +++ b/vendor/symfony/http-kernel/KernelInterface.php @@ -11,9 +11,9 @@ namespace Symfony\Component\HttpKernel; +use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\HttpKernel\Bundle\BundleInterface; -use Symfony\Component\Config\Loader\LoaderInterface; /** * The Kernel is the heart of the Symfony system. @@ -131,7 +131,7 @@ public function getRootDir(); /** * Gets the current container. * - * @return ContainerInterface A ContainerInterface instance + * @return ContainerInterface|null A ContainerInterface instance or null when the Kernel is shutdown */ public function getContainer(); diff --git a/vendor/symfony/http-kernel/Log/Logger.php b/vendor/symfony/http-kernel/Log/Logger.php index 617efcf13..ca54d22f7 100644 --- a/vendor/symfony/http-kernel/Log/Logger.php +++ b/vendor/symfony/http-kernel/Log/Logger.php @@ -58,7 +58,7 @@ public function __construct($minLevel = null, $output = 'php://stderr', callable $this->minLevelIndex = self::$levels[$minLevel]; $this->formatter = $formatter ?: array($this, 'format'); - if (false === $this->handle = is_resource($output) ? $output : @fopen($output, 'a')) { + if (false === $this->handle = \is_resource($output) ? $output : @fopen($output, 'a')) { throw new InvalidArgumentException(sprintf('Unable to open "%s".', $output)); } } diff --git a/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php b/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php index e24b2e018..8bb57cf30 100644 --- a/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php +++ b/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php @@ -61,7 +61,7 @@ public function find($ip, $url, $limit, $method, $start = null, $end = null, $st fseek($file, 0, SEEK_END); $result = array(); - while (count($result) < $limit && $line = $this->readLineFromFile($file)) { + while (\count($result) < $limit && $line = $this->readLineFromFile($file)) { $values = str_getcsv($line); list($csvToken, $csvIp, $csvMethod, $csvUrl, $csvTime, $csvParent, $csvStatusCode) = $values; $csvTime = (int) $csvTime; @@ -136,7 +136,7 @@ public function write(Profile $profile) $profileIndexed = is_file($file); if (!$profileIndexed) { // Create directory - $dir = dirname($file); + $dir = \dirname($file); if (!is_dir($dir) && false === @mkdir($dir, 0777, true) && !is_dir($dir)) { throw new \RuntimeException(sprintf('Unable to create the storage directory (%s).', $dir)); } diff --git a/vendor/symfony/http-kernel/Profiler/Profile.php b/vendor/symfony/http-kernel/Profiler/Profile.php index c21c9d38a..9216f09e2 100644 --- a/vendor/symfony/http-kernel/Profiler/Profile.php +++ b/vendor/symfony/http-kernel/Profiler/Profile.php @@ -92,7 +92,7 @@ public function getParent() /** * Returns the parent token. * - * @return null|string The parent token + * @return string|null The parent token */ public function getParentToken() { diff --git a/vendor/symfony/http-kernel/Profiler/Profiler.php b/vendor/symfony/http-kernel/Profiler/Profiler.php index 15bfbc5a0..f252da476 100644 --- a/vendor/symfony/http-kernel/Profiler/Profiler.php +++ b/vendor/symfony/http-kernel/Profiler/Profiler.php @@ -11,12 +11,12 @@ namespace Symfony\Component\HttpKernel\Profiler; +use Psr\Log\LoggerInterface; use Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; use Symfony\Component\HttpKernel\DataCollector\LateDataCollectorInterface; -use Psr\Log\LoggerInterface; /** * Profiler. @@ -37,7 +37,7 @@ class Profiler private $enabled = true; /** - * @param bool $enable The initial enabled state + * @param bool $enable The initial enabled state */ public function __construct(ProfilerStorageInterface $storage, LoggerInterface $logger = null, $enable = true) { @@ -103,7 +103,7 @@ public function saveProfile(Profile $profile) } if (!($ret = $this->storage->write($profile)) && null !== $this->logger) { - $this->logger->warning('Unable to store the profiler information.', array('configured_storage' => get_class($this->storage))); + $this->logger->warning('Unable to store the profiler information.', array('configured_storage' => \get_class($this->storage))); } return $ret; diff --git a/vendor/symfony/http-kernel/Tests/Bundle/BundleTest.php b/vendor/symfony/http-kernel/Tests/Bundle/BundleTest.php index 8e52b097d..3408d7acd 100644 --- a/vendor/symfony/http-kernel/Tests/Bundle/BundleTest.php +++ b/vendor/symfony/http-kernel/Tests/Bundle/BundleTest.php @@ -14,10 +14,10 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Bundle\Bundle; -use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle\ExtensionNotValidBundle; -use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\ExtensionPresentBundle; use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionAbsentBundle\ExtensionAbsentBundle; +use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionNotValidBundle\ExtensionNotValidBundle; use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\Command\FooCommand; +use Symfony\Component\HttpKernel\Tests\Fixtures\ExtensionPresentBundle\ExtensionPresentBundle; class BundleTest extends TestCase { diff --git a/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php b/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php index 3e20efbf1..b3bed4e87 100644 --- a/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php +++ b/vendor/symfony/http-kernel/Tests/CacheClearer/Psr6CacheClearerTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\HttpKernel\Tests\CacheClearer; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer; use Psr\Cache\CacheItemPoolInterface; +use Symfony\Component\HttpKernel\CacheClearer\Psr6CacheClearer; class Psr6CacheClearerTest extends TestCase { diff --git a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerTest.php b/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerTest.php index 05666cb0d..4d34e7bfc 100644 --- a/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerTest.php +++ b/vendor/symfony/http-kernel/Tests/CacheWarmer/CacheWarmerTest.php @@ -31,7 +31,7 @@ public static function tearDownAfterClass() public function testWriteCacheFileCreatesTheFile() { $warmer = new TestCacheWarmer(self::$cacheFile); - $warmer->warmUp(dirname(self::$cacheFile)); + $warmer->warmUp(\dirname(self::$cacheFile)); $this->assertFileExists(self::$cacheFile); } @@ -43,7 +43,7 @@ public function testWriteNonWritableCacheFileThrowsARuntimeException() { $nonWritableFile = '/this/file/is/very/probably/not/writable'; $warmer = new TestCacheWarmer($nonWritableFile); - $warmer->warmUp(dirname($nonWritableFile)); + $warmer->warmUp(\dirname($nonWritableFile)); } } diff --git a/vendor/symfony/http-kernel/Tests/ClientTest.php b/vendor/symfony/http-kernel/Tests/ClientTest.php index b774d8ec7..5af273086 100644 --- a/vendor/symfony/http-kernel/Tests/ClientTest.php +++ b/vendor/symfony/http-kernel/Tests/ClientTest.php @@ -12,11 +12,11 @@ namespace Symfony\Component\HttpKernel\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Client; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\StreamedResponse; use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\File\UploadedFile; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\StreamedResponse; +use Symfony\Component\HttpKernel\Client; use Symfony\Component\HttpKernel\Tests\Fixtures\TestClient; /** @@ -120,7 +120,7 @@ public function testUploadedFile() $this->assertTrue($file->isValid()); } - $file->move(dirname($target), basename($target)); + $file->move(\dirname($target), basename($target)); $this->assertFileExists($target); unlink($target); diff --git a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php index 7d34172ce..f6a368963 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolver/ServiceValueResolverTest.php @@ -66,6 +66,24 @@ public function testExistingControllerWithATrailingBackSlash() $this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument)); } + public function testExistingControllerWithMethodNameStartUppercase() + { + $resolver = new ServiceValueResolver(new ServiceLocator(array( + 'App\\Controller\\Mine::method' => function () { + return new ServiceLocator(array( + 'dummy' => function () { + return new DummyService(); + }, + )); + }, + ))); + $request = $this->requestWithAttributes(array('_controller' => 'App\\Controller\\Mine::Method')); + $argument = new ArgumentMetadata('dummy', DummyService::class, false, false, null); + + $this->assertTrue($resolver->supports($request, $argument)); + $this->assertYieldEquals(array(new DummyService()), $resolver->resolve($request, $argument)); + } + public function testControllerNameIsAnArray() { $resolver = new ServiceValueResolver(new ServiceLocator(array( diff --git a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php index 080413903..729b90b2f 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ArgumentResolverTest.php @@ -12,6 +12,7 @@ namespace Symfony\Component\HttpKernel\Tests\Controller; use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; @@ -23,7 +24,6 @@ use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\ExtendingSession; use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\NullableController; use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\VariadicController; -use Symfony\Component\HttpFoundation\Request; class ArgumentResolverTest extends TestCase { diff --git a/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php index 0019123b6..82407f560 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ContainerControllerResolverTest.php @@ -39,7 +39,7 @@ public function testGetControllerService() $controller = $resolver->getController($request); - $this->assertInstanceOf(get_class($this), $controller[0]); + $this->assertInstanceOf(\get_class($this), $controller[0]); $this->assertSame('controllerMethod1', $controller[1]); } diff --git a/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php b/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php index 190e15ad6..87f598d16 100644 --- a/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php +++ b/vendor/symfony/http-kernel/Tests/Controller/ControllerResolverTest.php @@ -13,10 +13,10 @@ use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Controller\ControllerResolver; use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\NullableController; use Symfony\Component\HttpKernel\Tests\Fixtures\Controller\VariadicController; -use Symfony\Component\HttpFoundation\Request; class ControllerResolverTest extends TestCase { diff --git a/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php b/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php index b4b449f35..bf0db5ad5 100644 --- a/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php +++ b/vendor/symfony/http-kernel/Tests/ControllerMetadata/ArgumentMetadataFactoryTest.php @@ -126,11 +126,11 @@ public function testNullableTypesSignature() ), $arguments); } - private function signature1(ArgumentMetadataFactoryTest $foo, array $bar, callable $baz) + private function signature1(self $foo, array $bar, callable $baz) { } - private function signature2(ArgumentMetadataFactoryTest $foo = null, FakeClassThatDoesNotExist $bar = null, ImportedAndFake $baz = null) + private function signature2(self $foo = null, FakeClassThatDoesNotExist $bar = null, ImportedAndFake $baz = null) { } diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php index 4fb36afda..3f51b13ce 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/ConfigDataCollectorTest.php @@ -12,11 +12,11 @@ namespace Symfony\Component\HttpKernel\Tests\DataCollector; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\DataCollector\ConfigDataCollector; +use Symfony\Component\HttpKernel\Kernel; class ConfigDataCollectorTest extends TestCase { @@ -38,9 +38,9 @@ public function testCollect() $this->assertSame(date_default_timezone_get(), $c->getPhpTimezone()); $this->assertSame(Kernel::VERSION, $c->getSymfonyVersion()); $this->assertNull($c->getToken()); - $this->assertSame(extension_loaded('xdebug'), $c->hasXDebug()); - $this->assertSame(extension_loaded('Zend OPcache') && ini_get('opcache.enable'), $c->hasZendOpcache()); - $this->assertSame(extension_loaded('apcu') && ini_get('apc.enabled'), $c->hasApcu()); + $this->assertSame(\extension_loaded('xdebug'), $c->hasXDebug()); + $this->assertSame(\extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN), $c->hasZendOpcache()); + $this->assertSame(\extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN), $c->hasApcu()); } } diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php index d809331cb..fd5ea11e7 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/DumpDataCollectorTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\HttpKernel\Tests\DataCollector; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\DataCollector\DumpDataCollector; use Symfony\Component\VarDumper\Cloner\Data; use Symfony\Component\VarDumper\Dumper\CliDumper; diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php index 178f1f01a..1e8d186cc 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/ExceptionDataCollectorTest.php @@ -13,9 +13,9 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Debug\Exception\FlattenException; -use Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\DataCollector\ExceptionDataCollector; class ExceptionDataCollectorTest extends TestCase { diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php index ab78e9e8e..1435d05e8 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/MemoryDataCollectorTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\HttpKernel\Tests\DataCollector; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DataCollector\MemoryDataCollector; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\DataCollector\MemoryDataCollector; class MemoryDataCollectorTest extends TestCase { diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php index 69bef76d4..cce08e27c 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/RequestDataCollectorTest.php @@ -12,20 +12,20 @@ namespace Symfony\Component\HttpKernel\Tests\DataCollector; use PHPUnit\Framework\TestCase; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\ParameterBag; use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\HttpFoundation\Session\Storage\MockArraySessionStorage; use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; +use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector; +use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector; -use Symfony\Component\HttpKernel\Event\FilterControllerEvent; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Cookie; -use Symfony\Component\EventDispatcher\EventDispatcher; class RequestDataCollectorTest extends TestCase { diff --git a/vendor/symfony/http-kernel/Tests/DataCollector/TimeDataCollectorTest.php b/vendor/symfony/http-kernel/Tests/DataCollector/TimeDataCollectorTest.php index 8048cc37a..cf6a86695 100644 --- a/vendor/symfony/http-kernel/Tests/DataCollector/TimeDataCollectorTest.php +++ b/vendor/symfony/http-kernel/Tests/DataCollector/TimeDataCollectorTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\HttpKernel\Tests\DataCollector; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DataCollector\TimeDataCollector; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\DataCollector\TimeDataCollector; /** * @group time-sensitive diff --git a/vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php b/vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php index d616098a5..5c93bd90e 100644 --- a/vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php +++ b/vendor/symfony/http-kernel/Tests/Debug/FileLinkFormatterTest.php @@ -27,7 +27,7 @@ public function testWhenNoFileLinkFormatAndNoRequest() public function testWhenFileLinkFormatAndNoRequest() { - $file = __DIR__.DIRECTORY_SEPARATOR.'file.php'; + $file = __DIR__.\DIRECTORY_SEPARATOR.'file.php'; $sut = new FileLinkFormatter('debug://open?url=file://%f&line=%l', new RequestStack()); @@ -36,8 +36,7 @@ public function testWhenFileLinkFormatAndNoRequest() public function testWhenFileLinkFormatAndRequest() { - $file = __DIR__.DIRECTORY_SEPARATOR.'file.php'; - $baseDir = __DIR__; + $file = __DIR__.\DIRECTORY_SEPARATOR.'file.php'; $requestStack = new RequestStack(); $request = new Request(); $requestStack->push($request); @@ -49,19 +48,19 @@ public function testWhenFileLinkFormatAndRequest() public function testWhenNoFileLinkFormatAndRequest() { - $file = __DIR__.DIRECTORY_SEPARATOR.'file.php'; + $file = __DIR__.\DIRECTORY_SEPARATOR.'file.php'; $requestStack = new RequestStack(); $request = new Request(); $requestStack->push($request); $request->server->set('SERVER_NAME', 'www.example.org'); $request->server->set('SERVER_PORT', 80); - $request->server->set('SCRIPT_NAME', '/app.php'); - $request->server->set('SCRIPT_FILENAME', '/web/app.php'); - $request->server->set('REQUEST_URI', '/app.php/example'); + $request->server->set('SCRIPT_NAME', '/index.php'); + $request->server->set('SCRIPT_FILENAME', '/public/index.php'); + $request->server->set('REQUEST_URI', '/index.php/example'); $sut = new FileLinkFormatter(null, $requestStack, __DIR__, '/_profiler/open?file=%f&line=%l#line%l'); - $this->assertSame('http://www.example.org/app.php/_profiler/open?file=file.php&line=3#line3', $sut->format($file, 3)); + $this->assertSame('http://www.example.org/_profiler/open?file=file.php&line=3#line3', $sut->format($file, 3)); } } diff --git a/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php b/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php index aaa82d524..3de147c7f 100644 --- a/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php +++ b/vendor/symfony/http-kernel/Tests/Debug/TraceableEventDispatcherTest.php @@ -13,11 +13,11 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher; use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Stopwatch\Stopwatch; class TraceableEventDispatcherTest extends TestCase diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php index 730214837..95baaa54c 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/LazyLoadingFragmentHandlerTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\HttpKernel\Tests\DependencyInjection; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\DependencyInjection\LazyLoadingFragmentHandler; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\DependencyInjection\LazyLoadingFragmentHandler; class LazyLoadingFragmentHandlerTest extends TestCase { diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/LoggerPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/LoggerPassTest.php index b199e11da..cb504877c 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/LoggerPassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/LoggerPassTest.php @@ -13,9 +13,9 @@ use PHPUnit\Framework\TestCase; use Psr\Log\LoggerInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\DependencyInjection\LoggerPass; use Symfony\Component\HttpKernel\Log\Logger; -use Symfony\Component\DependencyInjection\ContainerBuilder; /** * @author Kévin Dunglas diff --git a/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php b/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php index 4016deb4a..ca121c732 100644 --- a/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php +++ b/vendor/symfony/http-kernel/Tests/DependencyInjection/RegisterControllerArgumentLocatorsPassTest.php @@ -13,13 +13,14 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\Argument\ServiceClosureArgument; +use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerAwareInterface; use Symfony\Component\DependencyInjection\ContainerAwareTrait; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerInterface; +use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\DependencyInjection\ServiceLocator; use Symfony\Component\DependencyInjection\TypedReference; -use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\HttpKernel\DependencyInjection\RegisterControllerArgumentLocatorsPass; class RegisterControllerArgumentLocatorsPassTest extends TestCase @@ -326,6 +327,29 @@ public function testDoNotBindScalarValueToControllerArgument() $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); $this->assertEmpty($locator); } + + public function testBindingsOnChildDefinitions() + { + $container = new ContainerBuilder(); + $resolver = $container->register('argument_resolver.service')->addArgument(array()); + + $container->register('parent', ArgumentWithoutTypeController::class); + + $container->setDefinition('child', (new ChildDefinition('parent')) + ->setBindings(array('$someArg' => new Reference('parent'))) + ->addTag('controller.service_arguments') + ); + + $pass = new RegisterControllerArgumentLocatorsPass(); + $pass->process($container); + + $locator = $container->getDefinition((string) $resolver->getArgument(0))->getArgument(0); + $this->assertInstanceOf(ServiceClosureArgument::class, $locator['child:fooAction']); + + $locator = $container->getDefinition((string) $locator['child:fooAction']->getValues()[0])->getArgument(0); + $this->assertInstanceOf(ServiceClosureArgument::class, $locator['someArg']); + $this->assertEquals(new Reference('parent'), $locator['someArg']->getValues()[0]); + } } class RegisterTestController diff --git a/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php b/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php index 9165d31f2..f1e440b2f 100644 --- a/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php +++ b/vendor/symfony/http-kernel/Tests/Event/FilterControllerArgumentsEventTest.php @@ -2,9 +2,9 @@ namespace Symfony\Component\HttpKernel\Tests\Event; +use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent; -use PHPUnit\Framework\TestCase; use Symfony\Component\HttpKernel\Tests\TestHttpKernel; class FilterControllerArgumentsEventTest extends TestCase diff --git a/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php index f4878f626..3ffb9f3d6 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/AddRequestFormatsListenerTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\EventListener\AddRequestFormatsListener; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\EventListener\AddRequestFormatsListener; use Symfony\Component\HttpKernel\KernelEvents; /** diff --git a/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php index 467b8dde8..9a9c17eda 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/DebugHandlersListenerTest.php @@ -13,9 +13,9 @@ use PHPUnit\Framework\TestCase; use Psr\Log\LogLevel; -use Symfony\Component\Console\Event\ConsoleEvent; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\ConsoleEvents; +use Symfony\Component\Console\Event\ConsoleEvent; use Symfony\Component\Console\Helper\HelperSet; use Symfony\Component\Console\Input\ArgvInput; use Symfony\Component\Console\Output\ConsoleOutput; diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php index b607bf900..0b73075e7 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ExceptionListenerTest.php @@ -13,14 +13,14 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\EventListener\ExceptionListener; +use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; use Symfony\Component\HttpKernel\Log\DebugLoggerInterface; -use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Tests\Logger; /** @@ -37,9 +37,9 @@ public function testConstruct() $logger = new TestLogger(); $l = new ExceptionListener('foo', $logger); - $_logger = new \ReflectionProperty(get_class($l), 'logger'); + $_logger = new \ReflectionProperty(\get_class($l), 'logger'); $_logger->setAccessible(true); - $_controller = new \ReflectionProperty(get_class($l), 'controller'); + $_controller = new \ReflectionProperty(\get_class($l), 'controller'); $_controller->setAccessible(true); $this->assertSame($logger, $_logger->getValue($l)); @@ -151,30 +151,13 @@ public function testCSPHeaderIsRemoved() $this->assertFalse($response->headers->has('content-security-policy'), 'CSP header has been removed'); $this->assertFalse($dispatcher->hasListeners(KernelEvents::RESPONSE), 'CSP removal listener has been removed'); } - - public function testNullController() - { - $listener = new ExceptionListener(null); - $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); - $kernel->expects($this->once())->method('handle')->will($this->returnCallback(function (Request $request) { - $controller = $request->attributes->get('_controller'); - - return $controller(); - })); - $request = Request::create('/'); - $event = new GetResponseForExceptionEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, new \Exception('foo')); - - $listener->onKernelException($event); - - $this->assertContains('Whoops, looks like something went wrong.', $event->getResponse()->getContent()); - } } class TestLogger extends Logger implements DebugLoggerInterface { public function countErrors() { - return count($this->logs['critical']); + return \count($this->logs['critical']); } } diff --git a/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php index 464b2ab46..edf049826 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/FragmentListenerTest.php @@ -12,10 +12,10 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\EventListener\FragmentListener; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\EventListener\FragmentListener; +use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\UriSigner; class FragmentListenerTest extends TestCase diff --git a/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php index 332393eea..f442235ad 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/LocaleListenerTest.php @@ -13,9 +13,9 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\EventListener\LocaleListener; use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; class LocaleListenerTest extends TestCase { diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php index 751aee869..526b3aa75 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ProfilerListenerTest.php @@ -13,10 +13,10 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\RequestStack; -use Symfony\Component\HttpKernel\EventListener\ProfilerListener; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Event\PostResponseEvent; +use Symfony\Component\HttpKernel\EventListener\ProfilerListener; use Symfony\Component\HttpKernel\Exception\HttpException; use Symfony\Component\HttpKernel\Kernel; diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php index 12a31eb3e..1d8960267 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ResponseListenerTest.php @@ -12,13 +12,13 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\EventListener\ResponseListener; +use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\EventListener\ResponseListener; +use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\EventDispatcher\EventDispatcher; class ResponseListenerTest extends TestCase { diff --git a/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php index 342dfc367..ecbce409f 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/RouterListenerTest.php @@ -18,12 +18,12 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Controller\ArgumentResolver; use Symfony\Component\HttpKernel\Controller\ControllerResolver; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\EventListener\ExceptionListener; use Symfony\Component\HttpKernel\EventListener\RouterListener; use Symfony\Component\HttpKernel\EventListener\ValidateRequestListener; -use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\Routing\Exception\NoConfigurationException; use Symfony\Component\Routing\RequestContext; diff --git a/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php index 34598363c..1b95d19f9 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/SessionListenerTest.php @@ -16,8 +16,9 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Session\Session; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\Event\FinishRequestEvent; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\EventListener\AbstractSessionListener; use Symfony\Component\HttpKernel\EventListener\SessionListener; use Symfony\Component\HttpKernel\HttpKernelInterface; @@ -58,8 +59,7 @@ public function testSessionIsSet() public function testResponseIsPrivate() { $session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); - $session->expects($this->once())->method('isStarted')->willReturn(false); - $session->expects($this->once())->method('hasBeenStarted')->willReturn(true); + $session->expects($this->exactly(2))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1)); $container = new Container(); $container->set('session', $session); @@ -76,4 +76,38 @@ public function testResponseIsPrivate() $this->assertTrue($response->headers->hasCacheControlDirective('must-revalidate')); $this->assertSame('0', $response->headers->getCacheControlDirective('max-age')); } + + public function testSurrogateMasterRequestIsPublic() + { + $session = $this->getMockBuilder(Session::class)->disableOriginalConstructor()->getMock(); + $session->expects($this->exactly(4))->method('getUsageIndex')->will($this->onConsecutiveCalls(0, 1, 1, 1)); + + $container = new Container(); + $container->set('session', $session); + + $listener = new SessionListener($container); + $kernel = $this->getMockBuilder(HttpKernelInterface::class)->disableOriginalConstructor()->getMock(); + + $request = new Request(); + $response = new Response(); + $response->setCache(array('public' => true, 'max_age' => '30')); + $listener->onKernelRequest(new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST)); + $this->assertTrue($request->hasSession()); + + $subRequest = clone $request; + $this->assertSame($request->getSession(), $subRequest->getSession()); + $listener->onKernelRequest(new GetResponseEvent($kernel, $subRequest, HttpKernelInterface::MASTER_REQUEST)); + $listener->onKernelResponse(new FilterResponseEvent($kernel, $subRequest, HttpKernelInterface::MASTER_REQUEST, $response)); + $listener->onFinishRequest(new FinishRequestEvent($kernel, $subRequest, HttpKernelInterface::MASTER_REQUEST)); + + $this->assertFalse($response->headers->hasCacheControlDirective('private')); + $this->assertFalse($response->headers->hasCacheControlDirective('must-revalidate')); + $this->assertSame('30', $response->headers->getCacheControlDirective('max-age')); + + $listener->onKernelResponse(new FilterResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, $response)); + + $this->assertTrue($response->headers->hasCacheControlDirective('private')); + $this->assertTrue($response->headers->hasCacheControlDirective('must-revalidate')); + $this->assertSame('0', $response->headers->getCacheControlDirective('max-age')); + } } diff --git a/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php index 1e79ebe05..b955c07d4 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/SurrogateListenerTest.php @@ -12,14 +12,14 @@ namespace Symfony\Component\HttpKernel\Tests\EventListener; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\HttpCache\Esi; -use Symfony\Component\HttpKernel\EventListener\SurrogateListener; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; -use Symfony\Component\HttpKernel\KernelEvents; +use Symfony\Component\HttpKernel\EventListener\SurrogateListener; +use Symfony\Component\HttpKernel\HttpCache\Esi; use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\HttpKernel\KernelEvents; class SurrogateListenerTest extends TestCase { diff --git a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php index 22a2b7123..0d0985ca5 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/TestSessionListenerTest.php @@ -13,14 +13,14 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\DependencyInjection\ServiceSubscriberInterface; -use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\Event\GetResponseEvent; -use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpFoundation\Session\SessionInterface; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; +use Symfony\Component\HttpKernel\Event\GetResponseEvent; use Symfony\Component\HttpKernel\EventListener\SessionListener; use Symfony\Component\HttpKernel\EventListener\TestSessionListener; -use Symfony\Component\HttpFoundation\Session\SessionInterface; +use Symfony\Component\HttpKernel\HttpKernelInterface; /** * SessionListenerTest. @@ -106,6 +106,36 @@ public function testEmptySessionWithNewSessionIdDoesSendCookie() $this->assertNotEmpty($response->headers->getCookies()); } + /** + * @dataProvider anotherCookieProvider + */ + public function testSessionWithNewSessionIdAndNewCookieDoesNotSendAnotherCookie($existing, array $expected) + { + $this->sessionHasBeenStarted(); + $this->sessionIsEmpty(); + $this->fixSessionId('456'); + + $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); + $request = Request::create('/', 'GET', array(), array('MOCKSESSID' => '123')); + $event = new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST); + $this->listener->onKernelRequest($event); + + $response = new Response('', 200, array('Set-Cookie' => $existing)); + + $response = $this->filterResponse(new Request(), HttpKernelInterface::MASTER_REQUEST, $response); + + $this->assertSame($expected, $response->headers->get('Set-Cookie', null, false)); + } + + public function anotherCookieProvider() + { + return array( + 'same' => array('MOCKSESSID=789; path=/', array('MOCKSESSID=789; path=/')), + 'different domain' => array('MOCKSESSID=789; path=/; domain=example.com', array('MOCKSESSID=789; path=/; domain=example.com', 'MOCKSESSID=456; path=/')), + 'different path' => array('MOCKSESSID=789; path=/foo', array('MOCKSESSID=789; path=/foo', 'MOCKSESSID=456; path=/')), + ); + } + public function testUnstartedSessionIsNotSave() { $this->sessionHasNotBeenStarted(); @@ -123,10 +153,10 @@ public function testDoesNotImplementServiceSubscriberInterface() $this->assertFalse(is_subclass_of(TestSessionListener::class, ServiceSubscriberInterface::class, 'Implementing ServiceSubscriberInterface would create a dep on the DI component, which eg Silex cannot afford')); } - private function filterResponse(Request $request, $type = HttpKernelInterface::MASTER_REQUEST) + private function filterResponse(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, Response $response = null) { $request->setSession($this->session); - $response = new Response(); + $response = $response ?: new Response(); $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); $event = new FilterResponseEvent($kernel, $request, $type, $response); diff --git a/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php b/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php index d06094325..bdab742ce 100644 --- a/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php +++ b/vendor/symfony/http-kernel/Tests/EventListener/ValidateRequestListenerTest.php @@ -14,13 +14,18 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpKernel\EventListener\ValidateRequestListener; use Symfony\Component\HttpKernel\Event\GetResponseEvent; +use Symfony\Component\HttpKernel\EventListener\ValidateRequestListener; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; class ValidateRequestListenerTest extends TestCase { + protected function tearDown() + { + Request::setTrustedProxies(array(), -1); + } + /** * @expectedException \Symfony\Component\HttpFoundation\Exception\ConflictingHeadersException */ diff --git a/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php index 760366c69..05d8d787a 100644 --- a/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php +++ b/vendor/symfony/http-kernel/Tests/Exception/UnprocessableEntityHttpExceptionTest.php @@ -6,21 +6,6 @@ class UnprocessableEntityHttpExceptionTest extends HttpExceptionTest { - /** - * Test that setting the headers using the setter function - * is working as expected. - * - * @param array $headers The headers to set - * - * @dataProvider headerDataProvider - */ - public function testHeadersSetter($headers) - { - $exception = new UnprocessableEntityHttpException(10); - $exception->setHeaders($headers); - $this->assertSame($headers, $exception->getHeaders()); - } - protected function createException() { return new UnprocessableEntityHttpException(); diff --git a/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php b/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php index d47287a1f..4dae039c1 100644 --- a/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php +++ b/vendor/symfony/http-kernel/Tests/Exception/UnsupportedMediaTypeHttpExceptionTest.php @@ -6,17 +6,7 @@ class UnsupportedMediaTypeHttpExceptionTest extends HttpExceptionTest { - /** - * @dataProvider headerDataProvider - */ - public function testHeadersSetter($headers) - { - $exception = new UnsupportedMediaTypeHttpException(10); - $exception->setHeaders($headers); - $this->assertSame($headers, $exception->getHeaders()); - } - - protected function createException($headers = array()) + protected function createException() { return new UnsupportedMediaTypeHttpException(); } diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/123/Kernel123.php b/vendor/symfony/http-kernel/Tests/Fixtures/123/Kernel123.php index b6cf1cba2..d3a76684d 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/123/Kernel123.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/123/Kernel123.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpKernel\Tests\Fixtures\_123; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\HttpKernel\Kernel; class Kernel123 extends Kernel { diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/KernelForOverrideName.php b/vendor/symfony/http-kernel/Tests/Fixtures/KernelForOverrideName.php index a1102ab78..f7baaa632 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/KernelForOverrideName.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/KernelForOverrideName.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpKernel\Tests\Fixtures; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\HttpKernel\Kernel; class KernelForOverrideName extends Kernel { diff --git a/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php b/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php index 5fd61bbc7..9acee4cac 100644 --- a/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php +++ b/vendor/symfony/http-kernel/Tests/Fixtures/KernelForTest.php @@ -11,8 +11,8 @@ namespace Symfony\Component\HttpKernel\Tests\Fixtures; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\HttpKernel\Kernel; class KernelForTest extends Kernel { diff --git a/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php index 7099b4d7e..00d796d52 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/EsiFragmentRendererTest.php @@ -12,10 +12,10 @@ namespace Symfony\Component\HttpKernel\Tests\Fragment; use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Controller\ControllerReference; use Symfony\Component\HttpKernel\Fragment\EsiFragmentRenderer; use Symfony\Component\HttpKernel\HttpCache\Esi; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\UriSigner; class EsiFragmentRendererTest extends TestCase diff --git a/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php b/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php index 9c906b50a..a296aa0e1 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/FragmentHandlerTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\HttpKernel\Tests\Fragment; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Fragment\FragmentHandler; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Fragment\FragmentHandler; /** * @group time-sensitive @@ -88,7 +88,7 @@ protected function getHandler($returnValue, $arguments = array()) ; if ($arguments) { - call_user_func_array(array($e, 'with'), $arguments); + \call_user_func_array(array($e, 'with'), $arguments); } $handler = new FragmentHandler($this->requestStack); diff --git a/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php index 1be052e5e..10fbccf0f 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/HIncludeFragmentRendererTest.php @@ -12,10 +12,10 @@ namespace Symfony\Component\HttpKernel\Tests\Fragment; use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Controller\ControllerReference; use Symfony\Component\HttpKernel\Fragment\HIncludeFragmentRenderer; use Symfony\Component\HttpKernel\UriSigner; -use Symfony\Component\HttpFoundation\Request; class HIncludeFragmentRendererTest extends TestCase { @@ -86,4 +86,17 @@ public function testRenderWithDefaultText() $strategy = new HIncludeFragmentRenderer($engine); $this->assertEquals('default', $strategy->render('/foo', Request::create('/'), array('default' => 'default'))->getContent()); } + + public function testRenderWithEngineAndDefaultText() + { + $engine = $this->getMockBuilder('Symfony\\Component\\Templating\\EngineInterface')->getMock(); + $engine->expects($this->once()) + ->method('exists') + ->with('loading...') + ->will($this->throwException(new \RuntimeException())); + + // only default + $strategy = new HIncludeFragmentRenderer($engine); + $this->assertEquals('loading...', $strategy->render('/foo', Request::create('/'), array('default' => 'loading...'))->getContent()); + } } diff --git a/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php index 18e55a5be..80f9cd2b5 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/InlineFragmentRendererTest.php @@ -12,16 +12,16 @@ namespace Symfony\Component\HttpKernel\Tests\Fragment; use PHPUnit\Framework\TestCase; +use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Controller\ArgumentResolver; -use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; use Symfony\Component\HttpKernel\Controller\ControllerReference; -use Symfony\Component\HttpKernel\HttpKernel; +use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; use Symfony\Component\HttpKernel\Fragment\InlineFragmentRenderer; +use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\EventDispatcher\EventDispatcher; class InlineFragmentRendererTest extends TestCase { @@ -46,7 +46,9 @@ public function testRenderWithObjectsAsAttributes() $subRequest = Request::create('/_fragment?_path=_format%3Dhtml%26_locale%3Den%26_controller%3Dmain_controller'); $subRequest->attributes->replace(array('object' => $object, '_format' => 'html', '_controller' => 'main_controller', '_locale' => 'en')); $subRequest->headers->set('x-forwarded-for', array('127.0.0.1')); + $subRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); $subRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); + $subRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($subRequest)); @@ -99,7 +101,11 @@ public function testRenderWithTrustedHeaderDisabled() { Request::setTrustedProxies(array(), 0); - $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest(Request::create('/'))); + $expectedSubRequest = Request::create('/'); + $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); + $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); + + $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); $this->assertSame('foo', $strategy->render('/', Request::create('/'))->getContent()); Request::setTrustedProxies(array(), -1); @@ -183,6 +189,26 @@ public function testExceptionInSubRequestsDoesNotMangleOutputBuffers() $this->assertEquals('Foo', ob_get_clean()); } + public function testLocaleAndFormatAreIsKeptInSubrequest() + { + $expectedSubRequest = Request::create('/'); + $expectedSubRequest->attributes->set('_format', 'foo'); + $expectedSubRequest->setLocale('fr'); + if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) { + $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); + $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); + } + $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); + + $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); + + $request = Request::create('/'); + $request->attributes->set('_format', 'foo'); + $request->setLocale('fr'); + $strategy->render('/', $request); + } + public function testESIHeaderIsKeptInSubrequest() { $expectedSubRequest = Request::create('/'); @@ -192,6 +218,8 @@ public function testESIHeaderIsKeptInSubrequest() $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); } + $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); @@ -202,7 +230,7 @@ public function testESIHeaderIsKeptInSubrequest() public function testESIHeaderIsKeptInSubrequestWithTrustedHeaderDisabled() { - Request::setTrustedProxies(array(), 0); + Request::setTrustedProxies(array(), Request::HEADER_FORWARDED); $this->testESIHeaderIsKeptInSubrequest(); @@ -212,16 +240,58 @@ public function testESIHeaderIsKeptInSubrequestWithTrustedHeaderDisabled() public function testHeadersPossiblyResultingIn304AreNotAssignedToSubrequest() { $expectedSubRequest = Request::create('/'); - if (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) { - $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); - $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); - } + $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); + $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); + $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); $request = Request::create('/', 'GET', array(), array(), array(), array('HTTP_IF_MODIFIED_SINCE' => 'Fri, 01 Jan 2016 00:00:00 GMT', 'HTTP_IF_NONE_MATCH' => '*')); $strategy->render('/', $request); } + public function testFirstTrustedProxyIsSetAsRemote() + { + Request::setTrustedProxies(array('1.1.1.1'), -1); + + $expectedSubRequest = Request::create('/'); + $expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); + $expectedSubRequest->server->set('REMOTE_ADDR', '127.0.0.1'); + $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); + $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); + $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); + + $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); + + $request = Request::create('/'); + $request->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); + $strategy->render('/', $request); + + Request::setTrustedProxies(array(), -1); + } + + public function testIpAddressOfRangedTrustedProxyIsSetAsRemote() + { + $expectedSubRequest = Request::create('/'); + $expectedSubRequest->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); + $expectedSubRequest->server->set('REMOTE_ADDR', '127.0.0.1'); + $expectedSubRequest->headers->set('x-forwarded-for', array('127.0.0.1')); + $expectedSubRequest->headers->set('forwarded', array('for="127.0.0.1";host="localhost";proto=http')); + $expectedSubRequest->server->set('HTTP_X_FORWARDED_FOR', '127.0.0.1'); + $expectedSubRequest->server->set('HTTP_FORWARDED', 'for="127.0.0.1";host="localhost";proto=http'); + + Request::setTrustedProxies(array('1.1.1.1/24'), -1); + + $strategy = new InlineFragmentRenderer($this->getKernelExpectingRequest($expectedSubRequest)); + + $request = Request::create('/'); + $request->headers->set('Surrogate-Capability', 'abc="ESI/1.0"'); + $strategy->render('/', $request); + + Request::setTrustedProxies(array(), -1); + } + /** * Creates a Kernel expecting a request equals to $request * Allows delta in comparison in case REQUEST_TIME changed by 1 second. diff --git a/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php b/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php index b537625f2..f72580311 100644 --- a/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php +++ b/vendor/symfony/http-kernel/Tests/Fragment/SsiFragmentRendererTest.php @@ -12,10 +12,10 @@ namespace Symfony\Component\HttpKernel\Tests\Fragment; use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\Controller\ControllerReference; use Symfony\Component\HttpKernel\Fragment\SsiFragmentRenderer; use Symfony\Component\HttpKernel\HttpCache\Ssi; -use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpKernel\UriSigner; class SsiFragmentRendererTest extends TestCase diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php index a8662b2a2..863ad7614 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/EsiTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\HttpKernel\Tests\HttpCache; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\HttpCache\Esi; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\HttpCache\Esi; class EsiTest extends TestCase { @@ -231,10 +231,10 @@ protected function getCache($request, $response) ->method('getRequest') ->will($this->returnValue($request)) ; - if (is_array($response)) { + if (\is_array($response)) { $cache->expects($this->any()) ->method('handle') - ->will(call_user_func_array(array($this, 'onConsecutiveCalls'), $response)) + ->will(\call_user_func_array(array($this, 'onConsecutiveCalls'), $response)) ; } else { $cache->expects($this->any()) diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php index 2a9a30d9c..a41d86650 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTest.php @@ -11,9 +11,11 @@ namespace Symfony\Component\HttpKernel\Tests\HttpCache; -use Symfony\Component\HttpKernel\HttpCache\HttpCache; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\HttpCache\Esi; +use Symfony\Component\HttpKernel\HttpCache\HttpCache; +use Symfony\Component\HttpKernel\HttpCache\Store; use Symfony\Component\HttpKernel\HttpKernelInterface; /** @@ -213,7 +215,7 @@ public function testValidatesPrivateResponsesCachedOnTheClient() if ($request->cookies->has('authenticated')) { $response->headers->set('Cache-Control', 'private, no-store'); $response->setETag('"private tag"'); - if (in_array('"private tag"', $etags)) { + if (\in_array('"private tag"', $etags)) { $response->setStatusCode(304); } else { $response->setStatusCode(200); @@ -223,7 +225,7 @@ public function testValidatesPrivateResponsesCachedOnTheClient() } else { $response->headers->set('Cache-Control', 'public'); $response->setETag('"public tag"'); - if (in_array('"public tag"', $etags)) { + if (\in_array('"public tag"', $etags)) { $response->setStatusCode(304); } else { $response->setStatusCode(200); @@ -564,7 +566,7 @@ public function testHitsCachedResponseWithMaxAgeDirective() public function testDegradationWhenCacheLocked() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Skips on windows to avoid permissions issues.'); } @@ -992,7 +994,7 @@ public function testUsesCacheToRespondToHeadRequestsWhenFresh() $this->assertHttpKernelIsNotCalled(); $this->assertEquals(200, $this->response->getStatusCode()); $this->assertEquals('', $this->response->getContent()); - $this->assertEquals(strlen('Hello World'), $this->response->headers->get('Content-Length')); + $this->assertEquals(\strlen('Hello World'), $this->response->headers->get('Content-Length')); } public function testSendsNoContentWhenFresh() @@ -1336,64 +1338,69 @@ public function testClientIpIsAlwaysLocalhostForForwardedRequests() $this->setNextResponse(); $this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1')); - $this->assertEquals('127.0.0.1', $this->kernel->getBackendRequest()->server->get('REMOTE_ADDR')); + $this->kernel->assert(function ($backendRequest) { + $this->assertSame('127.0.0.1', $backendRequest->server->get('REMOTE_ADDR')); + }); } /** * @dataProvider getTrustedProxyData */ - public function testHttpCacheIsSetAsATrustedProxy(array $existing, array $expected) + public function testHttpCacheIsSetAsATrustedProxy(array $existing) { Request::setTrustedProxies($existing, Request::HEADER_X_FORWARDED_ALL); $this->setNextResponse(); $this->request('GET', '/', array('REMOTE_ADDR' => '10.0.0.1')); + $this->assertSame($existing, Request::getTrustedProxies()); - $this->assertEquals($expected, Request::getTrustedProxies()); + $existing = array_unique(array_merge($existing, array('127.0.0.1'))); + $this->kernel->assert(function ($backendRequest) use ($existing) { + $this->assertSame($existing, Request::getTrustedProxies()); + $this->assertsame('10.0.0.1', $backendRequest->getClientIp()); + }); + + Request::setTrustedProxies(array(), -1); } public function getTrustedProxyData() { return array( - array(array(), array('127.0.0.1')), - array(array('10.0.0.2'), array('10.0.0.2', '127.0.0.1')), - array(array('10.0.0.2', '127.0.0.1'), array('10.0.0.2', '127.0.0.1')), + array(array()), + array(array('10.0.0.2')), + array(array('10.0.0.2', '127.0.0.1')), ); } /** - * @dataProvider getXForwardedForData + * @dataProvider getForwardedData */ - public function testXForwarderForHeaderForForwardedRequests($xForwardedFor, $expected) + public function testForwarderHeaderForForwardedRequests($forwarded, $expected) { $this->setNextResponse(); $server = array('REMOTE_ADDR' => '10.0.0.1'); - if (false !== $xForwardedFor) { - $server['HTTP_X_FORWARDED_FOR'] = $xForwardedFor; + if (null !== $forwarded) { + Request::setTrustedProxies($server, -1); + $server['HTTP_FORWARDED'] = $forwarded; } $this->request('GET', '/', $server); - $this->assertEquals($expected, $this->kernel->getBackendRequest()->headers->get('X-Forwarded-For')); + $this->kernel->assert(function ($backendRequest) use ($expected) { + $this->assertSame($expected, $backendRequest->headers->get('Forwarded')); + }); + + Request::setTrustedProxies(array(), -1); } - public function getXForwardedForData() + public function getForwardedData() { return array( - array(false, '10.0.0.1'), - array('10.0.0.2', '10.0.0.2, 10.0.0.1'), - array('10.0.0.2, 10.0.0.3', '10.0.0.2, 10.0.0.3, 10.0.0.1'), + array(null, 'for="10.0.0.1";host="localhost";proto=http'), + array('for=10.0.0.2', 'for="10.0.0.2";host="localhost";proto=http, for="10.0.0.1"'), + array('for=10.0.0.2, for=10.0.0.3', 'for="10.0.0.2";host="localhost";proto=http, for="10.0.0.3", for="10.0.0.1"'), ); } - public function testXForwarderForHeaderForPassRequests() - { - $this->setNextResponse(); - $server = array('REMOTE_ADDR' => '10.0.0.1'); - $this->request('POST', '/', $server); - - $this->assertEquals('10.0.0.1', $this->kernel->getBackendRequest()->headers->get('X-Forwarded-For')); - } - public function testEsiCacheRemoveValidationHeadersIfEmbeddedResponses() { $time = \DateTime::createFromFormat('U', time()); @@ -1465,6 +1472,42 @@ public function testDoesNotCacheOptionsRequest() $this->assertHttpKernelIsNotCalled(); $this->assertSame('get', $this->response->getContent()); } + + public function testUsesOriginalRequestForSurrogate() + { + $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpKernelInterface')->getMock(); + $store = $this->getMockBuilder('Symfony\Component\HttpKernel\HttpCache\StoreInterface')->getMock(); + + $kernel + ->expects($this->exactly(2)) + ->method('handle') + ->willReturnCallback(function (Request $request) { + $this->assertSame('127.0.0.1', $request->server->get('REMOTE_ADDR')); + + return new Response(); + }); + + $cache = new HttpCache($kernel, + $store, + new Esi() + ); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '10.0.0.1'); + + // Main request + $cache->handle($request, HttpKernelInterface::MASTER_REQUEST); + + // Main request was now modified by HttpCache + // The surrogate will ask for the request using $this->cache->getRequest() + // which MUST return the original request so the surrogate + // can actually behave like a reverse proxy like e.g. Varnish would. + $this->assertSame('10.0.0.1', $cache->getRequest()->getClientIp()); + $this->assertSame('10.0.0.1', $cache->getRequest()->server->get('REMOTE_ADDR')); + + // Surrogate request + $cache->handle($request, HttpKernelInterface::SUB_REQUEST); + } } class TestKernel implements HttpKernelInterface diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php index ed5c690d6..b3aa2be2f 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/HttpCacheTestCase.php @@ -168,7 +168,7 @@ public static function clearDirectory($directory) $fp = opendir($directory); while (false !== $file = readdir($fp)) { - if (!in_array($file, array('.', '..'))) { + if (!\in_array($file, array('.', '..'))) { if (is_link($directory.'/'.$file)) { unlink($directory.'/'.$file); } elseif (is_dir($directory.'/'.$file)) { diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php index 1079d37a2..26ef6cb2b 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/SsiTest.php @@ -198,10 +198,10 @@ protected function getCache($request, $response) ->method('getRequest') ->will($this->returnValue($request)) ; - if (is_array($response)) { + if (\is_array($response)) { $cache->expects($this->any()) ->method('handle') - ->will(call_user_func_array(array($this, 'onConsecutiveCalls'), $response)) + ->will(\call_user_func_array(array($this, 'onConsecutiveCalls'), $response)) ; } else { $cache->expects($this->any()) diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/SubRequestHandlerTest.php b/vendor/symfony/http-kernel/Tests/HttpCache/SubRequestHandlerTest.php new file mode 100644 index 000000000..dfe0a734b --- /dev/null +++ b/vendor/symfony/http-kernel/Tests/HttpCache/SubRequestHandlerTest.php @@ -0,0 +1,153 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\HttpKernel\Tests\HttpCache; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\HttpCache\SubRequestHandler; +use Symfony\Component\HttpKernel\HttpKernelInterface; + +class SubRequestHandlerTest extends TestCase +{ + private static $globalState; + + protected function setUp() + { + self::$globalState = $this->getGlobalState(); + } + + protected function tearDown() + { + Request::setTrustedProxies(self::$globalState[0], self::$globalState[1]); + } + + public function testTrustedHeadersAreKept() + { + Request::setTrustedProxies(array('10.0.0.1'), -1); + $globalState = $this->getGlobalState(); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '10.0.0.1'); + $request->headers->set('X-Forwarded-For', '10.0.0.2'); + $request->headers->set('X-Forwarded-Host', 'Good'); + $request->headers->set('X-Forwarded-Port', '1234'); + $request->headers->set('X-Forwarded-Proto', 'https'); + + $kernel = new TestSubRequestHandlerKernel(function ($request, $type, $catch) { + $this->assertSame('127.0.0.1', $request->server->get('REMOTE_ADDR')); + $this->assertSame('10.0.0.2', $request->getClientIp()); + $this->assertSame('Good', $request->headers->get('X-Forwarded-Host')); + $this->assertSame('1234', $request->headers->get('X-Forwarded-Port')); + $this->assertSame('https', $request->headers->get('X-Forwarded-Proto')); + }); + + SubRequestHandler::handle($kernel, $request, HttpKernelInterface::MASTER_REQUEST, true); + + $this->assertSame($globalState, $this->getGlobalState()); + } + + public function testUntrustedHeadersAreRemoved() + { + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '10.0.0.1'); + $request->headers->set('X-Forwarded-For', '10.0.0.2'); + $request->headers->set('X-Forwarded-Host', 'Evil'); + $request->headers->set('X-Forwarded-Port', '1234'); + $request->headers->set('X-Forwarded-Proto', 'http'); + $request->headers->set('Forwarded', 'Evil2'); + + $kernel = new TestSubRequestHandlerKernel(function ($request, $type, $catch) { + $this->assertSame('127.0.0.1', $request->server->get('REMOTE_ADDR')); + $this->assertSame('10.0.0.1', $request->getClientIp()); + $this->assertFalse($request->headers->has('X-Forwarded-Host')); + $this->assertFalse($request->headers->has('X-Forwarded-Port')); + $this->assertFalse($request->headers->has('X-Forwarded-Proto')); + $this->assertSame('for="10.0.0.1";host="localhost";proto=http', $request->headers->get('Forwarded')); + }); + + SubRequestHandler::handle($kernel, $request, HttpKernelInterface::MASTER_REQUEST, true); + + $this->assertSame(self::$globalState, $this->getGlobalState()); + } + + public function testTrustedForwardedHeader() + { + Request::setTrustedProxies(array('10.0.0.1'), -1); + $globalState = $this->getGlobalState(); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '10.0.0.1'); + $request->headers->set('Forwarded', 'for="10.0.0.2";host="foo.bar:1234";proto=https'); + + $kernel = new TestSubRequestHandlerKernel(function ($request, $type, $catch) { + $this->assertSame('127.0.0.1', $request->server->get('REMOTE_ADDR')); + $this->assertSame('10.0.0.2', $request->getClientIp()); + $this->assertSame('foo.bar:1234', $request->getHttpHost()); + $this->assertSame('https', $request->getScheme()); + $this->assertSame(1234, $request->getPort()); + }); + + SubRequestHandler::handle($kernel, $request, HttpKernelInterface::MASTER_REQUEST, true); + + $this->assertSame($globalState, $this->getGlobalState()); + } + + public function testTrustedXForwardedForHeader() + { + Request::setTrustedProxies(array('10.0.0.1'), -1); + $globalState = $this->getGlobalState(); + + $request = Request::create('/'); + $request->server->set('REMOTE_ADDR', '10.0.0.1'); + $request->headers->set('X-Forwarded-For', '10.0.0.2'); + $request->headers->set('X-Forwarded-Host', 'foo.bar'); + $request->headers->set('X-Forwarded-Proto', 'https'); + + $kernel = new TestSubRequestHandlerKernel(function ($request, $type, $catch) { + $this->assertSame('127.0.0.1', $request->server->get('REMOTE_ADDR')); + $this->assertSame('10.0.0.2', $request->getClientIp()); + $this->assertSame('foo.bar', $request->getHttpHost()); + $this->assertSame('https', $request->getScheme()); + }); + + SubRequestHandler::handle($kernel, $request, HttpKernelInterface::MASTER_REQUEST, true); + + $this->assertSame($globalState, $this->getGlobalState()); + } + + private function getGlobalState() + { + return array( + Request::getTrustedProxies(), + Request::getTrustedHeaderSet(), + ); + } +} + +class TestSubRequestHandlerKernel implements HttpKernelInterface +{ + private $assertCallback; + + public function __construct(\Closure $assertCallback) + { + $this->assertCallback = $assertCallback; + } + + public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true) + { + $assertCallback = $this->assertCallback; + $assertCallback($request, $type, $catch); + + return new Response(); + } +} diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php b/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php index 946c7a31c..5dbf02c99 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/TestHttpKernel.php @@ -11,13 +11,13 @@ namespace Symfony\Component\HttpKernel\Tests\HttpCache; -use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; -use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\HttpKernel\HttpKernel; +use Symfony\Component\HttpKernel\HttpKernelInterface; class TestHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverInterface { @@ -39,15 +39,25 @@ public function __construct($body, $status, $headers, \Closure $customizer = nul parent::__construct(new EventDispatcher(), $this, null, $this); } - public function getBackendRequest() + public function assert(\Closure $callback) { - return $this->backendRequest; + $trustedConfig = array(Request::getTrustedProxies(), Request::getTrustedHeaderSet()); + + list($trustedProxies, $trustedHeaderSet, $backendRequest) = $this->backendRequest; + Request::setTrustedProxies($trustedProxies, $trustedHeaderSet); + + try { + $callback($backendRequest); + } finally { + list($trustedProxies, $trustedHeaderSet) = $trustedConfig; + Request::setTrustedProxies($trustedProxies, $trustedHeaderSet); + } } public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = false) { $this->catch = $catch; - $this->backendRequest = $request; + $this->backendRequest = array(Request::getTrustedProxies(), Request::getTrustedHeaderSet(), $request); return parent::handle($request, $type, $catch); } diff --git a/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php b/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php index 926d8daf5..712132bd1 100644 --- a/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php +++ b/vendor/symfony/http-kernel/Tests/HttpCache/TestMultipleHttpKernel.php @@ -11,13 +11,13 @@ namespace Symfony\Component\HttpKernel\Tests\HttpCache; -use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; -use Symfony\Component\HttpKernel\HttpKernel; -use Symfony\Component\HttpKernel\HttpKernelInterface; +use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\HttpKernel\HttpKernel; +use Symfony\Component\HttpKernel\HttpKernelInterface; class TestMultipleHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverInterface { diff --git a/vendor/symfony/http-kernel/Tests/HttpKernelTest.php b/vendor/symfony/http-kernel/Tests/HttpKernelTest.php index 7aed26aa5..4b9ec69d1 100644 --- a/vendor/symfony/http-kernel/Tests/HttpKernelTest.php +++ b/vendor/symfony/http-kernel/Tests/HttpKernelTest.php @@ -12,21 +12,21 @@ namespace Symfony\Component\HttpKernel\Tests; use PHPUnit\Framework\TestCase; +use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\HttpFoundation\RedirectResponse; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; use Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; +use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; +use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; use Symfony\Component\HttpKernel\HttpKernel; use Symfony\Component\HttpKernel\HttpKernelInterface; use Symfony\Component\HttpKernel\KernelEvents; -use Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException; -use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpFoundation\RedirectResponse; -use Symfony\Component\EventDispatcher\EventDispatcher; class HttpKernelTest extends TestCase { @@ -283,7 +283,7 @@ public function testHandleAllowChangingControllerAndArguments() $oldArguments = $event->getArguments(); $newController = function ($id) use ($oldController, $oldArguments) { - $response = call_user_func_array($oldController, $oldArguments); + $response = \call_user_func_array($oldController, $oldArguments); $response->headers->set('X-Id', $id); @@ -349,6 +349,8 @@ public function testInconsistentClientIpsOnMasterRequests() $kernel = $this->getHttpKernel($dispatcher); $kernel->handle($request, $kernel::MASTER_REQUEST, false); + + Request::setTrustedProxies(array(), -1); } private function getHttpKernel(EventDispatcherInterface $eventDispatcher, $controller = null, RequestStack $requestStack = null, array $arguments = array()) diff --git a/vendor/symfony/http-kernel/Tests/KernelTest.php b/vendor/symfony/http-kernel/Tests/KernelTest.php index a16ac37de..ab0b8cfb6 100644 --- a/vendor/symfony/http-kernel/Tests/KernelTest.php +++ b/vendor/symfony/http-kernel/Tests/KernelTest.php @@ -16,16 +16,16 @@ use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Filesystem\Filesystem; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Config\EnvParametersResource; use Symfony\Component\HttpKernel\DependencyInjection\ResettableServicePass; use Symfony\Component\HttpKernel\DependencyInjection\ServicesResetter; -use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\HttpKernelInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; -use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; +use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForOverrideName; +use Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest; use Symfony\Component\HttpKernel\Tests\Fixtures\KernelWithoutBundles; use Symfony\Component\HttpKernel\Tests\Fixtures\ResettableService; @@ -75,7 +75,7 @@ public function testInitializeContainerClearsOldContainers() $kernel = new CustomProjectDirKernel(); $kernel->boot(); - $containerDir = __DIR__.'/Fixtures/cache/custom/'.substr(get_class($kernel->getContainer()), 0, 16); + $containerDir = __DIR__.'/Fixtures/cache/custom/'.substr(\get_class($kernel->getContainer()), 0, 16); $this->assertTrue(unlink(__DIR__.'/Fixtures/cache/custom/FixturesCustomDebugProjectContainer.php.meta')); $this->assertFileExists($containerDir); $this->assertFileNotExists($containerDir.'.legacy'); @@ -178,7 +178,7 @@ public function testEnvParametersResourceIsAdded() ->method('getLogDir') ->will($this->returnValue(sys_get_temp_dir())); - $reflection = new \ReflectionClass(get_class($kernel)); + $reflection = new \ReflectionClass(\get_class($kernel)); $method = $reflection->getMethod('buildContainer'); $method->setAccessible(true); $method->invoke($kernel); @@ -349,7 +349,7 @@ public function doStuff() // Heredocs are preserved, making the output mixing Unix and Windows line // endings, switching to "\n" everywhere on Windows to avoid failure. - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $expected = str_replace("\r\n", "\n", $expected); $output = str_replace("\r\n", "\n", $output); } @@ -361,7 +361,7 @@ public function testGetRootDir() { $kernel = new KernelForTest('test', true); - $this->assertEquals(__DIR__.DIRECTORY_SEPARATOR.'Fixtures', realpath($kernel->getRootDir())); + $this->assertEquals(__DIR__.\DIRECTORY_SEPARATOR.'Fixtures', realpath($kernel->getRootDir())); } public function testGetName() @@ -809,7 +809,7 @@ public function testKernelRootDirNameStartingWithANumber() /** * @group legacy - * @expectedDeprecation The Symfony\Component\HttpKernel\Kernel::getEnvParameters() method is deprecated as of 3.3 and will be removed in 4.0. Use the %cenv()%c syntax to get the value of any environment variable from configuration files instead. + * @expectedDeprecation The "Symfony\Component\HttpKernel\Kernel::getEnvParameters()" method is deprecated as of 3.3 and will be removed in 4.0. Use the %cenv()%c syntax to get the value of any environment variable from configuration files instead. * @expectedDeprecation The support of special environment variables that start with SYMFONY__ (such as "SYMFONY__FOO__BAR") is deprecated as of 3.3 and will be removed in 4.0. Use the %cenv()%c syntax instead to get the value of environment variables in configuration files. */ public function testSymfonyEnvironmentVariables() @@ -842,7 +842,7 @@ public function testKernelReset() $kernel = new CustomProjectDirKernel(); $kernel->boot(); - $containerClass = get_class($kernel->getContainer()); + $containerClass = \get_class($kernel->getContainer()); $containerFile = (new \ReflectionClass($kernel->getContainer()))->getFileName(); unlink(__DIR__.'/Fixtures/cache/custom/FixturesCustomDebugProjectContainer.php.meta'); @@ -858,7 +858,7 @@ public function testKernelReset() $this->assertNotInstanceOf($containerClass, $kernel->getContainer()); $this->assertFileExists($containerFile); - $this->assertFileExists(dirname($containerFile).'.legacy'); + $this->assertFileExists(\dirname($containerFile).'.legacy'); } public function testKernelPass() @@ -901,6 +901,21 @@ public function testServicesResetter() $this->assertEquals(1, ResettableService::$counter); } + /** + * @group time-sensitive + */ + public function testKernelStartTimeIsResetWhileBootingAlreadyBootedKernel() + { + $kernel = $this->getKernelForTest(array('initializeBundles'), true); + $kernel->boot(); + $preReBoot = $kernel->getStartTime(); + + sleep(3600); //Intentionally large value to detect if ClockMock ever breaks + $kernel->reboot(null); + + $this->assertGreaterThan($preReBoot, $kernel->getStartTime()); + } + /** * Returns a mock for the BundleInterface. * @@ -923,7 +938,7 @@ protected function getBundle($dir = null, $parent = null, $className = null, $bu $bundle ->expects($this->any()) ->method('getName') - ->will($this->returnValue(null === $bundleName ? get_class($bundle) : $bundleName)) + ->will($this->returnValue(null === $bundleName ? \get_class($bundle) : $bundleName)) ; $bundle @@ -970,10 +985,10 @@ protected function getKernel(array $methods = array(), array $bundles = array()) return $kernel; } - protected function getKernelForTest(array $methods = array()) + protected function getKernelForTest(array $methods = array(), $debug = false) { $kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest') - ->setConstructorArgs(array('test', false)) + ->setConstructorArgs(array('test', $debug)) ->setMethods($methods) ->getMock(); $p = new \ReflectionProperty($kernel, 'rootDir'); diff --git a/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php b/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php index ecf67af78..a5d070c8a 100644 --- a/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php +++ b/vendor/symfony/http-kernel/Tests/Log/LoggerTest.php @@ -34,7 +34,7 @@ class LoggerTest extends TestCase protected function setUp() { - $this->tmpFile = sys_get_temp_dir().DIRECTORY_SEPARATOR.'log'; + $this->tmpFile = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'log'; $this->logger = new Logger(LogLevel::DEBUG, $this->tmpFile); } diff --git a/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php b/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php index 243c3c5c5..cff133c1a 100644 --- a/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php +++ b/vendor/symfony/http-kernel/Tests/Profiler/ProfilerTest.php @@ -12,12 +12,12 @@ namespace Symfony\Component\HttpKernel\Tests\Profiler; use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\DataCollector\DataCollectorInterface; use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector; use Symfony\Component\HttpKernel\Profiler\FileProfilerStorage; use Symfony\Component\HttpKernel\Profiler\Profiler; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\HttpFoundation\Response; class ProfilerTest extends TestCase { @@ -44,7 +44,7 @@ public function testCollect() public function testReset() { $collector = $this->getMockBuilder(DataCollectorInterface::class) - ->setMethods(['collect', 'getName', 'reset']) + ->setMethods(array('collect', 'getName', 'reset')) ->getMock(); $collector->expects($this->any())->method('getName')->willReturn('mock'); $collector->expects($this->once())->method('reset'); diff --git a/vendor/symfony/http-kernel/Tests/TestHttpKernel.php b/vendor/symfony/http-kernel/Tests/TestHttpKernel.php index 3ec592725..fb95aa033 100644 --- a/vendor/symfony/http-kernel/Tests/TestHttpKernel.php +++ b/vendor/symfony/http-kernel/Tests/TestHttpKernel.php @@ -11,12 +11,12 @@ namespace Symfony\Component\HttpKernel\Tests; -use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; -use Symfony\Component\HttpKernel\HttpKernel; +use Symfony\Component\EventDispatcher\EventDispatcher; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface; use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface; -use Symfony\Component\EventDispatcher\EventDispatcher; +use Symfony\Component\HttpKernel\HttpKernel; class TestHttpKernel extends HttpKernel implements ControllerResolverInterface, ArgumentResolverInterface { diff --git a/vendor/symfony/http-kernel/composer.json b/vendor/symfony/http-kernel/composer.json index 26b782bb3..9ad3877ba 100644 --- a/vendor/symfony/http-kernel/composer.json +++ b/vendor/symfony/http-kernel/composer.json @@ -18,8 +18,9 @@ "require": { "php": "^5.5.9|>=7.0.8", "symfony/event-dispatcher": "~2.8|~3.0|~4.0", - "symfony/http-foundation": "^3.4.4|^4.0.4", + "symfony/http-foundation": "~3.4.12|~4.0.12|^4.1.1", "symfony/debug": "~2.8|~3.0|~4.0", + "symfony/polyfill-ctype": "~1.8", "psr/log": "~1.0" }, "require-dev": { @@ -28,7 +29,7 @@ "symfony/config": "~2.8|~3.0|~4.0", "symfony/console": "~2.8|~3.0|~4.0", "symfony/css-selector": "~2.8|~3.0|~4.0", - "symfony/dependency-injection": "^3.4.5|^4.0.5", + "symfony/dependency-injection": "^3.4.10|^4.0.10", "symfony/dom-crawler": "~2.8|~3.0|~4.0", "symfony/expression-language": "~2.8|~3.0|~4.0", "symfony/finder": "~2.8|~3.0|~4.0", @@ -45,7 +46,7 @@ }, "conflict": { "symfony/config": "<2.8", - "symfony/dependency-injection": "<3.4.5|<4.0.5,>=4", + "symfony/dependency-injection": "<3.4.10|<4.0.10,>=4", "symfony/var-dumper": "<3.3", "twig/twig": "<1.34|<2.4,>=2" }, diff --git a/vendor/symfony/http-kernel/phpunit.xml.dist b/vendor/symfony/http-kernel/phpunit.xml.dist index e0de769dd..3fc07707f 100644 --- a/vendor/symfony/http-kernel/phpunit.xml.dist +++ b/vendor/symfony/http-kernel/phpunit.xml.dist @@ -1,7 +1,7 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Polyfill\Ctype; + +/** + * Ctype implementation through regex. + * + * @internal + * + * @author Gert de Pagter + */ +final class Ctype +{ + /** + * Returns TRUE if every character in text is either a letter or a digit, FALSE otherwise. + * + * @see https://php.net/ctype-alnum + * + * @param string|int $text + * + * @return bool + */ + public static function ctype_alnum($text) + { + $text = self::convert_int_to_char_for_ctype($text); + + return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text); + } + + /** + * Returns TRUE if every character in text is a letter, FALSE otherwise. + * + * @see https://php.net/ctype-alpha + * + * @param string|int $text + * + * @return bool + */ + public static function ctype_alpha($text) + { + $text = self::convert_int_to_char_for_ctype($text); + + return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text); + } + + /** + * Returns TRUE if every character in text is a control character from the current locale, FALSE otherwise. + * + * @see https://php.net/ctype-cntrl + * + * @param string|int $text + * + * @return bool + */ + public static function ctype_cntrl($text) + { + $text = self::convert_int_to_char_for_ctype($text); + + return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text); + } + + /** + * Returns TRUE if every character in the string text is a decimal digit, FALSE otherwise. + * + * @see https://php.net/ctype-digit + * + * @param string|int $text + * + * @return bool + */ + public static function ctype_digit($text) + { + $text = self::convert_int_to_char_for_ctype($text); + + return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text); + } + + /** + * Returns TRUE if every character in text is printable and actually creates visible output (no white space), FALSE otherwise. + * + * @see https://php.net/ctype-graph + * + * @param string|int $text + * + * @return bool + */ + public static function ctype_graph($text) + { + $text = self::convert_int_to_char_for_ctype($text); + + return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text); + } + + /** + * Returns TRUE if every character in text is a lowercase letter. + * + * @see https://php.net/ctype-lower + * + * @param string|int $text + * + * @return bool + */ + public static function ctype_lower($text) + { + $text = self::convert_int_to_char_for_ctype($text); + + return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text); + } + + /** + * Returns TRUE if every character in text will actually create output (including blanks). Returns FALSE if text contains control characters or characters that do not have any output or control function at all. + * + * @see https://php.net/ctype-print + * + * @param string|int $text + * + * @return bool + */ + public static function ctype_print($text) + { + $text = self::convert_int_to_char_for_ctype($text); + + return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text); + } + + /** + * Returns TRUE if every character in text is printable, but neither letter, digit or blank, FALSE otherwise. + * + * @see https://php.net/ctype-punct + * + * @param string|int $text + * + * @return bool + */ + public static function ctype_punct($text) + { + $text = self::convert_int_to_char_for_ctype($text); + + return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text); + } + + /** + * Returns TRUE if every character in text creates some sort of white space, FALSE otherwise. Besides the blank character this also includes tab, vertical tab, line feed, carriage return and form feed characters. + * + * @see https://php.net/ctype-space + * + * @param string|int $text + * + * @return bool + */ + public static function ctype_space($text) + { + $text = self::convert_int_to_char_for_ctype($text); + + return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text); + } + + /** + * Returns TRUE if every character in text is an uppercase letter. + * + * @see https://php.net/ctype-upper + * + * @param string|int $text + * + * @return bool + */ + public static function ctype_upper($text) + { + $text = self::convert_int_to_char_for_ctype($text); + + return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text); + } + + /** + * Returns TRUE if every character in text is a hexadecimal 'digit', that is a decimal digit or a character from [A-Fa-f] , FALSE otherwise. + * + * @see https://php.net/ctype-xdigit + * + * @param string|int $text + * + * @return bool + */ + public static function ctype_xdigit($text) + { + $text = self::convert_int_to_char_for_ctype($text); + + return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text); + } + + /** + * Converts integers to their char versions according to normal ctype behaviour, if needed. + * + * If an integer between -128 and 255 inclusive is provided, + * it is interpreted as the ASCII value of a single character + * (negative values have 256 added in order to allow characters in the Extended ASCII range). + * Any other integer is interpreted as a string containing the decimal digits of the integer. + * + * @param string|int $int + * + * @return mixed + */ + private static function convert_int_to_char_for_ctype($int) + { + if (!\is_int($int)) { + return $int; + } + + if ($int < -128 || $int > 255) { + return (string) $int; + } + + if ($int < 0) { + $int += 256; + } + + return \chr($int); + } +} diff --git a/vendor/symfony/polyfill-ctype/LICENSE b/vendor/symfony/polyfill-ctype/LICENSE new file mode 100644 index 000000000..ad399a798 --- /dev/null +++ b/vendor/symfony/polyfill-ctype/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2018 Fabien Potencier + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/vendor/symfony/polyfill-ctype/README.md b/vendor/symfony/polyfill-ctype/README.md new file mode 100644 index 000000000..8add1ab00 --- /dev/null +++ b/vendor/symfony/polyfill-ctype/README.md @@ -0,0 +1,12 @@ +Symfony Polyfill / Ctype +======================== + +This component provides `ctype_*` functions to users who run php versions without the ctype extension. + +More information can be found in the +[main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). + +License +======= + +This library is released under the [MIT license](LICENSE). diff --git a/vendor/symfony/polyfill-ctype/bootstrap.php b/vendor/symfony/polyfill-ctype/bootstrap.php new file mode 100644 index 000000000..14d1d0faa --- /dev/null +++ b/vendor/symfony/polyfill-ctype/bootstrap.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Symfony\Polyfill\Ctype as p; + +if (!function_exists('ctype_alnum')) { + function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); } + function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); } + function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); } + function ctype_digit($text) { return p\Ctype::ctype_digit($text); } + function ctype_graph($text) { return p\Ctype::ctype_graph($text); } + function ctype_lower($text) { return p\Ctype::ctype_lower($text); } + function ctype_print($text) { return p\Ctype::ctype_print($text); } + function ctype_punct($text) { return p\Ctype::ctype_punct($text); } + function ctype_space($text) { return p\Ctype::ctype_space($text); } + function ctype_upper($text) { return p\Ctype::ctype_upper($text); } + function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); } +} diff --git a/vendor/symfony/polyfill-ctype/composer.json b/vendor/symfony/polyfill-ctype/composer.json new file mode 100644 index 000000000..094f8d867 --- /dev/null +++ b/vendor/symfony/polyfill-ctype/composer.json @@ -0,0 +1,34 @@ +{ + "name": "symfony/polyfill-ctype", + "type": "library", + "description": "Symfony polyfill for ctype functions", + "keywords": ["polyfill", "compatibility", "portable", "ctype"], + "homepage": "https://symfony.com", + "license": "MIT", + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "require": { + "php": ">=5.3.3" + }, + "autoload": { + "psr-4": { "Symfony\\Polyfill\\Ctype\\": "" }, + "files": [ "bootstrap.php" ] + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "minimum-stability": "dev", + "extra": { + "branch-alias": { + "dev-master": "1.9-dev" + } + } +} diff --git a/vendor/symfony/polyfill-mbstring/Mbstring.php b/vendor/symfony/polyfill-mbstring/Mbstring.php index 4bd326e5f..a5e4a8fde 100644 --- a/vendor/symfony/polyfill-mbstring/Mbstring.php +++ b/vendor/symfony/polyfill-mbstring/Mbstring.php @@ -44,7 +44,7 @@ * - mb_strrchr - Finds the last occurrence of a character in a string within another * - mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive * - mb_strripos - Finds position of last occurrence of a string within another, case insensitive - * - mb_strstr - Finds first occurrence of a string within anothers + * - mb_strstr - Finds first occurrence of a string within another * - mb_strwidth - Return width of string * - mb_substr_count - Count the number of substring occurrences * @@ -72,8 +72,8 @@ final class Mbstring private static $language = 'neutral'; private static $internalEncoding = 'UTF-8'; private static $caseFold = array( - array('µ','ſ',"\xCD\x85",'ς',"\xCF\x90","\xCF\x91","\xCF\x95","\xCF\x96","\xCF\xB0","\xCF\xB1","\xCF\xB5","\xE1\xBA\x9B","\xE1\xBE\xBE"), - array('μ','s','ι', 'σ','β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1",'ι'), + array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"), + array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', 'ρ', 'ε', "\xE1\xB9\xA1", 'ι'), ); public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null) @@ -141,7 +141,8 @@ public static function mb_encode_mimeheader($s, $charset = null, $transferEncodi public static function mb_decode_numericentity($s, $convmap, $encoding = null) { if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) { - trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING); + return null; } @@ -150,7 +151,8 @@ public static function mb_decode_numericentity($s, $convmap, $encoding = null) } if (null !== $encoding && !\is_scalar($encoding)) { - trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING); + return ''; // Instead of null (cf. mb_encode_numericentity). } @@ -185,6 +187,7 @@ public static function mb_decode_numericentity($s, $convmap, $encoding = null) return Mbstring::mb_chr($c - $convmap[$i + 2]); } } + return $m[0]; }, $s); @@ -198,7 +201,8 @@ public static function mb_decode_numericentity($s, $convmap, $encoding = null) public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false) { if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) { - trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING); + return null; } @@ -207,12 +211,14 @@ public static function mb_encode_numericentity($s, $convmap, $encoding = null, $ } if (null !== $encoding && !\is_scalar($encoding)) { - trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING); + return null; // Instead of '' (cf. mb_decode_numericentity). } if (null !== $is_hex && !\is_scalar($is_hex)) { - trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.gettype($s).' given', E_USER_WARNING); + trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING); + return null; } @@ -281,8 +287,11 @@ public static function mb_convert_case($s, $mode, $encoding = null) } if (MB_CASE_TITLE == $mode) { - $s = preg_replace_callback('/\b\p{Ll}/u', array(__CLASS__, 'title_case_upper'), $s); - $s = preg_replace_callback('/\B[\p{Lu}\p{Lt}]+/u', array(__CLASS__, 'title_case_lower'), $s); + static $titleRegexp = null; + if (null === $titleRegexp) { + $titleRegexp = self::getData('titleCaseRegexp'); + } + $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s); } else { if (MB_CASE_UPPER == $mode) { static $upper = null; @@ -324,7 +333,7 @@ public static function mb_convert_case($s, $mode, $encoding = null) } else { $s = substr_replace($s, $uchr, $i - $ulen, $ulen); $len += $nlen - $ulen; - $i += $nlen - $ulen; + $i += $nlen - $ulen; } } } @@ -452,6 +461,7 @@ public static function mb_detect_order($encodingList = null) if (strncmp($enc, 'ISO-8859-', 9)) { return false; } + // no break case 'ASCII': case 'UTF8': case 'UTF-8': @@ -701,6 +711,10 @@ public static function mb_ord($s, $encoding = null) $s = mb_convert_encoding($s, 'UTF-8', $encoding); } + if (1 === \strlen($s)) { + return \ord($s); + } + $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0; if (0xF0 <= $code) { return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80; @@ -752,14 +766,9 @@ private static function html_encoding_callback(array $m) return $entities; } - private static function title_case_lower(array $s) - { - return self::mb_convert_case($s[0], MB_CASE_LOWER, 'UTF-8'); - } - - private static function title_case_upper(array $s) + private static function title_case(array $s) { - return self::mb_convert_case($s[0], MB_CASE_UPPER, 'UTF-8'); + return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8'); } private static function getData($file) diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php index 3ca16416a..e6fbfa64e 100644 --- a/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php @@ -1,6 +1,6 @@ 'a', 'B' => 'b', 'C' => 'c', @@ -1094,8 +1094,3 @@ '𑢾' => '𑣞', '𑢿' => '𑣟', ); - -$result =& $data; -unset($data); - -return $result; diff --git a/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php b/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php new file mode 100644 index 000000000..2a8f6e73b --- /dev/null +++ b/vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.php @@ -0,0 +1,5 @@ + 'A', 'b' => 'B', 'c' => 'C', @@ -1102,8 +1102,3 @@ '𑣞' => '𑢾', '𑣟' => '𑢿', ); - -$result =& $data; -unset($data); - -return $result; diff --git a/vendor/symfony/polyfill-mbstring/composer.json b/vendor/symfony/polyfill-mbstring/composer.json index 49b720dd8..50ea12f1b 100644 --- a/vendor/symfony/polyfill-mbstring/composer.json +++ b/vendor/symfony/polyfill-mbstring/composer.json @@ -28,7 +28,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } } } diff --git a/vendor/symfony/polyfill-php70/Php70.php b/vendor/symfony/polyfill-php70/Php70.php index 39e664507..7f1ad08a4 100644 --- a/vendor/symfony/polyfill-php70/Php70.php +++ b/vendor/symfony/polyfill-php70/Php70.php @@ -53,7 +53,7 @@ public static function error_clear_last() { static $handler; if (!$handler) { - $handler = function() { return false; }; + $handler = function () { return false; }; } set_error_handler($handler); @trigger_error(''); @@ -66,7 +66,7 @@ private static function intArg($value, $caller, $pos) return $value; } if (!\is_numeric($value) || PHP_INT_MAX <= ($value += 0) || ~PHP_INT_MAX >= $value) { - throw new \TypeError(sprintf('%s() expects parameter %d to be integer, %s given', $caller, $pos, gettype($value))); + throw new \TypeError(sprintf('%s() expects parameter %d to be integer, %s given', $caller, $pos, \gettype($value))); } return (int) $value; diff --git a/vendor/symfony/polyfill-php70/composer.json b/vendor/symfony/polyfill-php70/composer.json index 871045d2a..13dcf94a6 100644 --- a/vendor/symfony/polyfill-php70/composer.json +++ b/vendor/symfony/polyfill-php70/composer.json @@ -17,7 +17,7 @@ ], "require": { "php": ">=5.3.3", - "paragonie/random_compat": "~1.0|~2.0" + "paragonie/random_compat": "~1.0|~2.0|~9.99" }, "autoload": { "psr-4": { "Symfony\\Polyfill\\Php70\\": "" }, @@ -27,7 +27,7 @@ "minimum-stability": "dev", "extra": { "branch-alias": { - "dev-master": "1.8-dev" + "dev-master": "1.9-dev" } } } diff --git a/vendor/symfony/process/ExecutableFinder.php b/vendor/symfony/process/ExecutableFinder.php index d042a5b13..ccfa4c09b 100644 --- a/vendor/symfony/process/ExecutableFinder.php +++ b/vendor/symfony/process/ExecutableFinder.php @@ -71,13 +71,13 @@ public function find($name, $default = null, array $extraDirs = array()) } $suffixes = array(''); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $pathExt = getenv('PATHEXT'); - $suffixes = array_merge($suffixes, $pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes); + $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes); } foreach ($suffixes as $suffix) { foreach ($dirs as $dir) { - if (@is_file($file = $dir.DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === DIRECTORY_SEPARATOR || is_executable($file))) { + if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) { return $file; } } diff --git a/vendor/symfony/process/InputStream.php b/vendor/symfony/process/InputStream.php index 9bd917a7e..0214014eb 100644 --- a/vendor/symfony/process/InputStream.php +++ b/vendor/symfony/process/InputStream.php @@ -20,7 +20,7 @@ */ class InputStream implements \IteratorAggregate { - /** @var null|callable */ + /** @var callable|null */ private $onEmpty = null; private $input = array(); private $open = true; @@ -36,8 +36,8 @@ public function onEmpty(callable $onEmpty = null) /** * Appends an input to the write buffer. * - * @param resource|string|int|float|bool|\Traversable|null The input to append as scalar, - * stream resource or \Traversable + * @param resource|string|int|float|bool|\Traversable|null $input The input to append as scalar, + * stream resource or \Traversable */ public function write($input) { diff --git a/vendor/symfony/process/PhpExecutableFinder.php b/vendor/symfony/process/PhpExecutableFinder.php index c9c113c91..334de13fc 100644 --- a/vendor/symfony/process/PhpExecutableFinder.php +++ b/vendor/symfony/process/PhpExecutableFinder.php @@ -39,17 +39,17 @@ public function find($includeArgs = true) $args = $includeArgs && $args ? ' '.implode(' ', $args) : ''; // HHVM support - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { return (getenv('PHP_BINARY') ?: PHP_BINARY).$args; } // PHP_BINARY return the current sapi executable - if (PHP_BINARY && \in_array(PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) { + if (PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) { return PHP_BINARY.$args; } if ($php = getenv('PHP_PATH')) { - if (!is_executable($php)) { + if (!@is_executable($php)) { return false; } @@ -57,17 +57,17 @@ public function find($includeArgs = true) } if ($php = getenv('PHP_PEAR_PHP_BIN')) { - if (is_executable($php)) { + if (@is_executable($php)) { return $php; } } - if (is_executable($php = PHP_BINDIR.('\\' === DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) { + if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) { return $php; } $dirs = array(PHP_BINDIR); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $dirs[] = 'C:\xampp\php\\'; } @@ -83,9 +83,9 @@ public function findArguments() { $arguments = array(); - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $arguments[] = '--php'; - } elseif ('phpdbg' === PHP_SAPI) { + } elseif ('phpdbg' === \PHP_SAPI) { $arguments[] = '-qrr'; } diff --git a/vendor/symfony/process/PhpProcess.php b/vendor/symfony/process/PhpProcess.php index d3fd384af..5b8478306 100644 --- a/vendor/symfony/process/PhpProcess.php +++ b/vendor/symfony/process/PhpProcess.php @@ -16,9 +16,9 @@ /** * PhpProcess runs a PHP script in an independent process. * - * $p = new PhpProcess(''); - * $p->run(); - * print $p->getOutput()."\n"; + * $p = new PhpProcess(''); + * $p->run(); + * print $p->getOutput()."\n"; * * @author Fabien Potencier */ @@ -39,7 +39,7 @@ public function __construct($script, $cwd = null, array $env = null, $timeout = } else { $php = array_merge(array($php), $executableFinder->findArguments()); } - if ('phpdbg' === PHP_SAPI) { + if ('phpdbg' === \PHP_SAPI) { $file = tempnam(sys_get_temp_dir(), 'dbg'); file_put_contents($file, $script); register_shutdown_function('unlink', $file); @@ -69,7 +69,7 @@ public function start(callable $callback = null/*, array $env = array()*/) if (null === $this->getCommandLine()) { throw new RuntimeException('Unable to find the PHP executable.'); } - $env = 1 < func_num_args() ? func_get_arg(1) : null; + $env = 1 < \func_num_args() ? func_get_arg(1) : null; parent::start($callback, $env); } diff --git a/vendor/symfony/process/Pipes/AbstractPipes.php b/vendor/symfony/process/Pipes/AbstractPipes.php index 2bd1fe75b..e5e26866a 100644 --- a/vendor/symfony/process/Pipes/AbstractPipes.php +++ b/vendor/symfony/process/Pipes/AbstractPipes.php @@ -25,15 +25,16 @@ abstract class AbstractPipes implements PipesInterface private $inputBuffer = ''; private $input; private $blocked = true; + private $lastError; /** * @param resource|string|int|float|bool|\Iterator|null $input */ public function __construct($input) { - if (is_resource($input) || $input instanceof \Iterator) { + if (\is_resource($input) || $input instanceof \Iterator) { $this->input = $input; - } elseif (is_string($input)) { + } elseif (\is_string($input)) { $this->inputBuffer = $input; } else { $this->inputBuffer = (string) $input; @@ -58,10 +59,11 @@ public function close() */ protected function hasSystemCallBeenInterrupted() { - $lastError = error_get_last(); + $lastError = $this->lastError; + $this->lastError = null; // stream_select returns false when the `select` system call is interrupted by an incoming signal - return isset($lastError['message']) && false !== stripos($lastError['message'], 'interrupted system call'); + return null !== $lastError && false !== stripos($lastError, 'interrupted system call'); } /** @@ -76,7 +78,7 @@ protected function unblock() foreach ($this->pipes as $pipe) { stream_set_blocking($pipe, 0); } - if (is_resource($this->input)) { + if (\is_resource($this->input)) { stream_set_blocking($this->input, 0); } @@ -98,12 +100,12 @@ protected function write() if ($input instanceof \Iterator) { if (!$input->valid()) { $input = null; - } elseif (is_resource($input = $input->current())) { + } elseif (\is_resource($input = $input->current())) { stream_set_blocking($input, 0); } elseif (!isset($this->inputBuffer[0])) { - if (!is_string($input)) { + if (!\is_string($input)) { if (!is_scalar($input)) { - throw new InvalidArgumentException(sprintf('%s yielded a value of type "%s", but only scalars and stream resources are supported', get_class($this->input), gettype($input))); + throw new InvalidArgumentException(sprintf('%s yielded a value of type "%s", but only scalars and stream resources are supported', \get_class($this->input), \gettype($input))); } $input = (string) $input; } @@ -165,4 +167,12 @@ protected function write() return array($this->pipes[0]); } } + + /** + * @internal + */ + public function handleError($type, $msg) + { + $this->lastError = $msg; + } } diff --git a/vendor/symfony/process/Pipes/UnixPipes.php b/vendor/symfony/process/Pipes/UnixPipes.php index 78ffee7b0..254df5190 100644 --- a/vendor/symfony/process/Pipes/UnixPipes.php +++ b/vendor/symfony/process/Pipes/UnixPipes.php @@ -99,7 +99,9 @@ public function readAndWrite($blocking, $close = false) unset($r[0]); // let's have a look if something changed in streams - if (($r || $w) && false === @stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) { + set_error_handler(array($this, 'handleError')); + if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) { + restore_error_handler(); // if a system call has been interrupted, forget about it, let's try again // otherwise, an error occurred, let's reset pipes if (!$this->hasSystemCallBeenInterrupted()) { @@ -108,6 +110,7 @@ public function readAndWrite($blocking, $close = false) return $read; } + restore_error_handler(); foreach ($r as $pipe) { // prior PHP 5.4 the array passed to stream_select is modified and diff --git a/vendor/symfony/process/Pipes/WindowsPipes.php b/vendor/symfony/process/Pipes/WindowsPipes.php index d5fa2fdee..f577c08cc 100644 --- a/vendor/symfony/process/Pipes/WindowsPipes.php +++ b/vendor/symfony/process/Pipes/WindowsPipes.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Process\Pipes; -use Symfony\Component\Process\Process; use Symfony\Component\Process\Exception\RuntimeException; +use Symfony\Component\Process\Process; /** * WindowsPipes implementation uses temporary files as handles. @@ -28,6 +28,7 @@ class WindowsPipes extends AbstractPipes { private $files = array(); private $fileHandles = array(); + private $lockHandles = array(); private $readBytes = array( Process::STDOUT => 0, Process::STDERR => 0, @@ -47,31 +48,33 @@ public function __construct($input, $haveReadSupport) Process::STDOUT => Process::OUT, Process::STDERR => Process::ERR, ); - $tmpCheck = false; $tmpDir = sys_get_temp_dir(); $lastError = 'unknown reason'; set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; }); for ($i = 0;; ++$i) { foreach ($pipes as $pipe => $name) { $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name); - if (file_exists($file) && !unlink($file)) { - continue 2; - } - $h = fopen($file, 'xb'); - if (!$h) { - $error = $lastError; - if ($tmpCheck || $tmpCheck = unlink(tempnam(false, 'sf_check_'))) { - continue; - } + + if (!$h = fopen($file.'.lock', 'w')) { restore_error_handler(); - throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $error)); + throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError)); } - if (!$h || !$this->fileHandles[$pipe] = fopen($file, 'rb')) { + if (!flock($h, LOCK_EX | LOCK_NB)) { continue 2; } - if (isset($this->files[$pipe])) { - unlink($this->files[$pipe]); + if (isset($this->lockHandles[$pipe])) { + flock($this->lockHandles[$pipe], LOCK_UN); + fclose($this->lockHandles[$pipe]); + } + $this->lockHandles[$pipe] = $h; + + if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) { + flock($this->lockHandles[$pipe], LOCK_UN); + fclose($this->lockHandles[$pipe]); + unset($this->lockHandles[$pipe]); + continue 2; } + $this->fileHandles[$pipe] = $h; $this->files[$pipe] = $file; } break; @@ -85,7 +88,6 @@ public function __construct($input, $haveReadSupport) public function __destruct() { $this->close(); - $this->removeFiles(); } /** @@ -141,12 +143,15 @@ public function readAndWrite($blocking, $close = false) $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]); if (isset($data[0])) { - $this->readBytes[$type] += strlen($data); + $this->readBytes[$type] += \strlen($data); $read[$type] = $data; } if ($close) { + ftruncate($fileHandle, 0); fclose($fileHandle); - unset($this->fileHandles[$type]); + flock($this->lockHandles[$type], LOCK_UN); + fclose($this->lockHandles[$type]); + unset($this->fileHandles[$type], $this->lockHandles[$type]); } } @@ -175,22 +180,12 @@ public function areOpen() public function close() { parent::close(); - foreach ($this->fileHandles as $handle) { + foreach ($this->fileHandles as $type => $handle) { + ftruncate($handle, 0); fclose($handle); + flock($this->lockHandles[$type], LOCK_UN); + fclose($this->lockHandles[$type]); } - $this->fileHandles = array(); - } - - /** - * Removes temporary files. - */ - private function removeFiles() - { - foreach ($this->files as $filename) { - if (file_exists($filename)) { - @unlink($filename); - } - } - $this->files = array(); + $this->fileHandles = $this->lockHandles = array(); } } diff --git a/vendor/symfony/process/Process.php b/vendor/symfony/process/Process.php index 830c623e0..20af10324 100644 --- a/vendor/symfony/process/Process.php +++ b/vendor/symfony/process/Process.php @@ -143,7 +143,7 @@ class Process implements \IteratorAggregate */ public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = null) { - if (!function_exists('proc_open')) { + if (!\function_exists('proc_open')) { throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.'); } @@ -154,7 +154,7 @@ public function __construct($commandline, $cwd = null, array $env = null, $input // on Gnu/Linux, PHP builds with --enable-maintainer-zts are also affected // @see : https://bugs.php.net/bug.php?id=51800 // @see : https://bugs.php.net/bug.php?id=50524 - if (null === $this->cwd && (defined('ZEND_THREAD_SAFE') || '\\' === DIRECTORY_SEPARATOR)) { + if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) { $this->cwd = getcwd(); } if (null !== $env) { @@ -163,9 +163,9 @@ public function __construct($commandline, $cwd = null, array $env = null, $input $this->setInput($input); $this->setTimeout($timeout); - $this->useFileHandles = '\\' === DIRECTORY_SEPARATOR; + $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR; $this->pty = false; - $this->enhanceSigchildCompatibility = '\\' !== DIRECTORY_SEPARATOR && $this->isSigchildEnabled(); + $this->enhanceSigchildCompatibility = '\\' !== \DIRECTORY_SEPARATOR && $this->isSigchildEnabled(); if (null !== $options) { @trigger_error(sprintf('The $options parameter of the %s constructor is deprecated since Symfony 3.3 and will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED); $this->options = array_replace($this->options, $options); @@ -206,7 +206,7 @@ public function __clone() */ public function run($callback = null/*, array $env = array()*/) { - $env = 1 < func_num_args() ? func_get_arg(1) : null; + $env = 1 < \func_num_args() ? func_get_arg(1) : null; $this->start($callback, $env); return $this->wait(); @@ -233,7 +233,7 @@ public function mustRun(callable $callback = null/*, array $env = array()*/) if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.'); } - $env = 1 < func_num_args() ? func_get_arg(1) : null; + $env = 1 < \func_num_args() ? func_get_arg(1) : null; if (0 !== $this->run($callback, $env)) { throw new ProcessFailedException($this); @@ -267,12 +267,12 @@ public function start(callable $callback = null/*, array $env = array()*/) if ($this->isRunning()) { throw new RuntimeException('Process is already running'); } - if (2 <= func_num_args()) { + if (2 <= \func_num_args()) { $env = func_get_arg(1); } else { if (__CLASS__ !== static::class) { $r = new \ReflectionMethod($this, __FUNCTION__); - if (__CLASS__ !== $r->getDeclaringClass()->getName() && (2 > $r->getNumberOfParameters() || 'env' !== $r->getParameters()[0]->name)) { + if (__CLASS__ !== $r->getDeclaringClass()->getName() && (2 > $r->getNumberOfParameters() || 'env' !== $r->getParameters()[1]->name)) { @trigger_error(sprintf('The %s::start() method expects a second "$env" argument since Symfony 3.3. It will be made mandatory in 4.0.', static::class), E_USER_DEPRECATED); } } @@ -286,10 +286,10 @@ public function start(callable $callback = null/*, array $env = array()*/) $descriptors = $this->getDescriptors(); $inheritEnv = $this->inheritEnv; - if (is_array($commandline = $this->commandline)) { + if (\is_array($commandline = $this->commandline)) { $commandline = implode(' ', array_map(array($this, 'escapeArgument'), $commandline)); - if ('\\' !== DIRECTORY_SEPARATOR) { + if ('\\' !== \DIRECTORY_SEPARATOR) { // exec is mandatory to deal with sending a signal to the process $commandline = 'exec '.$commandline; } @@ -311,7 +311,7 @@ public function start(callable $callback = null/*, array $env = array()*/) } else { $env = $this->getDefaultEnv(); } - if ('\\' === DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) { + if ('\\' === \DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) { $this->options['bypass_shell'] = true; $commandline = $this->prepareWindowsCommandLine($commandline, $env); } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { @@ -326,7 +326,7 @@ public function start(callable $callback = null/*, array $env = array()*/) // @see : https://bugs.php.net/69442 $ptsWorkaround = fopen(__FILE__, 'r'); } - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $envPairs = $env; } else { $envPairs = array(); @@ -343,7 +343,7 @@ public function start(callable $callback = null/*, array $env = array()*/) $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $envPairs, $this->options); - if (!is_resource($this->process)) { + if (!\is_resource($this->process)) { throw new RuntimeException('Unable to launch a new process.'); } $this->status = self::STATUS_STARTED; @@ -383,7 +383,7 @@ public function restart(callable $callback = null/*, array $env = array()*/) if ($this->isRunning()) { throw new RuntimeException('Process is already running'); } - $env = 1 < func_num_args() ? func_get_arg(1) : null; + $env = 1 < \func_num_args() ? func_get_arg(1) : null; $process = clone $this; $process->start($callback, $env); @@ -422,8 +422,8 @@ public function wait(callable $callback = null) do { $this->checkTimeout(); - $running = '\\' === DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen(); - $this->readPipes($running, '\\' !== DIRECTORY_SEPARATOR || !$running); + $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen(); + $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running); } while ($running); while ($this->isRunning()) { @@ -692,7 +692,7 @@ public function clearErrorOutput() /** * Returns the exit code returned by the process. * - * @return null|int The exit status code, null if the Process is not terminated + * @return int|null The exit status code, null if the Process is not terminated * * @throws RuntimeException In case --enable-sigchild is activated and the sigchild compatibility mode is disabled */ @@ -713,7 +713,7 @@ public function getExitCode() * This method relies on the Unix exit code status standardization * and might not be relevant for other operating systems. * - * @return null|string A string representation for the exit status code, null if the Process is not terminated + * @return string|null A string representation for the exit status code, null if the Process is not terminated * * @see http://tldp.org/LDP/abs/html/exitcodes.html * @see http://en.wikipedia.org/wiki/Unix_signal @@ -939,7 +939,7 @@ public function addErrorOutput($line) */ public function getCommandLine() { - return is_array($this->commandline) ? implode(' ', array_map(array($this, 'escapeArgument'), $this->commandline)) : $this->commandline; + return \is_array($this->commandline) ? implode(' ', array_map(array($this, 'escapeArgument'), $this->commandline)) : $this->commandline; } /** @@ -1028,7 +1028,7 @@ public function setIdleTimeout($timeout) */ public function setTty($tty) { - if ('\\' === DIRECTORY_SEPARATOR && $tty) { + if ('\\' === \DIRECTORY_SEPARATOR && $tty) { throw new RuntimeException('TTY mode is not supported on Windows platform.'); } if ($tty) { @@ -1141,7 +1141,7 @@ public function setEnv(array $env) { // Process can not handle env values that are arrays $env = array_filter($env, function ($value) { - return !is_array($value); + return !\is_array($value); }); $this->env = $env; @@ -1355,7 +1355,7 @@ public static function isPtySupported() return $result; } - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { return $result = false; } @@ -1372,7 +1372,7 @@ private function getDescriptors() if ($this->input instanceof \Iterator) { $this->input->rewind(); } - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->processPipes = new WindowsPipes($this->input, !$this->outputDisabled || $this->hasCallback); } else { $this->processPipes = new UnixPipes($this->isTty(), $this->isPty(), $this->input, !$this->outputDisabled || $this->hasCallback); @@ -1396,7 +1396,7 @@ protected function buildCallback(callable $callback = null) if ($this->outputDisabled) { return function ($type, $data) use ($callback) { if (null !== $callback) { - call_user_func($callback, $type, $data); + \call_user_func($callback, $type, $data); } }; } @@ -1411,7 +1411,7 @@ protected function buildCallback(callable $callback = null) } if (null !== $callback) { - call_user_func($callback, $type, $data); + \call_user_func($callback, $type, $data); } }; } @@ -1430,7 +1430,7 @@ protected function updateStatus($blocking) $this->processInformation = proc_get_status($this->process); $running = $this->processInformation['running']; - $this->readPipes($running && $blocking, '\\' !== DIRECTORY_SEPARATOR || !$running); + $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running); if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) { $this->processInformation = $this->fallbackStatus + $this->processInformation; @@ -1452,7 +1452,7 @@ protected function isSigchildEnabled() return self::$sigchild; } - if (!function_exists('phpinfo') || defined('HHVM_VERSION')) { + if (!\function_exists('phpinfo') || \defined('HHVM_VERSION')) { return self::$sigchild = false; } @@ -1531,7 +1531,7 @@ private function readPipes($blocking, $close) private function close() { $this->processPipes->close(); - if (is_resource($this->process)) { + if (\is_resource($this->process)) { proc_close($this->process); } $this->exitcode = $this->processInformation['exitcode']; @@ -1565,8 +1565,8 @@ private function resetProcessData() $this->exitcode = null; $this->fallbackStatus = array(); $this->processInformation = null; - $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+'); - $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'wb+'); + $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b'); + $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b'); $this->process = null; $this->latestSignal = null; $this->status = self::STATUS_READY; @@ -1596,7 +1596,7 @@ private function doSignal($signal, $throwException) return false; } - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode); if ($exitCode && $this->isRunning()) { if ($throwException) { @@ -1608,7 +1608,7 @@ private function doSignal($signal, $throwException) } else { if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) { $ok = @proc_terminate($this->process, $signal); - } elseif (function_exists('posix_kill')) { + } elseif (\function_exists('posix_kill')) { $ok = @posix_kill($pid, $signal); } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) { $ok = false === fgets($pipes[2]); @@ -1713,7 +1713,7 @@ private function requireProcessIsTerminated($functionName) */ private function escapeArgument($argument) { - if ('\\' !== DIRECTORY_SEPARATOR) { + if ('\\' !== \DIRECTORY_SEPARATOR) { return "'".str_replace("'", "'\\''", $argument)."'"; } if ('' === $argument = (string) $argument) { @@ -1735,13 +1735,13 @@ private function getDefaultEnv() $env = array(); foreach ($_SERVER as $k => $v) { - if (is_string($v) && false !== $v = getenv($k)) { + if (\is_string($v) && false !== $v = getenv($k)) { $env[$k] = $v; } } foreach ($_ENV as $k => $v) { - if (is_string($v)) { + if (\is_string($v)) { $env[$k] = $v; } } diff --git a/vendor/symfony/process/ProcessBuilder.php b/vendor/symfony/process/ProcessBuilder.php index a91147cb9..9ad392466 100644 --- a/vendor/symfony/process/ProcessBuilder.php +++ b/vendor/symfony/process/ProcessBuilder.php @@ -78,7 +78,7 @@ public function add($argument) */ public function setPrefix($prefix) { - $this->prefix = is_array($prefix) ? $prefix : array($prefix); + $this->prefix = \is_array($prefix) ? $prefix : array($prefix); return $this; } @@ -103,7 +103,7 @@ public function setArguments(array $arguments) /** * Sets the working directory. * - * @param null|string $cwd The working directory + * @param string|null $cwd The working directory * * @return $this */ @@ -135,7 +135,7 @@ public function inheritEnvironmentVariables($inheritEnv = true) * defined environment variable. * * @param string $name The variable name - * @param null|string $value The variable value + * @param string|null $value The variable value * * @return $this */ @@ -258,7 +258,7 @@ public function enableOutput() */ public function getProcess() { - if (0 === count($this->prefix) && 0 === count($this->arguments)) { + if (0 === \count($this->prefix) && 0 === \count($this->arguments)) { throw new LogicException('You must add() command arguments before calling getProcess().'); } diff --git a/vendor/symfony/process/ProcessUtils.php b/vendor/symfony/process/ProcessUtils.php index c30950c1d..c06aa247a 100644 --- a/vendor/symfony/process/ProcessUtils.php +++ b/vendor/symfony/process/ProcessUtils.php @@ -46,7 +46,7 @@ public static function escapeArgument($argument) //Fix for PHP bug #49446 escapeshellarg doesn't work on Windows //@see https://bugs.php.net/bug.php?id=43784 //@see https://bugs.php.net/bug.php?id=49446 - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { if ('' === $argument) { return escapeshellarg($argument); } @@ -91,10 +91,10 @@ public static function escapeArgument($argument) public static function validateInput($caller, $input) { if (null !== $input) { - if (is_resource($input)) { + if (\is_resource($input)) { return $input; } - if (is_string($input)) { + if (\is_string($input)) { return $input; } if (is_scalar($input)) { @@ -118,6 +118,6 @@ public static function validateInput($caller, $input) private static function isSurroundedBy($arg, $char) { - return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1]; + return 2 < \strlen($arg) && $char === $arg[0] && $char === $arg[\strlen($arg) - 1]; } } diff --git a/vendor/symfony/process/Tests/ExecutableFinderTest.php b/vendor/symfony/process/Tests/ExecutableFinderTest.php index bc692f6a7..ee25eda02 100644 --- a/vendor/symfony/process/Tests/ExecutableFinderTest.php +++ b/vendor/symfony/process/Tests/ExecutableFinderTest.php @@ -41,7 +41,7 @@ public function testFind() $this->markTestSkipped('Cannot test when open_basedir is set'); } - $this->setPath(dirname(PHP_BINARY)); + $this->setPath(\dirname(PHP_BINARY)); $finder = new ExecutableFinder(); $result = $finder->find($this->getPhpBinaryName()); @@ -73,7 +73,7 @@ public function testFindWithExtraDirs() $this->setPath(''); - $extraDirs = array(dirname(PHP_BINARY)); + $extraDirs = array(\dirname(PHP_BINARY)); $finder = new ExecutableFinder(); $result = $finder->find($this->getPhpBinaryName(), null, $extraDirs); @@ -83,7 +83,7 @@ public function testFindWithExtraDirs() public function testFindWithOpenBaseDir() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Cannot run test on windows'); } @@ -91,7 +91,7 @@ public function testFindWithOpenBaseDir() $this->markTestSkipped('Cannot test when open_basedir is set'); } - $this->iniSet('open_basedir', dirname(PHP_BINARY).(!defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : '')); + $this->iniSet('open_basedir', \dirname(PHP_BINARY).(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : '')); $finder = new ExecutableFinder(); $result = $finder->find($this->getPhpBinaryName()); @@ -104,12 +104,12 @@ public function testFindProcessInOpenBasedir() if (ini_get('open_basedir')) { $this->markTestSkipped('Cannot test when open_basedir is set'); } - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Cannot run test on windows'); } $this->setPath(''); - $this->iniSet('open_basedir', PHP_BINARY.(!defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : '')); + $this->iniSet('open_basedir', PHP_BINARY.(!\defined('HHVM_VERSION') || HHVM_VERSION_ID >= 30800 ? PATH_SEPARATOR.'/' : '')); $finder = new ExecutableFinder(); $result = $finder->find($this->getPhpBinaryName(), false); @@ -117,9 +117,39 @@ public function testFindProcessInOpenBasedir() $this->assertSamePath(PHP_BINARY, $result); } + /** + * @requires PHP 5.4 + */ + public function testFindBatchExecutableOnWindows() + { + if (ini_get('open_basedir')) { + $this->markTestSkipped('Cannot test when open_basedir is set'); + } + if ('\\' !== \DIRECTORY_SEPARATOR) { + $this->markTestSkipped('Can be only tested on windows'); + } + + $target = tempnam(sys_get_temp_dir(), 'example-windows-executable'); + + touch($target); + touch($target.'.BAT'); + + $this->assertFalse(is_executable($target)); + + $this->setPath(sys_get_temp_dir()); + + $finder = new ExecutableFinder(); + $result = $finder->find(basename($target), false); + + unlink($target); + unlink($target.'.BAT'); + + $this->assertSamePath($target.'.BAT', $result); + } + private function assertSamePath($expected, $tested) { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertEquals(strtolower($expected), strtolower($tested)); } else { $this->assertEquals($expected, $tested); @@ -128,6 +158,6 @@ private function assertSamePath($expected, $tested) private function getPhpBinaryName() { - return basename(PHP_BINARY, '\\' === DIRECTORY_SEPARATOR ? '.exe' : ''); + return basename(PHP_BINARY, '\\' === \DIRECTORY_SEPARATOR ? '.exe' : ''); } } diff --git a/vendor/symfony/process/Tests/PhpExecutableFinderTest.php b/vendor/symfony/process/Tests/PhpExecutableFinderTest.php index b08ad5d3b..0c9e32d7d 100644 --- a/vendor/symfony/process/Tests/PhpExecutableFinderTest.php +++ b/vendor/symfony/process/Tests/PhpExecutableFinderTest.php @@ -24,14 +24,14 @@ class PhpExecutableFinderTest extends TestCase */ public function testFind() { - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $this->markTestSkipped('Should not be executed in HHVM context.'); } $f = new PhpExecutableFinder(); $current = PHP_BINARY; - $args = 'phpdbg' === PHP_SAPI ? ' -qrr' : ''; + $args = 'phpdbg' === \PHP_SAPI ? ' -qrr' : ''; $this->assertEquals($current.$args, $f->find(), '::find() returns the executable PHP'); $this->assertEquals($current, $f->find(false), '::find() returns the executable PHP'); @@ -42,7 +42,7 @@ public function testFind() */ public function testFindWithHHVM() { - if (!defined('HHVM_VERSION')) { + if (!\defined('HHVM_VERSION')) { $this->markTestSkipped('Should be executed in HHVM context.'); } @@ -61,9 +61,9 @@ public function testFindArguments() { $f = new PhpExecutableFinder(); - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { $this->assertEquals($f->findArguments(), array('--php'), '::findArguments() returns HHVM arguments'); - } elseif ('phpdbg' === PHP_SAPI) { + } elseif ('phpdbg' === \PHP_SAPI) { $this->assertEquals($f->findArguments(), array('-qrr'), '::findArguments() returns phpdbg arguments'); } else { $this->assertEquals($f->findArguments(), array(), '::findArguments() returns no arguments'); diff --git a/vendor/symfony/process/Tests/PhpProcessTest.php b/vendor/symfony/process/Tests/PhpProcessTest.php index f67368c7b..b0f0a57ac 100644 --- a/vendor/symfony/process/Tests/PhpProcessTest.php +++ b/vendor/symfony/process/Tests/PhpProcessTest.php @@ -43,6 +43,6 @@ public function testCommandLine() $process->wait(); $this->assertContains($commandLine, $process->getCommandLine(), '::getCommandLine() returns the command line of PHP after wait'); - $this->assertSame(PHP_VERSION.PHP_SAPI, $process->getOutput()); + $this->assertSame(PHP_VERSION.\PHP_SAPI, $process->getOutput()); } } diff --git a/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php b/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php index bbd7ddfeb..1ea0e127f 100644 --- a/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php +++ b/vendor/symfony/process/Tests/PipeStdinInStdoutStdErrStreamSelect.php @@ -35,22 +35,22 @@ } if (in_array(STDOUT, $w) && strlen($out) > 0) { - $written = fwrite(STDOUT, (binary) $out, 32768); + $written = fwrite(STDOUT, (string) $out, 32768); if (false === $written) { die(ERR_WRITE_FAILED); } - $out = (binary) substr($out, $written); + $out = (string) substr($out, $written); } if (null === $read && '' === $out) { $write = array_diff($write, array(STDOUT)); } if (in_array(STDERR, $w) && strlen($err) > 0) { - $written = fwrite(STDERR, (binary) $err, 32768); + $written = fwrite(STDERR, (string) $err, 32768); if (false === $written) { die(ERR_WRITE_FAILED); } - $err = (binary) substr($err, $written); + $err = (string) substr($err, $written); } if (null === $read && '' === $err) { $write = array_diff($write, array(STDERR)); diff --git a/vendor/symfony/process/Tests/ProcessBuilderTest.php b/vendor/symfony/process/Tests/ProcessBuilderTest.php index 36c40bf03..c98b87305 100644 --- a/vendor/symfony/process/Tests/ProcessBuilderTest.php +++ b/vendor/symfony/process/Tests/ProcessBuilderTest.php @@ -90,14 +90,14 @@ public function testPrefixIsPrependedToAllGeneratedProcess() $pb->setPrefix('/usr/bin/php'); $proc = $pb->setArguments(array('-v'))->getProcess(); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertEquals('"/usr/bin/php" -v', $proc->getCommandLine()); } else { $this->assertEquals("'/usr/bin/php' '-v'", $proc->getCommandLine()); } $proc = $pb->setArguments(array('-i'))->getProcess(); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertEquals('"/usr/bin/php" -i', $proc->getCommandLine()); } else { $this->assertEquals("'/usr/bin/php' '-i'", $proc->getCommandLine()); @@ -110,14 +110,14 @@ public function testArrayPrefixesArePrependedToAllGeneratedProcess() $pb->setPrefix(array('/usr/bin/php', 'composer.phar')); $proc = $pb->setArguments(array('-v'))->getProcess(); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertEquals('"/usr/bin/php" composer.phar -v', $proc->getCommandLine()); } else { $this->assertEquals("'/usr/bin/php' 'composer.phar' '-v'", $proc->getCommandLine()); } $proc = $pb->setArguments(array('-i'))->getProcess(); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertEquals('"/usr/bin/php" composer.phar -i', $proc->getCommandLine()); } else { $this->assertEquals("'/usr/bin/php' 'composer.phar' '-i'", $proc->getCommandLine()); @@ -129,7 +129,7 @@ public function testShouldEscapeArguments() $pb = new ProcessBuilder(array('%path%', 'foo " bar', '%baz%baz')); $proc = $pb->getProcess(); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertSame('""^%"path"^%"" "foo "" bar" ""^%"baz"^%"baz"', $proc->getCommandLine()); } else { $this->assertSame("'%path%' 'foo \" bar' '%baz%baz'", $proc->getCommandLine()); @@ -142,7 +142,7 @@ public function testShouldEscapeArgumentsAndPrefix() $pb->setPrefix('%prefix%'); $proc = $pb->getProcess(); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertSame('""^%"prefix"^%"" arg', $proc->getCommandLine()); } else { $this->assertSame("'%prefix%' 'arg'", $proc->getCommandLine()); @@ -163,7 +163,7 @@ public function testShouldNotThrowALogicExceptionIfNoArgument() ->setPrefix('/usr/bin/php') ->getProcess(); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertEquals('"/usr/bin/php"', $process->getCommandLine()); } else { $this->assertEquals("'/usr/bin/php'", $process->getCommandLine()); @@ -175,7 +175,7 @@ public function testShouldNotThrowALogicExceptionIfNoPrefix() $process = ProcessBuilder::create(array('/usr/bin/php')) ->getProcess(); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->assertEquals('"/usr/bin/php"', $process->getCommandLine()); } else { $this->assertEquals("'/usr/bin/php'", $process->getCommandLine()); @@ -213,7 +213,7 @@ public function testInvalidInput() public function testDoesNotPrefixExec() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('This test cannot run on Windows.'); } diff --git a/vendor/symfony/process/Tests/ProcessTest.php b/vendor/symfony/process/Tests/ProcessTest.php index bca7ddd9a..da74a3db2 100644 --- a/vendor/symfony/process/Tests/ProcessTest.php +++ b/vendor/symfony/process/Tests/ProcessTest.php @@ -33,7 +33,7 @@ class ProcessTest extends TestCase public static function setUpBeforeClass() { $phpBin = new PhpExecutableFinder(); - self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === PHP_SAPI ? 'php' : $phpBin->find()); + self::$phpBin = getenv('SYMFONY_PROCESS_PHP_TEST_BINARY') ?: ('phpdbg' === \PHP_SAPI ? 'php' : $phpBin->find()); ob_start(); phpinfo(INFO_GENERAL); @@ -54,7 +54,7 @@ protected function tearDown() */ public function testInvalidCwd() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('False-positive on Windows/appveyor.'); } @@ -68,7 +68,7 @@ public function testInvalidCwd() public function testThatProcessDoesNotThrowWarningDuringRun() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('This test is transient on Windows'); } @trigger_error('Test Error', E_USER_NOTICE); @@ -158,7 +158,7 @@ public function testAllOutputIsActuallyReadOnTermination() $o = $p->getOutput(); - $this->assertEquals($expectedOutputSize, strlen($o)); + $this->assertEquals($expectedOutputSize, \strlen($o)); } public function testCallbacksAreExecutedWithStart() @@ -200,8 +200,8 @@ public function testProcessPipes($code, $size) $p->setInput($expected); $p->run(); - $this->assertEquals($expectedLength, strlen($p->getOutput())); - $this->assertEquals($expectedLength, strlen($p->getErrorOutput())); + $this->assertEquals($expectedLength, \strlen($p->getOutput())); + $this->assertEquals($expectedLength, \strlen($p->getErrorOutput())); } /** @@ -222,8 +222,8 @@ public function testSetStreamAsInput($code, $size) fclose($stream); - $this->assertEquals($expectedLength, strlen($p->getOutput())); - $this->assertEquals($expectedLength, strlen($p->getErrorOutput())); + $this->assertEquals($expectedLength, \strlen($p->getOutput())); + $this->assertEquals($expectedLength, \strlen($p->getErrorOutput())); } public function testLiveStreamAsInput() @@ -303,7 +303,7 @@ public function provideInputValues() public function chainedCommandsOutputProvider() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { return array( array("2 \r\n2\r\n", '&&', '2'), ); @@ -422,7 +422,7 @@ public function testFlushOutput() public function testZeroAsOutput() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { // see http://stackoverflow.com/questions/7105433/windows-batch-echo-without-new-line $p = $this->getProcess('echo | set /p dummyName=0'); } else { @@ -435,7 +435,7 @@ public function testZeroAsOutput() public function testExitCodeCommandFailed() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Windows does not support POSIX exit code'); } $this->skipIfNotEnhancedSigchild(); @@ -447,12 +447,9 @@ public function testExitCodeCommandFailed() $this->assertGreaterThan(0, $process->getExitCode()); } - /** - * @group tty - */ public function testTTYCommand() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Windows does not have /dev/tty support'); } @@ -465,12 +462,9 @@ public function testTTYCommand() $this->assertSame(Process::STATUS_TERMINATED, $process->getStatus()); } - /** - * @group tty - */ public function testTTYCommandExitCode() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Windows does have /dev/tty support'); } $this->skipIfNotEnhancedSigchild(); @@ -488,7 +482,7 @@ public function testTTYCommandExitCode() */ public function testTTYInWindowsEnvironment() { - if ('\\' !== DIRECTORY_SEPARATOR) { + if ('\\' !== \DIRECTORY_SEPARATOR) { $this->markTestSkipped('This test is for Windows platform only'); } @@ -575,7 +569,7 @@ public function testUpdateStatus() { $process = $this->getProcess('echo foo'); $process->run(); - $this->assertGreaterThan(0, strlen($process->getOutput())); + $this->assertGreaterThan(0, \strlen($process->getOutput())); } public function testGetExitCodeIsNullOnStart() @@ -674,7 +668,7 @@ public function testIsNotSuccessful() public function testProcessIsNotSignaled() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Windows does not support POSIX signals'); } $this->skipIfNotEnhancedSigchild(); @@ -686,7 +680,7 @@ public function testProcessIsNotSignaled() public function testProcessWithoutTermSignal() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Windows does not support POSIX signals'); } $this->skipIfNotEnhancedSigchild(); @@ -698,7 +692,7 @@ public function testProcessWithoutTermSignal() public function testProcessIsSignaledIfStopped() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('Windows does not support POSIX signals'); } $this->skipIfNotEnhancedSigchild(); @@ -716,7 +710,7 @@ public function testProcessIsSignaledIfStopped() */ public function testProcessThrowsExceptionWhenExternallySignaled() { - if (!function_exists('posix_kill')) { + if (!\function_exists('posix_kill')) { $this->markTestSkipped('Function posix_kill is required.'); } $this->skipIfNotEnhancedSigchild(false); @@ -1020,7 +1014,7 @@ public function provideMethodsThatNeedATerminatedProcess() */ public function testWrongSignal($signal) { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { $this->markTestSkipped('POSIX signals do not work on Windows'); } @@ -1183,7 +1177,7 @@ public function pipesCodeProvider() 'include \''.__DIR__.'/PipeStdinInStdoutStdErrStreamSelect.php\';', ); - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { // Avoid XL buffers on Windows because of https://bugs.php.net/bug.php?id=65650 $sizes = array(1, 2, 4, 8); } else { @@ -1486,7 +1480,7 @@ public function testGetCommandLine() { $p = new Process(array('/usr/bin/php')); - $expected = '\\' === DIRECTORY_SEPARATOR ? '"/usr/bin/php"' : "'/usr/bin/php'"; + $expected = '\\' === \DIRECTORY_SEPARATOR ? '"/usr/bin/php"' : "'/usr/bin/php'"; $this->assertSame($expected, $p->getCommandLine()); } @@ -1498,7 +1492,7 @@ public function testEscapeArgument($arg) $p = new Process(array(self::$phpBin, '-r', 'echo $argv[1];', $arg)); $p->run(); - $this->assertSame($arg, $p->getOutput()); + $this->assertSame((string) $arg, $p->getOutput()); } /** @@ -1511,7 +1505,7 @@ public function testEscapeArgumentWhenInheritEnvDisabled($arg) $p->inheritEnvironmentVariables(false); $p->run(); - $this->assertSame($arg, $p->getOutput()); + $this->assertSame((string) $arg, $p->getOutput()); } public function testRawCommandLine() @@ -1541,12 +1535,15 @@ public function provideEscapeArgument() yield array("a!b\tc"); yield array('a\\\\"\\"'); yield array('éÉèÈàÀöä'); + yield array(null); + yield array(1); + yield array(1.1); } public function testEnvArgument() { $env = array('FOO' => 'Foo', 'BAR' => 'Bar'); - $cmd = '\\' === DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ'; + $cmd = '\\' === \DIRECTORY_SEPARATOR ? 'echo !FOO! !BAR! !BAZ!' : 'echo $FOO $BAR $BAZ'; $p = new Process($cmd, null, $env); $p->run(null, array('BAR' => 'baR', 'BAZ' => 'baZ')); @@ -1556,9 +1553,9 @@ public function testEnvArgument() /** * @param string $commandline - * @param null|string $cwd - * @param null|array $env - * @param null|string $input + * @param string|null $cwd + * @param array|null $env + * @param string|null $input * @param int $timeout * @param array $options * diff --git a/vendor/symfony/process/Tests/ProcessUtilsTest.php b/vendor/symfony/process/Tests/ProcessUtilsTest.php index 82fd8cfa8..0a3ccb576 100644 --- a/vendor/symfony/process/Tests/ProcessUtilsTest.php +++ b/vendor/symfony/process/Tests/ProcessUtilsTest.php @@ -29,7 +29,7 @@ public function testEscapeArgument($result, $argument) public function dataArguments() { - if ('\\' === DIRECTORY_SEPARATOR) { + if ('\\' === \DIRECTORY_SEPARATOR) { return array( array('"\"php\" \"-v\""', '"php" "-v"'), array('"foo bar"', 'foo bar'), diff --git a/vendor/symfony/process/phpunit.xml.dist b/vendor/symfony/process/phpunit.xml.dist index d38846730..c32f25101 100644 --- a/vendor/symfony/process/phpunit.xml.dist +++ b/vendor/symfony/process/phpunit.xml.dist @@ -1,7 +1,7 @@ $value) { $method = 'set'.str_replace('_', '', $key); if (!method_exists($this, $method)) { - throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, get_class($this))); + throw new \BadMethodCallException(sprintf('Unknown property "%s" on annotation "%s".', $key, \get_class($this))); } $this->$method($value); } @@ -114,7 +114,7 @@ public function getDefaults() public function setSchemes($schemes) { - $this->schemes = is_array($schemes) ? $schemes : array($schemes); + $this->schemes = \is_array($schemes) ? $schemes : array($schemes); } public function getSchemes() @@ -124,7 +124,7 @@ public function getSchemes() public function setMethods($methods) { - $this->methods = is_array($methods) ? $methods : array($methods); + $this->methods = \is_array($methods) ? $methods : array($methods); } public function getMethods() diff --git a/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php b/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php index 4af0a5a28..6e858104c 100644 --- a/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php +++ b/vendor/symfony/routing/DependencyInjection/RoutingResolverPass.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Routing\DependencyInjection; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\PriorityTaggedServiceTrait; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; /** * Adds tagged routing.loader services to routing.resolver service. diff --git a/vendor/symfony/routing/Generator/UrlGenerator.php b/vendor/symfony/routing/Generator/UrlGenerator.php index 02a59a925..6ed70cabd 100644 --- a/vendor/symfony/routing/Generator/UrlGenerator.php +++ b/vendor/symfony/routing/Generator/UrlGenerator.php @@ -11,12 +11,12 @@ namespace Symfony\Component\Routing\Generator; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; +use Psr\Log\LoggerInterface; use Symfony\Component\Routing\Exception\InvalidParameterException; -use Symfony\Component\Routing\Exception\RouteNotFoundException; use Symfony\Component\Routing\Exception\MissingMandatoryParametersException; -use Psr\Log\LoggerInterface; +use Symfony\Component\Routing\Exception\RouteNotFoundException; +use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\RouteCollection; /** * UrlGenerator can generate a URL or a path for any route in the RouteCollection @@ -185,7 +185,7 @@ protected function doGenerate($variables, $defaults, $requirements, $tokens, $pa $scheme = $this->context->getScheme(); if ($requiredSchemes) { - if (!in_array($scheme, $requiredSchemes, true)) { + if (!\in_array($scheme, $requiredSchemes, true)) { $referenceType = self::ABSOLUTE_URL; $scheme = current($requiredSchemes); } @@ -308,7 +308,7 @@ public static function getRelativePath($basePath, $targetPath) } $targetDirs[] = $targetFile; - $path = str_repeat('../', count($sourceDirs)).implode('/', $targetDirs); + $path = str_repeat('../', \count($sourceDirs)).implode('/', $targetDirs); // A reference to the same base directory or an empty subdirectory must be prefixed with "./". // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used diff --git a/vendor/symfony/routing/Loader/AnnotationClassLoader.php b/vendor/symfony/routing/Loader/AnnotationClassLoader.php index fd1d2b655..76a120b8e 100644 --- a/vendor/symfony/routing/Loader/AnnotationClassLoader.php +++ b/vendor/symfony/routing/Loader/AnnotationClassLoader.php @@ -12,11 +12,11 @@ namespace Symfony\Component\Routing\Loader; use Doctrine\Common\Annotations\Reader; +use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\Config\Loader\LoaderResolverInterface; use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\Loader\LoaderResolverInterface; /** * AnnotationClassLoader loads routing information from a PHP class and its methods. @@ -120,11 +120,9 @@ public function load($class, $type = null) } if (0 === $collection->count() && $class->hasMethod('__invoke')) { + $globals = $this->resetGlobals(); foreach ($this->reader->getClassAnnotations($class) as $annot) { if ($annot instanceof $this->routeAnnotationClass) { - $globals['path'] = ''; - $globals['name'] = ''; - $this->addRoute($collection, $annot, $globals, $class, $class->getMethod('__invoke')); } } @@ -174,7 +172,7 @@ protected function addRoute(RouteCollection $collection, $annot, $globals, \Refl */ public function supports($resource, $type = null) { - return is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type); + return \is_string($resource) && preg_match('/^(?:\\\\?[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)+$/', $resource) && (!$type || 'annotation' === $type); } /** @@ -212,17 +210,7 @@ protected function getDefaultRouteName(\ReflectionClass $class, \ReflectionMetho protected function getGlobals(\ReflectionClass $class) { - $globals = array( - 'path' => '', - 'requirements' => array(), - 'options' => array(), - 'defaults' => array(), - 'schemes' => array(), - 'methods' => array(), - 'host' => '', - 'condition' => '', - 'name' => '', - ); + $globals = $this->resetGlobals(); if ($annot = $this->reader->getClassAnnotation($class, $this->routeAnnotationClass)) { if (null !== $annot->getName()) { @@ -265,6 +253,21 @@ protected function getGlobals(\ReflectionClass $class) return $globals; } + private function resetGlobals() + { + return array( + 'path' => '', + 'requirements' => array(), + 'options' => array(), + 'defaults' => array(), + 'schemes' => array(), + 'methods' => array(), + 'host' => '', + 'condition' => '', + 'name' => '', + ); + } + protected function createRoute($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition) { return new Route($path, $defaults, $requirements, $options, $host, $schemes, $methods, $condition); diff --git a/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php b/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php index 4574a0201..3fb70ea20 100644 --- a/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php +++ b/vendor/symfony/routing/Loader/AnnotationDirectoryLoader.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Routing\Loader; -use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Config\Resource\DirectoryResource; +use Symfony\Component\Routing\RouteCollection; /** * AnnotationDirectoryLoader loads routing information from annotations set @@ -80,7 +80,7 @@ public function supports($resource, $type = null) return true; } - if ($type || !is_string($resource)) { + if ($type || !\is_string($resource)) { return false; } diff --git a/vendor/symfony/routing/Loader/AnnotationFileLoader.php b/vendor/symfony/routing/Loader/AnnotationFileLoader.php index cf9f0704c..034a1c580 100644 --- a/vendor/symfony/routing/Loader/AnnotationFileLoader.php +++ b/vendor/symfony/routing/Loader/AnnotationFileLoader.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Routing\Loader; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Config\Resource\FileResource; -use Symfony\Component\Config\Loader\FileLoader; use Symfony\Component\Config\FileLocatorInterface; +use Symfony\Component\Config\Loader\FileLoader; +use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Routing\RouteCollection; /** * AnnotationFileLoader loads routing information from annotations set @@ -31,7 +31,7 @@ class AnnotationFileLoader extends FileLoader */ public function __construct(FileLocatorInterface $locator, AnnotationClassLoader $loader) { - if (!function_exists('token_get_all')) { + if (!\function_exists('token_get_all')) { throw new \RuntimeException('The Tokenizer extension is required for the routing annotation loaders.'); } @@ -72,7 +72,7 @@ public function load($file, $type = null) */ public function supports($resource, $type = null) { - return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type); + return \is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'annotation' === $type); } /** @@ -88,7 +88,7 @@ protected function findClass($file) $namespace = false; $tokens = token_get_all(file_get_contents($file)); - if (1 === count($tokens) && T_INLINE_HTML === $tokens[0][0]) { + if (1 === \count($tokens) && T_INLINE_HTML === $tokens[0][0]) { throw new \InvalidArgumentException(sprintf('The file "%s" does not contain PHP code. Did you forgot to add the "loader->setCurrentDir(dirname($this->path)); + $this->loader->setCurrentDir(\dirname($this->path)); $imported = $this->loader->import($resource, $type, $ignoreErrors, $this->file); - if (!is_array($imported)) { + if (!\is_array($imported)) { return new ImportConfigurator($this->collection, $imported); } diff --git a/vendor/symfony/routing/Loader/DirectoryLoader.php b/vendor/symfony/routing/Loader/DirectoryLoader.php index 4bb5b31b6..08e833e0a 100644 --- a/vendor/symfony/routing/Loader/DirectoryLoader.php +++ b/vendor/symfony/routing/Loader/DirectoryLoader.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Routing\Loader; use Symfony\Component\Config\Loader\FileLoader; -use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Config\Resource\DirectoryResource; +use Symfony\Component\Routing\RouteCollection; class DirectoryLoader extends FileLoader { diff --git a/vendor/symfony/routing/Loader/ObjectRouteLoader.php b/vendor/symfony/routing/Loader/ObjectRouteLoader.php index 0899a8181..12fc2bbe1 100644 --- a/vendor/symfony/routing/Loader/ObjectRouteLoader.php +++ b/vendor/symfony/routing/Loader/ObjectRouteLoader.php @@ -45,7 +45,7 @@ abstract protected function getServiceObject($id); public function load($resource, $type = null) { $parts = explode(':', $resource); - if (2 != count($parts)) { + if (2 != \count($parts)) { throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service_name:methodName"', $resource)); } @@ -54,20 +54,20 @@ public function load($resource, $type = null) $loaderObject = $this->getServiceObject($serviceString); - if (!is_object($loaderObject)) { - throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', get_class($this), gettype($loaderObject))); + if (!\is_object($loaderObject)) { + throw new \LogicException(sprintf('%s:getServiceObject() must return an object: %s returned', \get_class($this), \gettype($loaderObject))); } if (!method_exists($loaderObject, $method)) { - throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, get_class($loaderObject), $resource)); + throw new \BadMethodCallException(sprintf('Method "%s" not found on "%s" when importing routing resource "%s"', $method, \get_class($loaderObject), $resource)); } - $routeCollection = call_user_func(array($loaderObject, $method), $this); + $routeCollection = \call_user_func(array($loaderObject, $method), $this); if (!$routeCollection instanceof RouteCollection) { - $type = is_object($routeCollection) ? get_class($routeCollection) : gettype($routeCollection); + $type = \is_object($routeCollection) ? \get_class($routeCollection) : \gettype($routeCollection); - throw new \LogicException(sprintf('The %s::%s method must return a RouteCollection: %s returned', get_class($loaderObject), $method, $type)); + throw new \LogicException(sprintf('The %s::%s method must return a RouteCollection: %s returned', \get_class($loaderObject), $method, $type)); } // make the service file tracked so that if it changes, the cache rebuilds diff --git a/vendor/symfony/routing/Loader/PhpFileLoader.php b/vendor/symfony/routing/Loader/PhpFileLoader.php index 3fcd692f9..9e009387d 100644 --- a/vendor/symfony/routing/Loader/PhpFileLoader.php +++ b/vendor/symfony/routing/Loader/PhpFileLoader.php @@ -36,7 +36,7 @@ class PhpFileLoader extends FileLoader public function load($file, $type = null) { $path = $this->locator->locate($file); - $this->setCurrentDir(dirname($path)); + $this->setCurrentDir(\dirname($path)); // the closure forbids access to the private scope in the included file $loader = $this; @@ -63,7 +63,7 @@ public function load($file, $type = null) */ public function supports($resource, $type = null) { - return is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type); + return \is_string($resource) && 'php' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'php' === $type); } } diff --git a/vendor/symfony/routing/Loader/XmlFileLoader.php b/vendor/symfony/routing/Loader/XmlFileLoader.php index f3f66055e..689245b5a 100644 --- a/vendor/symfony/routing/Loader/XmlFileLoader.php +++ b/vendor/symfony/routing/Loader/XmlFileLoader.php @@ -11,11 +11,11 @@ namespace Symfony\Component\Routing\Loader; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; -use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Config\Loader\FileLoader; +use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Config\Util\XmlUtils; +use Symfony\Component\Routing\Route; +use Symfony\Component\Routing\RouteCollection; /** * XmlFileLoader loads XML routing files. @@ -93,7 +93,7 @@ protected function parseNode(RouteCollection $collection, \DOMElement $node, $pa */ public function supports($resource, $type = null) { - return is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'xml' === $type); + return \is_string($resource) && 'xml' === pathinfo($resource, PATHINFO_EXTENSION) && (!$type || 'xml' === $type); } /** @@ -144,11 +144,11 @@ protected function parseImport(RouteCollection $collection, \DOMElement $node, $ list($defaults, $requirements, $options, $condition) = $this->parseConfigs($node, $path); - $this->setCurrentDir(dirname($path)); + $this->setCurrentDir(\dirname($path)); $imported = $this->import($resource, ('' !== $type ? $type : null), false, $file); - if (!is_array($imported)) { + if (!\is_array($imported)) { $imported = array($imported); } diff --git a/vendor/symfony/routing/Loader/YamlFileLoader.php b/vendor/symfony/routing/Loader/YamlFileLoader.php index f59f9097f..d6511daac 100644 --- a/vendor/symfony/routing/Loader/YamlFileLoader.php +++ b/vendor/symfony/routing/Loader/YamlFileLoader.php @@ -11,12 +11,12 @@ namespace Symfony\Component\Routing\Loader; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; +use Symfony\Component\Config\Loader\FileLoader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Routing\Route; +use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Yaml\Exception\ParseException; use Symfony\Component\Yaml\Parser as YamlParser; -use Symfony\Component\Config\Loader\FileLoader; /** * YamlFileLoader loads Yaml routing files. @@ -80,7 +80,7 @@ public function load($file, $type = null) } // not an array - if (!is_array($parsedConfig)) { + if (!\is_array($parsedConfig)) { throw new \InvalidArgumentException(sprintf('The file "%s" must contain a YAML array.', $path)); } @@ -102,7 +102,7 @@ public function load($file, $type = null) */ public function supports($resource, $type = null) { - return is_string($resource) && in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yml', 'yaml'), true) && (!$type || 'yaml' === $type); + return \is_string($resource) && \in_array(pathinfo($resource, PATHINFO_EXTENSION), array('yml', 'yaml'), true) && (!$type || 'yaml' === $type); } /** @@ -156,11 +156,11 @@ protected function parseImport(RouteCollection $collection, array $config, $path $defaults['_controller'] = $config['controller']; } - $this->setCurrentDir(dirname($path)); + $this->setCurrentDir(\dirname($path)); $imported = $this->import($config['resource'], $type, false, $file); - if (!is_array($imported)) { + if (!\is_array($imported)) { $imported = array($imported); } @@ -199,32 +199,20 @@ protected function parseImport(RouteCollection $collection, array $config, $path */ protected function validate($config, $name, $path) { - if (!is_array($config)) { + if (!\is_array($config)) { throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path)); } if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) { - throw new \InvalidArgumentException(sprintf( - 'The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', - $path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys) - )); + throw new \InvalidArgumentException(sprintf('The routing file "%s" contains unsupported keys for "%s": "%s". Expected one of: "%s".', $path, $name, implode('", "', $extraKeys), implode('", "', self::$availableKeys))); } if (isset($config['resource']) && isset($config['path'])) { - throw new \InvalidArgumentException(sprintf( - 'The routing file "%s" must not specify both the "resource" key and the "path" key for "%s". Choose between an import and a route definition.', - $path, $name - )); + throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "resource" key and the "path" key for "%s". Choose between an import and a route definition.', $path, $name)); } if (!isset($config['resource']) && isset($config['type'])) { - throw new \InvalidArgumentException(sprintf( - 'The "type" key for the route definition "%s" in "%s" is unsupported. It is only available for imports in combination with the "resource" key.', - $name, $path - )); + throw new \InvalidArgumentException(sprintf('The "type" key for the route definition "%s" in "%s" is unsupported. It is only available for imports in combination with the "resource" key.', $name, $path)); } if (!isset($config['resource']) && !isset($config['path'])) { - throw new \InvalidArgumentException(sprintf( - 'You must define a "path" for the route "%s" in file "%s".', - $name, $path - )); + throw new \InvalidArgumentException(sprintf('You must define a "path" for the route "%s" in file "%s".', $name, $path)); } if (isset($config['controller']) && isset($config['defaults']['_controller'])) { throw new \InvalidArgumentException(sprintf('The routing file "%s" must not specify both the "controller" key and the defaults key "_controller" for "%s".', $path, $name)); diff --git a/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php b/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php index 6916297b8..dd057d2ee 100644 --- a/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php +++ b/vendor/symfony/routing/Matcher/Dumper/DumperCollection.php @@ -106,7 +106,7 @@ protected function getParent() /** * Sets the parent collection. */ - protected function setParent(DumperCollection $parent) + protected function setParent(self $parent) { $this->parent = $parent; } diff --git a/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php b/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php index 40d8df67e..ac1f8f813 100644 --- a/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php +++ b/vendor/symfony/routing/Matcher/Dumper/PhpMatcherDumper.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Routing\Matcher\Dumper; +use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; +use Symfony\Component\ExpressionLanguage\ExpressionLanguage; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; /** * PhpMatcherDumper creates a PHP class able to match URLs for a given set of routes. @@ -236,10 +236,10 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren $hostMatches = false; $methods = $route->getMethods(); - $supportsTrailingSlash = $supportsRedirections && (!$methods || in_array('GET', $methods)); + $supportsTrailingSlash = $supportsRedirections && (!$methods || \in_array('GET', $methods)); $regex = $compiledRoute->getRegex(); - if (!count($compiledRoute->getPathVariables()) && false !== preg_match('#^(.)\^(?P.*?)\$\1#'.('u' === substr($regex, -1) ? 'u' : ''), $regex, $m)) { + if (!\count($compiledRoute->getPathVariables()) && false !== preg_match('#^(.)\^(?P.*?)\$\1#'.('u' === substr($regex, -1) ? 'u' : ''), $regex, $m)) { if ($supportsTrailingSlash && '/' === substr($m['url'], -1)) { $conditions[] = sprintf('%s === $trimmedPathinfo', var_export(rtrim(str_replace('\\', '', $m['url']), '/'), true)); $hasTrailingSlash = true; @@ -279,7 +279,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren $gotoname = 'not_'.preg_replace('/[^A-Za-z0-9_]/', '', $name); // the offset where the return value is appended below, with indendation - $retOffset = 12 + strlen($code); + $retOffset = 12 + \strlen($code); // optimize parameters array if ($matches || $hostMatches) { @@ -318,7 +318,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren } if ($methods) { - $methodVariable = in_array('GET', $methods) ? '$canonicalMethod' : '$requestMethod'; + $methodVariable = \in_array('GET', $methods) ? '$canonicalMethod' : '$requestMethod'; $methods = implode("', '", $methods); } diff --git a/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php b/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php index 736580861..d1cd68ee5 100644 --- a/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php +++ b/vendor/symfony/routing/Matcher/Dumper/StaticPrefixCollection.php @@ -69,7 +69,7 @@ public function addRoute($prefix, $route) // This is needed because otherwise routes that come afterwards have higher precedence // than a possible regular expression, which goes against the input order sorting. $this->items[] = array($prefix, $route); - $this->matchStart = count($this->items); + $this->matchStart = \count($this->items); return; } @@ -106,7 +106,7 @@ public function addRoute($prefix, $route) * @param string $prefix * @param mixed $route * - * @return null|StaticPrefixCollection + * @return StaticPrefixCollection|null */ private function groupWithItem($item, $prefix, $route) { @@ -152,9 +152,9 @@ private function accepts($prefix) */ private function detectCommonPrefix($prefix, $anotherPrefix) { - $baseLength = strlen($this->prefix); + $baseLength = \strlen($this->prefix); $commonLength = $baseLength; - $end = min(strlen($prefix), strlen($anotherPrefix)); + $end = min(\strlen($prefix), \strlen($anotherPrefix)); for ($i = $baseLength; $i <= $end; ++$i) { if (substr($prefix, 0, $i) !== substr($anotherPrefix, 0, $i)) { @@ -166,7 +166,7 @@ private function detectCommonPrefix($prefix, $anotherPrefix) $commonPrefix = rtrim(substr($prefix, 0, $commonLength), '/'); - if (strlen($commonPrefix) > $baseLength) { + if (\strlen($commonPrefix) > $baseLength) { return $commonPrefix; } @@ -201,7 +201,7 @@ public function optimizeGroups() private function shouldBeInlined() { - if (count($this->items) >= 3) { + if (\count($this->items) >= 3) { return false; } @@ -212,7 +212,7 @@ private function shouldBeInlined() } foreach ($this->items as $item) { - if (is_array($item) && $item[0] === $this->prefix) { + if (\is_array($item) && $item[0] === $this->prefix) { return false; } } diff --git a/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php b/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php index 3770a9c24..67805205c 100644 --- a/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php +++ b/vendor/symfony/routing/Matcher/RedirectableUrlMatcher.php @@ -27,7 +27,7 @@ public function match($pathinfo) try { $parameters = parent::match($pathinfo); } catch (ResourceNotFoundException $e) { - if ('/' === substr($pathinfo, -1) || !in_array($this->context->getMethod(), array('HEAD', 'GET'))) { + if ('/' === substr($pathinfo, -1) || !\in_array($this->context->getMethod(), array('HEAD', 'GET'))) { throw $e; } diff --git a/vendor/symfony/routing/Matcher/RequestMatcherInterface.php b/vendor/symfony/routing/Matcher/RequestMatcherInterface.php index 1eef778a5..0c193ff2d 100644 --- a/vendor/symfony/routing/Matcher/RequestMatcherInterface.php +++ b/vendor/symfony/routing/Matcher/RequestMatcherInterface.php @@ -12,9 +12,9 @@ namespace Symfony\Component\Routing\Matcher; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\NoConfigurationException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Exception\MethodNotAllowedException; /** * RequestMatcherInterface is the interface that all request matcher classes must implement. diff --git a/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php b/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php index 9085be042..61cad8e69 100644 --- a/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php +++ b/vendor/symfony/routing/Matcher/TraceableUrlMatcher.php @@ -69,7 +69,7 @@ protected function matchCollection($pathinfo, RouteCollection $routes) $r = new Route($route->getPath(), $route->getDefaults(), array($n => $regex), $route->getOptions()); $cr = $r->compile(); - if (in_array($n, $cr->getVariables()) && !preg_match($cr->getRegex(), $pathinfo)) { + if (\in_array($n, $cr->getVariables()) && !preg_match($cr->getRegex(), $pathinfo)) { $this->addTrace(sprintf('Requirement for "%s" does not match (%s)', $n, $regex), self::ROUTE_ALMOST_MATCHES, $name, $route); continue 2; @@ -94,7 +94,7 @@ protected function matchCollection($pathinfo, RouteCollection $routes) $method = 'GET'; } - if (!in_array($method, $requiredMethods)) { + if (!\in_array($method, $requiredMethods)) { $this->allow = array_merge($this->allow, $requiredMethods); $this->addTrace(sprintf('Method "%s" does not match any of the required methods (%s)', $this->context->getMethod(), implode(', ', $requiredMethods)), self::ROUTE_ALMOST_MATCHES, $name, $route); diff --git a/vendor/symfony/routing/Matcher/UrlMatcher.php b/vendor/symfony/routing/Matcher/UrlMatcher.php index 445cfc4e8..69d73906f 100644 --- a/vendor/symfony/routing/Matcher/UrlMatcher.php +++ b/vendor/symfony/routing/Matcher/UrlMatcher.php @@ -11,15 +11,15 @@ namespace Symfony\Component\Routing\Matcher; +use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; +use Symfony\Component\ExpressionLanguage\ExpressionLanguage; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\NoConfigurationException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\Route; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\ExpressionLanguage\ExpressionLanguage; -use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; +use Symfony\Component\Routing\RouteCollection; /** * UrlMatcher matches URL based on a set of routes. @@ -80,7 +80,7 @@ public function match($pathinfo) throw new NoConfigurationException(); } - throw 0 < count($this->allow) + throw 0 < \count($this->allow) ? new MethodNotAllowedException(array_unique($this->allow)) : new ResourceNotFoundException(sprintf('No routes found for "%s".', $pathinfo)); } @@ -118,18 +118,39 @@ public function addExpressionLanguageProvider(ExpressionFunctionProviderInterfac */ protected function matchCollection($pathinfo, RouteCollection $routes) { + $supportsTrailingSlash = '/' !== $pathinfo && '' !== $pathinfo && $this instanceof RedirectableUrlMatcherInterface; + foreach ($routes as $name => $route) { $compiledRoute = $route->compile(); + $staticPrefix = $compiledRoute->getStaticPrefix(); // check the static prefix of the URL first. Only use the more expensive preg_match when it matches - if ('' !== $compiledRoute->getStaticPrefix() && 0 !== strpos($pathinfo, $compiledRoute->getStaticPrefix())) { + if ('' === $staticPrefix || 0 === strpos($pathinfo, $staticPrefix)) { + // no-op + } elseif (!$supportsTrailingSlash) { + continue; + } elseif ('/' === substr($staticPrefix, -1) && substr($staticPrefix, 0, -1) === $pathinfo) { + return; + } else { continue; } + $regex = $compiledRoute->getRegex(); - if (!preg_match($compiledRoute->getRegex(), $pathinfo, $matches)) { + if ($supportsTrailingSlash && $pos = strpos($regex, '/$')) { + $regex = substr($regex, 0, $pos).'/?$'.substr($regex, $pos + 2); + $hasTrailingSlash = true; + } else { + $hasTrailingSlash = false; + } + + if (!preg_match($regex, $pathinfo, $matches)) { continue; } + if ($hasTrailingSlash && '/' !== substr($pathinfo, -1)) { + return; + } + $hostMatches = array(); if ($compiledRoute->getHostRegex() && !preg_match($compiledRoute->getHostRegex(), $this->context->getHost(), $hostMatches)) { continue; @@ -148,7 +169,7 @@ protected function matchCollection($pathinfo, RouteCollection $routes) $method = 'GET'; } - if (!in_array($method, $requiredMethods)) { + if (!\in_array($method, $requiredMethods)) { if (self::REQUIREMENT_MATCH === $status[0]) { $this->allow = array_merge($this->allow, $requiredMethods); } @@ -215,7 +236,7 @@ protected function handleRouteRequirements($pathinfo, $name, Route $route) protected function mergeDefaults($params, $defaults) { foreach ($params as $key => $value) { - if (!is_int($key)) { + if (!\is_int($key)) { $defaults[$key] = $value; } } diff --git a/vendor/symfony/routing/Matcher/UrlMatcherInterface.php b/vendor/symfony/routing/Matcher/UrlMatcherInterface.php index 2c7c3135b..17f1f97b3 100644 --- a/vendor/symfony/routing/Matcher/UrlMatcherInterface.php +++ b/vendor/symfony/routing/Matcher/UrlMatcherInterface.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Routing\Matcher; +use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\NoConfigurationException; -use Symfony\Component\Routing\RequestContextAwareInterface; use Symfony\Component\Routing\Exception\ResourceNotFoundException; -use Symfony\Component\Routing\Exception\MethodNotAllowedException; +use Symfony\Component\Routing\RequestContextAwareInterface; /** * UrlMatcherInterface is the interface that all URL matcher classes must implement. diff --git a/vendor/symfony/routing/Route.php b/vendor/symfony/routing/Route.php index cd50ac827..46e3e5502 100644 --- a/vendor/symfony/routing/Route.php +++ b/vendor/symfony/routing/Route.php @@ -29,7 +29,7 @@ class Route implements \Serializable private $condition = ''; /** - * @var null|CompiledRoute + * @var CompiledRoute|null */ private $compiled; @@ -196,7 +196,7 @@ public function setSchemes($schemes) */ public function hasScheme($scheme) { - return in_array(strtolower($scheme), $this->schemes, true); + return \in_array(strtolower($scheme), $this->schemes, true); } /** @@ -537,7 +537,7 @@ public function compile() private function sanitizeRequirement($key, $regex) { - if (!is_string($regex)) { + if (!\is_string($regex)) { throw new \InvalidArgumentException(sprintf('Routing requirement for "%s" must be a string.', $key)); } diff --git a/vendor/symfony/routing/RouteCollection.php b/vendor/symfony/routing/RouteCollection.php index e22cbc5f2..c42229af2 100644 --- a/vendor/symfony/routing/RouteCollection.php +++ b/vendor/symfony/routing/RouteCollection.php @@ -63,7 +63,7 @@ public function getIterator() */ public function count() { - return count($this->routes); + return \count($this->routes); } /** diff --git a/vendor/symfony/routing/RouteCollectionBuilder.php b/vendor/symfony/routing/RouteCollectionBuilder.php index e8a9a165d..05dcc3627 100644 --- a/vendor/symfony/routing/RouteCollectionBuilder.php +++ b/vendor/symfony/routing/RouteCollectionBuilder.php @@ -46,7 +46,7 @@ public function __construct(LoaderInterface $loader = null) /** * Import an external routing resource and returns the RouteCollectionBuilder. * - * $routes->import('blog.yml', '/blog'); + * $routes->import('blog.yml', '/blog'); * * @param mixed $resource * @param string|null $prefix @@ -118,7 +118,7 @@ public function createBuilder() * @param string $prefix * @param RouteCollectionBuilder $builder */ - public function mount($prefix, RouteCollectionBuilder $builder) + public function mount($prefix, self $builder) { $builder->prefix = trim(trim($prefix), '/'); $this->routes[] = $builder; @@ -251,8 +251,6 @@ public function setMethods($methods) /** * Adds a resource for this collection. * - * @param ResourceInterface $resource - * * @return $this */ private function addResource(ResourceInterface $resource) @@ -362,7 +360,7 @@ private function load($resource, $type = null) if ($this->loader->supports($resource, $type)) { $collections = $this->loader->load($resource, $type); - return is_array($collections) ? $collections : array($collections); + return \is_array($collections) ? $collections : array($collections); } if (null === $resolver = $this->loader->getResolver()) { @@ -375,6 +373,6 @@ private function load($resource, $type = null) $collections = $loader->load($resource, $type); - return is_array($collections) ? $collections : array($collections); + return \is_array($collections) ? $collections : array($collections); } } diff --git a/vendor/symfony/routing/RouteCompiler.php b/vendor/symfony/routing/RouteCompiler.php index dc4e4f807..2562c185b 100644 --- a/vendor/symfony/routing/RouteCompiler.php +++ b/vendor/symfony/routing/RouteCompiler.php @@ -117,9 +117,9 @@ private static function compilePattern(Route $route, $pattern, $isHost) $varName = substr($match[0][0], 1, -1); // get all static text preceding the current variable $precedingText = substr($pattern, $pos, $match[0][1] - $pos); - $pos = $match[0][1] + strlen($match[0][0]); + $pos = $match[0][1] + \strlen($match[0][0]); - if (!strlen($precedingText)) { + if (!\strlen($precedingText)) { $precedingChar = ''; } elseif ($useUtf8) { preg_match('/.$/u', $precedingText, $precedingChar); @@ -134,17 +134,17 @@ private static function compilePattern(Route $route, $pattern, $isHost) if (preg_match('/^\d/', $varName)) { throw new \DomainException(sprintf('Variable name "%s" cannot start with a digit in route pattern "%s". Please use a different name.', $varName, $pattern)); } - if (in_array($varName, $variables)) { + if (\in_array($varName, $variables)) { throw new \LogicException(sprintf('Route pattern "%s" cannot reference variable name "%s" more than once.', $pattern, $varName)); } - if (strlen($varName) > self::VARIABLE_MAXIMUM_LENGTH) { + if (\strlen($varName) > self::VARIABLE_MAXIMUM_LENGTH) { throw new \DomainException(sprintf('Variable name "%s" cannot be longer than %s characters in route pattern "%s". Please use a shorter name.', $varName, self::VARIABLE_MAXIMUM_LENGTH, $pattern)); } if ($isSeparator && $precedingText !== $precedingChar) { - $tokens[] = array('text', substr($precedingText, 0, -strlen($precedingChar))); - } elseif (!$isSeparator && strlen($precedingText) > 0) { + $tokens[] = array('text', substr($precedingText, 0, -\strlen($precedingChar))); + } elseif (!$isSeparator && \strlen($precedingText) > 0) { $tokens[] = array('text', $precedingText); } @@ -188,14 +188,14 @@ private static function compilePattern(Route $route, $pattern, $isHost) $variables[] = $varName; } - if ($pos < strlen($pattern)) { + if ($pos < \strlen($pattern)) { $tokens[] = array('text', substr($pattern, $pos)); } // find the first optional token $firstOptional = PHP_INT_MAX; if (!$isHost) { - for ($i = count($tokens) - 1; $i >= 0; --$i) { + for ($i = \count($tokens) - 1; $i >= 0; --$i) { $token = $tokens[$i]; if ('variable' === $token[0] && $route->hasDefault($token[3])) { $firstOptional = $i; @@ -207,7 +207,7 @@ private static function compilePattern(Route $route, $pattern, $isHost) // compute the matching regexp $regexp = ''; - for ($i = 0, $nbToken = count($tokens); $i < $nbToken; ++$i) { + for ($i = 0, $nbToken = \count($tokens); $i < $nbToken; ++$i) { $regexp .= self::computeRegexp($tokens, $i, $firstOptional); } $regexp = self::REGEX_DELIMITER.'^'.$regexp.'$'.self::REGEX_DELIMITER.'sD'.($isHost ? 'i' : ''); @@ -215,7 +215,7 @@ private static function compilePattern(Route $route, $pattern, $isHost) // enable Utf8 matching if really required if ($needsUtf8) { $regexp .= 'u'; - for ($i = 0, $nbToken = count($tokens); $i < $nbToken; ++$i) { + for ($i = 0, $nbToken = \count($tokens); $i < $nbToken; ++$i) { if ('variable' === $tokens[$i][0]) { $tokens[$i][] = true; } @@ -302,7 +302,7 @@ private static function computeRegexp(array $tokens, $index, $firstOptional) // "?:" means it is non-capturing, i.e. the portion of the subject string that // matched the optional subpattern is not passed back. $regexp = "(?:$regexp"; - $nbTokens = count($tokens); + $nbTokens = \count($tokens); if ($nbTokens - 1 == $index) { // Close the optional subpatterns $regexp .= str_repeat(')?', $nbTokens - $firstOptional - (0 === $firstOptional ? 1 : 0)); diff --git a/vendor/symfony/routing/Router.php b/vendor/symfony/routing/Router.php index ed56332ec..3f4838ea0 100644 --- a/vendor/symfony/routing/Router.php +++ b/vendor/symfony/routing/Router.php @@ -11,19 +11,19 @@ namespace Symfony\Component\Routing; -use Symfony\Component\Config\Loader\LoaderInterface; -use Symfony\Component\Config\ConfigCacheInterface; -use Symfony\Component\Config\ConfigCacheFactoryInterface; -use Symfony\Component\Config\ConfigCacheFactory; use Psr\Log\LoggerInterface; +use Symfony\Component\Config\ConfigCacheFactory; +use Symfony\Component\Config\ConfigCacheFactoryInterface; +use Symfony\Component\Config\ConfigCacheInterface; +use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Generator\ConfigurableRequirementsInterface; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\Generator\Dumper\GeneratorDumperInterface; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Symfony\Component\Routing\Matcher\Dumper\MatcherDumperInterface; use Symfony\Component\Routing\Matcher\RequestMatcherInterface; use Symfony\Component\Routing\Matcher\UrlMatcherInterface; -use Symfony\Component\Routing\Matcher\Dumper\MatcherDumperInterface; -use Symfony\Component\HttpFoundation\Request; -use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface; /** * The Router class is an example of the integration of all pieces of the @@ -375,7 +375,7 @@ protected function getMatcherDumperInstance() * Provides the ConfigCache factory implementation, falling back to a * default implementation if necessary. * - * @return ConfigCacheFactoryInterface $configCacheFactory + * @return ConfigCacheFactoryInterface */ private function getConfigCacheFactory() { diff --git a/vendor/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php b/vendor/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php index 9fd5754a1..b7a02b60b 100644 --- a/vendor/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php +++ b/vendor/symfony/routing/Tests/Fixtures/CustomXmlFileLoader.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Routing\Tests\Fixtures; -use Symfony\Component\Routing\Loader\XmlFileLoader; use Symfony\Component\Config\Util\XmlUtils; +use Symfony\Component\Routing\Loader\XmlFileLoader; /** * XmlFileLoader with schema validation turned off. diff --git a/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php b/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php index 15937bcf0..08b67a076 100644 --- a/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php +++ b/vendor/symfony/routing/Tests/Fixtures/RedirectableUrlMatcher.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Routing\Tests\Fixtures; -use Symfony\Component\Routing\Matcher\UrlMatcher; use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface; +use Symfony\Component\Routing\Matcher\UrlMatcher; /** * @author Fabien Potencier diff --git a/vendor/symfony/routing/Tests/Fixtures/validpattern.php b/vendor/symfony/routing/Tests/Fixtures/validpattern.php index edc16d8c2..52ddfde02 100644 --- a/vendor/symfony/routing/Tests/Fixtures/validpattern.php +++ b/vendor/symfony/routing/Tests/Fixtures/validpattern.php @@ -1,7 +1,7 @@ add('blog_show', new Route( diff --git a/vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php b/vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php index f84802b35..32dc83e83 100644 --- a/vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php +++ b/vendor/symfony/routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php @@ -12,11 +12,11 @@ namespace Symfony\Component\Routing\Tests\Generator\Dumper; use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\Generator\UrlGeneratorInterface; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; use Symfony\Component\Routing\Generator\Dumper\PhpGeneratorDumper; +use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\Route; +use Symfony\Component\Routing\RouteCollection; class PhpGeneratorDumperTest extends TestCase { @@ -46,8 +46,8 @@ protected function setUp() $this->routeCollection = new RouteCollection(); $this->generatorDumper = new PhpGeneratorDumper($this->routeCollection); - $this->testTmpFilepath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.php'; - $this->largeTestTmpFilepath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.large.php'; + $this->testTmpFilepath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.php'; + $this->largeTestTmpFilepath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_generator.'.$this->getName().'.large.php'; @unlink($this->testTmpFilepath); @unlink($this->largeTestTmpFilepath); } @@ -86,7 +86,7 @@ public function testDumpWithRoutes() public function testDumpWithTooManyRoutes() { - if (defined('HHVM_VERSION_ID')) { + if (\defined('HHVM_VERSION_ID')) { $this->markTestSkipped('HHVM consumes too much memory on this test.'); } diff --git a/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php b/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php index 68add771b..d4bf18cca 100644 --- a/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php +++ b/vendor/symfony/routing/Tests/Generator/UrlGeneratorTest.php @@ -12,11 +12,11 @@ namespace Symfony\Component\Routing\Tests\Generator; use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; use Symfony\Component\Routing\Generator\UrlGenerator; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\Route; +use Symfony\Component\Routing\RouteCollection; class UrlGeneratorTest extends TestCase { diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php index 32e401294..a0230ada8 100644 --- a/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/AnnotationClassLoaderTest.php @@ -127,17 +127,17 @@ public function testLoad($className, $routeData = array(), $methodArgs = array() $this->assertSame($routeData['path'], $route->getPath(), '->load preserves path annotation'); $this->assertCount( - count($routeData['requirements']), + \count($routeData['requirements']), array_intersect_assoc($routeData['requirements'], $route->getRequirements()), '->load preserves requirements annotation' ); $this->assertCount( - count($routeData['options']), + \count($routeData['options']), array_intersect_assoc($routeData['options'], $route->getOptions()), '->load preserves options annotation' ); $this->assertCount( - count($routeData['defaults']), + \count($routeData['defaults']), $route->getDefaults(), '->load preserves defaults annotation' ); @@ -181,7 +181,7 @@ public function testClassRouteLoad() $this->assertEquals(array_merge($classRouteData['methods'], $methodRouteData['methods']), $route->getMethods(), '->load merges class and method route methods'); } - public function testInvokableClassRouteLoad() + public function testInvokableClassRouteLoadWithMethodAnnotation() { $classRouteData = array( 'name' => 'route1', @@ -209,6 +209,41 @@ public function testInvokableClassRouteLoad() $this->assertEquals($classRouteData['methods'], $route->getMethods(), '->load preserves class route methods'); } + public function testInvokableClassRouteLoadWithClassAnnotation() + { + $classRouteData = array( + 'name' => 'route1', + 'path' => '/', + 'schemes' => array('https'), + 'methods' => array('GET'), + ); + + $this->reader + ->expects($this->exactly(1)) + ->method('getClassAnnotation') + ->will($this->returnValue($this->getAnnotatedRoute($classRouteData))) + ; + + $this->reader + ->expects($this->exactly(1)) + ->method('getClassAnnotations') + ->will($this->returnValue(array($this->getAnnotatedRoute($classRouteData)))) + ; + + $this->reader + ->expects($this->once()) + ->method('getMethodAnnotations') + ->will($this->returnValue(array())) + ; + + $routeCollection = $this->loader->load('Symfony\Component\Routing\Tests\Fixtures\AnnotatedClasses\BazClass'); + $route = $routeCollection->get($classRouteData['name']); + + $this->assertSame($classRouteData['path'], $route->getPath(), '->load preserves class route path'); + $this->assertEquals($classRouteData['schemes'], $route->getSchemes(), '->load preserves class route schemes'); + $this->assertEquals($classRouteData['methods'], $route->getMethods(), '->load preserves class route methods'); + } + public function testInvokableClassMultipleRouteLoad() { $classRouteData1 = array( diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php index 8a6668e0c..901b858d9 100644 --- a/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/AnnotationDirectoryLoaderTest.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Routing\Tests\Loader; -use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader; use Symfony\Component\Config\FileLocator; +use Symfony\Component\Routing\Loader\AnnotationDirectoryLoader; class AnnotationDirectoryLoaderTest extends AbstractAnnotationLoaderTest { @@ -100,10 +100,10 @@ public function testLoadFileIfLocatedResourceIsFile() private function expectAnnotationsToBeReadFrom(array $classes) { - $this->reader->expects($this->exactly(count($classes))) + $this->reader->expects($this->exactly(\count($classes))) ->method('getClassAnnotation') ->with($this->callback(function (\ReflectionClass $class) use ($classes) { - return in_array($class->getName(), $classes); + return \in_array($class->getName(), $classes); })); } } diff --git a/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php index 7f1d57655..e0a95c8c0 100644 --- a/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/AnnotationFileLoaderTest.php @@ -11,9 +11,9 @@ namespace Symfony\Component\Routing\Tests\Loader; -use Symfony\Component\Routing\Loader\AnnotationFileLoader; use Symfony\Component\Config\FileLocator; use Symfony\Component\Routing\Annotation\Route; +use Symfony\Component\Routing\Loader\AnnotationFileLoader; class AnnotationFileLoaderTest extends AbstractAnnotationLoaderTest { diff --git a/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php b/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php index fc29d371e..45968551b 100644 --- a/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/DirectoryLoaderTest.php @@ -11,11 +11,11 @@ namespace Symfony\Component\Routing\Tests\Loader; +use Symfony\Component\Config\FileLocator; +use Symfony\Component\Config\Loader\LoaderResolver; +use Symfony\Component\Routing\Loader\AnnotationFileLoader; use Symfony\Component\Routing\Loader\DirectoryLoader; use Symfony\Component\Routing\Loader\YamlFileLoader; -use Symfony\Component\Routing\Loader\AnnotationFileLoader; -use Symfony\Component\Config\Loader\LoaderResolver; -use Symfony\Component\Config\FileLocator; use Symfony\Component\Routing\RouteCollection; class DirectoryLoaderTest extends AbstractAnnotationLoaderTest diff --git a/vendor/symfony/routing/Tests/Loader/GlobFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/GlobFileLoaderTest.php index 08d806a8a..e4e12b881 100644 --- a/vendor/symfony/routing/Tests/Loader/GlobFileLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/GlobFileLoaderTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Routing\Tests\Loader; use PHPUnit\Framework\TestCase; -use Symfony\Component\Config\Resource\GlobResource; use Symfony\Component\Config\FileLocator; +use Symfony\Component\Config\Resource\GlobResource; use Symfony\Component\Routing\Loader\GlobFileLoader; use Symfony\Component\Routing\RouteCollection; diff --git a/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php index 822bddf1f..a89c58443 100644 --- a/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php +++ b/vendor/symfony/routing/Tests/Loader/YamlFileLoaderTest.php @@ -13,8 +13,8 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Config\FileLocator; -use Symfony\Component\Routing\Loader\YamlFileLoader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Routing\Loader\YamlFileLoader; class YamlFileLoaderTest extends TestCase { diff --git a/vendor/symfony/routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php index cfbb524d3..1785c3ad2 100644 --- a/vendor/symfony/routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php +++ b/vendor/symfony/routing/Tests/Matcher/DumpedRedirectableUrlMatcherTest.php @@ -14,8 +14,8 @@ use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper; use Symfony\Component\Routing\Matcher\RedirectableUrlMatcherInterface; use Symfony\Component\Routing\Matcher\UrlMatcher; -use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\RouteCollection; class DumpedRedirectableUrlMatcherTest extends RedirectableUrlMatcherTest { diff --git a/vendor/symfony/routing/Tests/Matcher/DumpedUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/DumpedUrlMatcherTest.php index 880b2b13b..b00dfdf5f 100644 --- a/vendor/symfony/routing/Tests/Matcher/DumpedUrlMatcherTest.php +++ b/vendor/symfony/routing/Tests/Matcher/DumpedUrlMatcherTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Routing\Tests\Matcher; use Symfony\Component\Routing\Matcher\Dumper\PhpMatcherDumper; -use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\RequestContext; +use Symfony\Component\Routing\RouteCollection; class DumpedUrlMatcherTest extends UrlMatcherTest { diff --git a/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php b/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php index f29a6d6a3..68721bd63 100644 --- a/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php +++ b/vendor/symfony/routing/Tests/Matcher/Dumper/PhpMatcherDumperTest.php @@ -36,7 +36,7 @@ protected function setUp() parent::setUp(); $this->matcherClass = uniqid('ProjectUrlMatcher'); - $this->dumpPath = sys_get_temp_dir().DIRECTORY_SEPARATOR.'php_matcher.'.$this->matcherClass.'.php'; + $this->dumpPath = sys_get_temp_dir().\DIRECTORY_SEPARATOR.'php_matcher.'.$this->matcherClass.'.php'; } protected function tearDown() @@ -430,9 +430,6 @@ public function getRouteCollections() ); } - /** - * @param $dumper - */ private function generateDumpedMatcher(RouteCollection $collection, $redirectableStub = false) { $options = array('class' => $this->matcherClass); diff --git a/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php index 7984391e1..a7aea0ec0 100644 --- a/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php +++ b/vendor/symfony/routing/Tests/Matcher/RedirectableUrlMatcherTest.php @@ -11,9 +11,9 @@ namespace Symfony\Component\Routing\Tests\Matcher; +use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; class RedirectableUrlMatcherTest extends UrlMatcherTest { @@ -117,6 +117,17 @@ public function testSchemeRequirement() $this->assertSame(array('_route' => 'foo'), $matcher->match('/foo')); } + public function testFallbackPage() + { + $coll = new RouteCollection(); + $coll->add('foo', new Route('/foo/')); + $coll->add('bar', new Route('/{name}')); + + $matcher = $this->getUrlMatcher($coll); + $matcher->expects($this->once())->method('redirect')->with('/foo/')->will($this->returnValue(array('_route' => 'foo'))); + $this->assertSame(array('_route' => 'foo'), $matcher->match('/foo')); + } + protected function getUrlMatcher(RouteCollection $routes, RequestContext $context = null) { return $this->getMockForAbstractClass('Symfony\Component\Routing\Matcher\RedirectableUrlMatcher', array($routes, $context ?: new RequestContext())); diff --git a/vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php index 9f0529e2d..1f026a6ec 100644 --- a/vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php +++ b/vendor/symfony/routing/Tests/Matcher/TraceableUrlMatcherTest.php @@ -13,10 +13,10 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\Routing\Matcher\TraceableUrlMatcher; +use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; -use Symfony\Component\Routing\Matcher\TraceableUrlMatcher; class TraceableUrlMatcherTest extends TestCase { diff --git a/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php b/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php index e8d31e222..0d4b44b09 100644 --- a/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php +++ b/vendor/symfony/routing/Tests/Matcher/UrlMatcherTest.php @@ -15,9 +15,9 @@ use Symfony\Component\Routing\Exception\MethodNotAllowedException; use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Matcher\UrlMatcher; +use Symfony\Component\Routing\RequestContext; use Symfony\Component\Routing\Route; use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\RequestContext; class UrlMatcherTest extends TestCase { diff --git a/vendor/symfony/routing/Tests/RouteCollectionTest.php b/vendor/symfony/routing/Tests/RouteCollectionTest.php index 83457ff14..78eb5ba53 100644 --- a/vendor/symfony/routing/Tests/RouteCollectionTest.php +++ b/vendor/symfony/routing/Tests/RouteCollectionTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\Routing\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\Routing\RouteCollection; -use Symfony\Component\Routing\Route; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Routing\Route; +use Symfony\Component\Routing\RouteCollection; class RouteCollectionTest extends TestCase { diff --git a/vendor/symfony/routing/Tests/RouterTest.php b/vendor/symfony/routing/Tests/RouterTest.php index 3e3d43f82..e01bd9c61 100644 --- a/vendor/symfony/routing/Tests/RouterTest.php +++ b/vendor/symfony/routing/Tests/RouterTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\Routing\Tests; use PHPUnit\Framework\TestCase; +use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\RouteCollection; use Symfony\Component\Routing\Router; -use Symfony\Component\HttpFoundation\Request; class RouterTest extends TestCase { diff --git a/vendor/symfony/routing/composer.json b/vendor/symfony/routing/composer.json index 4d820cc21..266d52b7d 100644 --- a/vendor/symfony/routing/composer.json +++ b/vendor/symfony/routing/composer.json @@ -25,7 +25,6 @@ "symfony/expression-language": "~2.8|~3.0|~4.0", "symfony/dependency-injection": "~3.3|~4.0", "doctrine/annotations": "~1.0", - "doctrine/common": "~2.2", "psr/log": "~1.0" }, "conflict": { diff --git a/vendor/symfony/routing/phpunit.xml.dist b/vendor/symfony/routing/phpunit.xml.dist index bcc095952..df742eab0 100644 --- a/vendor/symfony/routing/phpunit.xml.dist +++ b/vendor/symfony/routing/phpunit.xml.dist @@ -1,7 +1,7 @@ array( - * 'all' => array(...), - * 'new' => array(...), - * 'obsolete' => array(...) - * ), - * 'domain 2' => array( - * 'all' => array(...), - * 'new' => array(...), - * 'obsolete' => array(...) - * ), - * ... - * ) - * ``` + * + * array( + * 'domain 1' => array( + * 'all' => array(...), + * 'new' => array(...), + * 'obsolete' => array(...) + * ), + * 'domain 2' => array( + * 'all' => array(...), + * 'new' => array(...), + * 'obsolete' => array(...) + * ), + * ... + * ) * * @var array The array that stores 'all', 'new' and 'obsolete' messages */ @@ -91,7 +90,7 @@ public function getDomains() */ public function getMessages($domain) { - if (!in_array($domain, $this->getDomains())) { + if (!\in_array($domain, $this->getDomains())) { throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain)); } @@ -107,7 +106,7 @@ public function getMessages($domain) */ public function getNewMessages($domain) { - if (!in_array($domain, $this->getDomains())) { + if (!\in_array($domain, $this->getDomains())) { throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain)); } @@ -123,7 +122,7 @@ public function getNewMessages($domain) */ public function getObsoleteMessages($domain) { - if (!in_array($domain, $this->getDomains())) { + if (!\in_array($domain, $this->getDomains())) { throw new InvalidArgumentException(sprintf('Invalid domain: %s.', $domain)); } diff --git a/vendor/symfony/translation/Command/XliffLintCommand.php b/vendor/symfony/translation/Command/XliffLintCommand.php index fead5edcb..885d20e4b 100644 --- a/vendor/symfony/translation/Command/XliffLintCommand.php +++ b/vendor/symfony/translation/Command/XliffLintCommand.php @@ -12,6 +12,7 @@ namespace Symfony\Component\Translation\Command; use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Exception\RuntimeException; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; @@ -81,14 +82,14 @@ protected function execute(InputInterface $input, OutputInterface $output) if (!$filename) { if (!$stdin = $this->getStdin()) { - throw new \RuntimeException('Please provide a filename or pipe file content to STDIN.'); + throw new RuntimeException('Please provide a filename or pipe file content to STDIN.'); } return $this->display($io, array($this->validate($stdin))); } if (!$this->isReadable($filename)) { - throw new \RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); + throw new RuntimeException(sprintf('File or directory "%s" is not readable.', $filename)); } $filesInfo = array(); @@ -136,13 +137,13 @@ private function display(SymfonyStyle $io, array $files) case 'json': return $this->displayJson($io, $files); default: - throw new \InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format)); + throw new InvalidArgumentException(sprintf('The format "%s" is not supported.', $this->format)); } } private function displayTxt(SymfonyStyle $io, array $filesInfo) { - $countFiles = count($filesInfo); + $countFiles = \count($filesInfo); $erroredFiles = 0; foreach ($filesInfo as $info) { @@ -192,7 +193,7 @@ private function getFiles($fileOrDirectory) } foreach ($this->getDirectoryIterator($fileOrDirectory) as $file) { - if (!in_array($file->getExtension(), array('xlf', 'xliff'))) { + if (!\in_array($file->getExtension(), array('xlf', 'xliff'))) { continue; } @@ -224,7 +225,7 @@ private function getDirectoryIterator($directory) }; if (null !== $this->directoryIteratorProvider) { - return call_user_func($this->directoryIteratorProvider, $directory, $default); + return \call_user_func($this->directoryIteratorProvider, $directory, $default); } return $default($directory); @@ -237,7 +238,7 @@ private function isReadable($fileOrDirectory) }; if (null !== $this->isReadableProvider) { - return call_user_func($this->isReadableProvider, $fileOrDirectory, $default); + return \call_user_func($this->isReadableProvider, $fileOrDirectory, $default); } return $default($fileOrDirectory); diff --git a/vendor/symfony/translation/DataCollector/TranslationDataCollector.php b/vendor/symfony/translation/DataCollector/TranslationDataCollector.php index 5d97a6700..edd712dd1 100644 --- a/vendor/symfony/translation/DataCollector/TranslationDataCollector.php +++ b/vendor/symfony/translation/DataCollector/TranslationDataCollector.php @@ -99,7 +99,7 @@ public function getLocale() public function getFallbackLocales() { - return (isset($this->data['fallback_locales']) && count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : array(); + return (isset($this->data['fallback_locales']) && \count($this->data['fallback_locales']) > 0) ? $this->data['fallback_locales'] : array(); } /** @@ -158,7 +158,7 @@ private function sanitizeString($string, $length = 80) if (mb_strlen($string, $encoding) > $length) { return mb_substr($string, 0, $length - 3, $encoding).'...'; } - } elseif (strlen($string) > $length) { + } elseif (\strlen($string) > $length) { return substr($string, 0, $length - 3).'...'; } diff --git a/vendor/symfony/translation/DataCollectorTranslator.php b/vendor/symfony/translation/DataCollectorTranslator.php index 715c390f5..00147bcf3 100644 --- a/vendor/symfony/translation/DataCollectorTranslator.php +++ b/vendor/symfony/translation/DataCollectorTranslator.php @@ -35,7 +35,7 @@ class DataCollectorTranslator implements TranslatorInterface, TranslatorBagInter public function __construct(TranslatorInterface $translator) { if (!$translator instanceof TranslatorBagInterface) { - throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', get_class($translator))); + throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', \get_class($translator))); } $this->translator = $translator; @@ -90,7 +90,7 @@ public function getCatalogue($locale = null) /** * Gets the fallback locales. * - * @return array $locales The fallback locales + * @return array The fallback locales */ public function getFallbackLocales() { @@ -106,7 +106,7 @@ public function getFallbackLocales() */ public function __call($method, $args) { - return call_user_func_array(array($this->translator, $method), $args); + return \call_user_func_array(array($this->translator, $method), $args); } /** diff --git a/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php b/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php index 1ca79cf00..92bac5be2 100644 --- a/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php +++ b/vendor/symfony/translation/DependencyInjection/TranslationDumperPass.php @@ -11,9 +11,9 @@ namespace Symfony\Component\Translation\DependencyInjection; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; /** * Adds tagged translation.formatter services to translation writer. diff --git a/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php b/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php index 061051879..4014d499c 100644 --- a/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php +++ b/vendor/symfony/translation/DependencyInjection/TranslationExtractorPass.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Translation\DependencyInjection; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Exception\RuntimeException; +use Symfony\Component\DependencyInjection\Reference; /** * Adds tagged translation.extractor services to translation extractor. diff --git a/vendor/symfony/translation/DependencyInjection/TranslatorPass.php b/vendor/symfony/translation/DependencyInjection/TranslatorPass.php index db2a2a1ec..2d50715ff 100644 --- a/vendor/symfony/translation/DependencyInjection/TranslatorPass.php +++ b/vendor/symfony/translation/DependencyInjection/TranslatorPass.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Translation\DependencyInjection; -use Symfony\Component\DependencyInjection\Reference; -use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\ServiceLocatorTagPass; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; class TranslatorPass implements CompilerPassInterface { @@ -26,8 +26,8 @@ class TranslatorPass implements CompilerPassInterface public function __construct($translatorServiceId = 'translator.default', $readerServiceId = 'translation.loader', $loaderTag = 'translation.loader', $debugCommandServiceId = 'console.command.translation_debug', $updateCommandServiceId = 'console.command.translation_update') { - if ('translation.loader' === $readerServiceId && 2 > func_num_args()) { - @trigger_error('The default value for $readerServiceId will change in 4.0 to "translation.reader".', E_USER_DEPRECATED); + if ('translation.loader' === $readerServiceId && 2 > \func_num_args()) { + @trigger_error(sprintf('The default value for $readerServiceId in "%s()" will change in 4.0 to "translation.reader".', __METHOD__), E_USER_DEPRECATED); } $this->translatorServiceId = $translatorServiceId; diff --git a/vendor/symfony/translation/Dumper/CsvFileDumper.php b/vendor/symfony/translation/Dumper/CsvFileDumper.php index ebfa831db..0880528dc 100644 --- a/vendor/symfony/translation/Dumper/CsvFileDumper.php +++ b/vendor/symfony/translation/Dumper/CsvFileDumper.php @@ -28,7 +28,7 @@ class CsvFileDumper extends FileDumper */ public function formatCatalogue(MessageCatalogue $messages, $domain, array $options = array()) { - $handle = fopen('php://memory', 'rb+'); + $handle = fopen('php://memory', 'r+b'); foreach ($messages->all($domain) as $source => $target) { fputcsv($handle, array($source, $target), $this->delimiter, $this->enclosure); diff --git a/vendor/symfony/translation/Dumper/FileDumper.php b/vendor/symfony/translation/Dumper/FileDumper.php index 7296d8ccd..f81f79c3c 100644 --- a/vendor/symfony/translation/Dumper/FileDumper.php +++ b/vendor/symfony/translation/Dumper/FileDumper.php @@ -11,9 +11,9 @@ namespace Symfony\Component\Translation\Dumper; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Exception\InvalidArgumentException; use Symfony\Component\Translation\Exception\RuntimeException; +use Symfony\Component\Translation\MessageCatalogue; /** * FileDumper is an implementation of DumperInterface that dump a message catalogue to file(s). @@ -53,7 +53,7 @@ public function setRelativePathTemplate($relativePathTemplate) /** * Sets backup flag. * - * @param bool + * @param bool $backup */ public function setBackup($backup) { @@ -79,7 +79,7 @@ public function dump(MessageCatalogue $messages, $options = array()) copy($fullpath, $fullpath.'~'); } } else { - $directory = dirname($fullpath); + $directory = \dirname($fullpath); if (!file_exists($directory) && !@mkdir($directory, 0777, true)) { throw new RuntimeException(sprintf('Unable to create directory "%s".', $directory)); } diff --git a/vendor/symfony/translation/Dumper/IcuResFileDumper.php b/vendor/symfony/translation/Dumper/IcuResFileDumper.php index 42f159501..efa9d7fee 100644 --- a/vendor/symfony/translation/Dumper/IcuResFileDumper.php +++ b/vendor/symfony/translation/Dumper/IcuResFileDumper.php @@ -33,7 +33,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti $data = $indexes = $resources = ''; foreach ($messages->all($domain) as $source => $target) { - $indexes .= pack('v', strlen($data) + 28); + $indexes .= pack('v', \strlen($data) + 28); $data .= $source."\0"; } @@ -44,7 +44,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti foreach ($messages->all($domain) as $source => $target) { $resources .= pack('V', $this->getPosition($data)); - $data .= pack('V', strlen($target)) + $data .= pack('V', \strlen($target)) .mb_convert_encoding($target."\0", 'UTF-16LE', 'UTF-8') .$this->writePadding($data) ; @@ -52,7 +52,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti $resOffset = $this->getPosition($data); - $data .= pack('v', count($messages->all($domain))) + $data .= pack('v', \count($messages->all($domain))) .$indexes .$this->writePadding($data) .$resources @@ -66,7 +66,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti $keyTop, // Index keys top $bundleTop, // Index resources top $bundleTop, // Index bundle top - count($messages->all($domain)), // Index max table length + \count($messages->all($domain)), // Index max table length 0 // Index attributes ); @@ -84,7 +84,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti private function writePadding($data) { - $padding = strlen($data) % 4; + $padding = \strlen($data) % 4; if ($padding) { return str_repeat("\xAA", 4 - $padding); @@ -93,7 +93,7 @@ private function writePadding($data) private function getPosition($data) { - return (strlen($data) + 28) / 4; + return (\strlen($data) + 28) / 4; } /** diff --git a/vendor/symfony/translation/Dumper/JsonFileDumper.php b/vendor/symfony/translation/Dumper/JsonFileDumper.php index 08b538e1f..11fe13d0e 100644 --- a/vendor/symfony/translation/Dumper/JsonFileDumper.php +++ b/vendor/symfony/translation/Dumper/JsonFileDumper.php @@ -28,7 +28,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti if (isset($options['json_encoding'])) { $flags = $options['json_encoding']; } else { - $flags = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0; + $flags = \defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : 0; } return json_encode($messages->all($domain), $flags); diff --git a/vendor/symfony/translation/Dumper/MoFileDumper.php b/vendor/symfony/translation/Dumper/MoFileDumper.php index 00a33d253..32ed0ac26 100644 --- a/vendor/symfony/translation/Dumper/MoFileDumper.php +++ b/vendor/symfony/translation/Dumper/MoFileDumper.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Translation\Dumper; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Loader\MoFileLoader; +use Symfony\Component\Translation\MessageCatalogue; /** * MoFileDumper generates a gettext formatted string representation of a message catalogue. @@ -47,7 +47,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti 'offsetHashes' => MoFileLoader::MO_HEADER_SIZE + (16 * $size), ); - $sourcesSize = strlen($sources); + $sourcesSize = \strlen($sources); $sourcesStart = $header['offsetHashes'] + 1; foreach ($offsets as $offset) { @@ -57,7 +57,7 @@ public function formatCatalogue(MessageCatalogue $messages, $domain, array $opti .$this->writeLong($offset[2] + $sourcesStart + $sourcesSize); } - $output = implode(array_map(array($this, 'writeLong'), $header)) + $output = implode('', array_map(array($this, 'writeLong'), $header)) .$sourceOffsets .$targetOffsets .$sources diff --git a/vendor/symfony/translation/Dumper/XliffFileDumper.php b/vendor/symfony/translation/Dumper/XliffFileDumper.php index d7e5ecc78..e714463c9 100644 --- a/vendor/symfony/translation/Dumper/XliffFileDumper.php +++ b/vendor/symfony/translation/Dumper/XliffFileDumper.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Translation\Dumper; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Exception\InvalidArgumentException; +use Symfony\Component\Translation\MessageCatalogue; /** * XliffFileDumper generates xliff files from a message catalogue. @@ -195,6 +195,6 @@ private function dumpXliff2($defaultLocale, MessageCatalogue $messages, $domain, */ private function hasMetadataArrayInfo($key, $metadata = null) { - return null !== $metadata && array_key_exists($key, $metadata) && ($metadata[$key] instanceof \Traversable || is_array($metadata[$key])); + return null !== $metadata && array_key_exists($key, $metadata) && ($metadata[$key] instanceof \Traversable || \is_array($metadata[$key])); } } diff --git a/vendor/symfony/translation/Dumper/YamlFileDumper.php b/vendor/symfony/translation/Dumper/YamlFileDumper.php index ecf00fa64..aab6ad9b2 100644 --- a/vendor/symfony/translation/Dumper/YamlFileDumper.php +++ b/vendor/symfony/translation/Dumper/YamlFileDumper.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Translation\Dumper; +use Symfony\Component\Translation\Exception\LogicException; use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Util\ArrayConverter; use Symfony\Component\Yaml\Yaml; -use Symfony\Component\Translation\Exception\LogicException; /** * YamlFileDumper generates yaml files from a message catalogue. diff --git a/vendor/symfony/translation/Extractor/AbstractFileExtractor.php b/vendor/symfony/translation/Extractor/AbstractFileExtractor.php index b9c524e82..184102236 100644 --- a/vendor/symfony/translation/Extractor/AbstractFileExtractor.php +++ b/vendor/symfony/translation/Extractor/AbstractFileExtractor.php @@ -27,7 +27,7 @@ abstract class AbstractFileExtractor */ protected function extractFiles($resource) { - if (is_array($resource) || $resource instanceof \Traversable) { + if (\is_array($resource) || $resource instanceof \Traversable) { $files = array(); foreach ($resource as $file) { if ($this->canBeExtracted($file)) { diff --git a/vendor/symfony/translation/Extractor/PhpExtractor.php b/vendor/symfony/translation/Extractor/PhpExtractor.php index ab641ba96..ce6262123 100644 --- a/vendor/symfony/translation/Extractor/PhpExtractor.php +++ b/vendor/symfony/translation/Extractor/PhpExtractor.php @@ -210,7 +210,7 @@ protected function parseTokens($tokens, MessageCatalogue $catalog) } elseif (self::MESSAGE_TOKEN === $item) { $message = $this->getValue($tokenIterator); - if (count($sequence) === ($sequenceKey + 1)) { + if (\count($sequence) === ($sequenceKey + 1)) { break; } } elseif (self::METHOD_ARGUMENTS_TOKEN === $item) { diff --git a/vendor/symfony/translation/Extractor/PhpStringTokenParser.php b/vendor/symfony/translation/Extractor/PhpStringTokenParser.php index bab4ce0c9..e8094e6c0 100644 --- a/vendor/symfony/translation/Extractor/PhpStringTokenParser.php +++ b/vendor/symfony/translation/Extractor/PhpStringTokenParser.php @@ -89,7 +89,7 @@ public static function parse($str) * Parses escape sequences in strings (all string types apart from single quoted). * * @param string $str String without quotes - * @param null|string $quote Quote type + * @param string|null $quote Quote type * * @return string String with escape sequences parsed */ @@ -113,9 +113,9 @@ private static function parseCallback($matches) if (isset(self::$replacements[$str])) { return self::$replacements[$str]; } elseif ('x' === $str[0] || 'X' === $str[0]) { - return chr(hexdec($str)); + return \chr(hexdec($str)); } else { - return chr(octdec($str)); + return \chr(octdec($str)); } } diff --git a/vendor/symfony/translation/Loader/ArrayLoader.php b/vendor/symfony/translation/Loader/ArrayLoader.php index 9a595b7da..7bbfca68a 100644 --- a/vendor/symfony/translation/Loader/ArrayLoader.php +++ b/vendor/symfony/translation/Loader/ArrayLoader.php @@ -52,7 +52,7 @@ private function flatten(array &$messages, array $subnode = null, $path = null) $subnode = &$messages; } foreach ($subnode as $key => $value) { - if (is_array($value)) { + if (\is_array($value)) { $nodePath = $path ? $path.'.'.$key : $key; $this->flatten($messages, $value, $nodePath); if (null === $path) { diff --git a/vendor/symfony/translation/Loader/CsvFileLoader.php b/vendor/symfony/translation/Loader/CsvFileLoader.php index e454d1692..8a763e725 100644 --- a/vendor/symfony/translation/Loader/CsvFileLoader.php +++ b/vendor/symfony/translation/Loader/CsvFileLoader.php @@ -41,7 +41,7 @@ protected function loadResource($resource) $file->setCsvControl($this->delimiter, $this->enclosure, $this->escape); foreach ($file as $data) { - if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === count($data)) { + if ('#' !== substr($data[0], 0, 1) && isset($data[1]) && 2 === \count($data)) { $messages[$data[0]] = $data[1]; } } diff --git a/vendor/symfony/translation/Loader/FileLoader.php b/vendor/symfony/translation/Loader/FileLoader.php index 322679d24..9a02f5250 100644 --- a/vendor/symfony/translation/Loader/FileLoader.php +++ b/vendor/symfony/translation/Loader/FileLoader.php @@ -11,9 +11,9 @@ namespace Symfony\Component\Translation\Loader; +use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Translation\Exception\InvalidResourceException; use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\FileResource; /** * @author Abdellatif Ait boudad @@ -41,7 +41,7 @@ public function load($resource, $locale, $domain = 'messages') } // not an array - if (!is_array($messages)) { + if (!\is_array($messages)) { throw new InvalidResourceException(sprintf('Unable to load file "%s".', $resource)); } diff --git a/vendor/symfony/translation/Loader/IcuDatFileLoader.php b/vendor/symfony/translation/Loader/IcuDatFileLoader.php index 71ba90a39..83b5043d3 100644 --- a/vendor/symfony/translation/Loader/IcuDatFileLoader.php +++ b/vendor/symfony/translation/Loader/IcuDatFileLoader.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Translation\Loader; -use Symfony\Component\Translation\MessageCatalogue; +use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Translation\Exception\InvalidResourceException; use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Translation\MessageCatalogue; /** * IcuResFileLoader loads translations from a resource bundle. diff --git a/vendor/symfony/translation/Loader/IcuResFileLoader.php b/vendor/symfony/translation/Loader/IcuResFileLoader.php index 6b5b5e125..fd2d1e4d3 100644 --- a/vendor/symfony/translation/Loader/IcuResFileLoader.php +++ b/vendor/symfony/translation/Loader/IcuResFileLoader.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Translation\Loader; -use Symfony\Component\Translation\MessageCatalogue; +use Symfony\Component\Config\Resource\DirectoryResource; use Symfony\Component\Translation\Exception\InvalidResourceException; use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\DirectoryResource; +use Symfony\Component\Translation\MessageCatalogue; /** * IcuResFileLoader loads translations from a resource bundle. diff --git a/vendor/symfony/translation/Loader/LoaderInterface.php b/vendor/symfony/translation/Loader/LoaderInterface.php index 6b65fe380..1785402d9 100644 --- a/vendor/symfony/translation/Loader/LoaderInterface.php +++ b/vendor/symfony/translation/Loader/LoaderInterface.php @@ -11,9 +11,9 @@ namespace Symfony\Component\Translation\Loader; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Exception\InvalidResourceException; use Symfony\Component\Translation\Exception\NotFoundResourceException; +use Symfony\Component\Translation\MessageCatalogue; /** * LoaderInterface is the interface implemented by all translation loaders. diff --git a/vendor/symfony/translation/Loader/MoFileLoader.php b/vendor/symfony/translation/Loader/MoFileLoader.php index aad2bba22..93ecffa66 100644 --- a/vendor/symfony/translation/Loader/MoFileLoader.php +++ b/vendor/symfony/translation/Loader/MoFileLoader.php @@ -111,7 +111,7 @@ protected function loadResource($resource) $ids = array('singular' => $singularId, 'plural' => $pluralId); $item = compact('ids', 'translated'); - if (is_array($item['translated'])) { + if (\is_array($item['translated'])) { $messages[$item['ids']['singular']] = stripcslashes($item['translated'][0]); if (isset($item['ids']['plural'])) { $plurals = array(); diff --git a/vendor/symfony/translation/Loader/PoFileLoader.php b/vendor/symfony/translation/Loader/PoFileLoader.php index 7ce7d2dff..066168dc7 100644 --- a/vendor/symfony/translation/Loader/PoFileLoader.php +++ b/vendor/symfony/translation/Loader/PoFileLoader.php @@ -78,7 +78,7 @@ protected function loadResource($resource) if ('' === $line) { // Whitespace indicated current item is done - if (!in_array('fuzzy', $flags)) { + if (!\in_array('fuzzy', $flags)) { $this->addMessage($messages, $item); } $item = $defaults; @@ -96,7 +96,7 @@ protected function loadResource($resource) } elseif ('"' === $line[0]) { $continues = isset($item['translated']) ? 'translated' : 'ids'; - if (is_array($item[$continues])) { + if (\is_array($item[$continues])) { end($item[$continues]); $item[$continues][key($item[$continues])] .= substr($line, 1, -1); } else { @@ -110,7 +110,7 @@ protected function loadResource($resource) } } // save last item - if (!in_array('fuzzy', $flags)) { + if (!\in_array('fuzzy', $flags)) { $this->addMessage($messages, $item); } fclose($stream); @@ -126,7 +126,7 @@ protected function loadResource($resource) */ private function addMessage(array &$messages, array $item) { - if (is_array($item['translated'])) { + if (\is_array($item['translated'])) { $messages[stripcslashes($item['ids']['singular'])] = stripcslashes($item['translated'][0]); if (isset($item['ids']['plural'])) { $plurals = $item['translated']; diff --git a/vendor/symfony/translation/Loader/QtFileLoader.php b/vendor/symfony/translation/Loader/QtFileLoader.php index 22536aa86..2d4a4c084 100644 --- a/vendor/symfony/translation/Loader/QtFileLoader.php +++ b/vendor/symfony/translation/Loader/QtFileLoader.php @@ -11,11 +11,11 @@ namespace Symfony\Component\Translation\Loader; +use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Config\Util\XmlUtils; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Exception\InvalidResourceException; use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Translation\MessageCatalogue; /** * QtFileLoader loads translations from QT Translations XML files. diff --git a/vendor/symfony/translation/Loader/XliffFileLoader.php b/vendor/symfony/translation/Loader/XliffFileLoader.php index 136685ba2..11a9ce4d4 100644 --- a/vendor/symfony/translation/Loader/XliffFileLoader.php +++ b/vendor/symfony/translation/Loader/XliffFileLoader.php @@ -11,12 +11,12 @@ namespace Symfony\Component\Translation\Loader; +use Symfony\Component\Config\Resource\FileResource; use Symfony\Component\Config\Util\XmlUtils; -use Symfony\Component\Translation\MessageCatalogue; +use Symfony\Component\Translation\Exception\InvalidArgumentException; use Symfony\Component\Translation\Exception\InvalidResourceException; use Symfony\Component\Translation\Exception\NotFoundResourceException; -use Symfony\Component\Translation\Exception\InvalidArgumentException; -use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Translation\MessageCatalogue; /** * XliffFileLoader loads translations from XLIFF files. @@ -91,7 +91,7 @@ private function extractXliff1(\DOMDocument $dom, MessageCatalogue $catalogue, $ $source = isset($attributes['resname']) && $attributes['resname'] ? $attributes['resname'] : $translation->source; // If the xlf file has another encoding specified, try to convert it because // simple_xml will always return utf-8 encoded values - $target = $this->utf8ToCharset((string) (isset($translation->target) ? $translation->target : $source), $encoding); + $target = $this->utf8ToCharset((string) (isset($translation->target) ? $translation->target : $translation->source), $encoding); $catalogue->set((string) $source, $target, $domain); @@ -247,7 +247,7 @@ private function fixXmlLocation($schemaSource, $xmlUri) } } - $drive = '\\' === DIRECTORY_SEPARATOR ? array_shift($parts).'/' : ''; + $drive = '\\' === \DIRECTORY_SEPARATOR ? array_shift($parts).'/' : ''; $newPath = $locationstart.$drive.implode('/', array_map('rawurlencode', $parts)); return str_replace($xmlUri, $newPath, $schemaSource); diff --git a/vendor/symfony/translation/Loader/YamlFileLoader.php b/vendor/symfony/translation/Loader/YamlFileLoader.php index 07914f263..771e6e7b7 100644 --- a/vendor/symfony/translation/Loader/YamlFileLoader.php +++ b/vendor/symfony/translation/Loader/YamlFileLoader.php @@ -13,8 +13,8 @@ use Symfony\Component\Translation\Exception\InvalidResourceException; use Symfony\Component\Translation\Exception\LogicException; -use Symfony\Component\Yaml\Parser as YamlParser; use Symfony\Component\Yaml\Exception\ParseException; +use Symfony\Component\Yaml\Parser as YamlParser; /** * YamlFileLoader loads translations from Yaml files. diff --git a/vendor/symfony/translation/LoggingTranslator.php b/vendor/symfony/translation/LoggingTranslator.php index 337c11433..7fedac913 100644 --- a/vendor/symfony/translation/LoggingTranslator.php +++ b/vendor/symfony/translation/LoggingTranslator.php @@ -33,7 +33,7 @@ class LoggingTranslator implements TranslatorInterface, TranslatorBagInterface public function __construct(TranslatorInterface $translator, LoggerInterface $logger) { if (!$translator instanceof TranslatorBagInterface) { - throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', get_class($translator))); + throw new InvalidArgumentException(sprintf('The Translator "%s" must implement TranslatorInterface and TranslatorBagInterface.', \get_class($translator))); } $this->translator = $translator; @@ -89,7 +89,7 @@ public function getCatalogue($locale = null) /** * Gets the fallback locales. * - * @return array $locales The fallback locales + * @return array The fallback locales */ public function getFallbackLocales() { @@ -105,7 +105,7 @@ public function getFallbackLocales() */ public function __call($method, $args) { - return call_user_func_array(array($this->translator, $method), $args); + return \call_user_func_array(array($this->translator, $method), $args); } /** diff --git a/vendor/symfony/translation/MessageCatalogueInterface.php b/vendor/symfony/translation/MessageCatalogueInterface.php index 4dad27fbf..e0dbb2bd9 100644 --- a/vendor/symfony/translation/MessageCatalogueInterface.php +++ b/vendor/symfony/translation/MessageCatalogueInterface.php @@ -105,7 +105,7 @@ public function add($messages, $domain = 'messages'); * * The two catalogues must have the same locale. */ - public function addCatalogue(MessageCatalogueInterface $catalogue); + public function addCatalogue(self $catalogue); /** * Merges translations from the given Catalogue into the current one @@ -113,7 +113,7 @@ public function addCatalogue(MessageCatalogueInterface $catalogue); * * This is used to provide default translations when they do not exist for the current locale. */ - public function addFallbackCatalogue(MessageCatalogueInterface $catalogue); + public function addFallbackCatalogue(self $catalogue); /** * Gets the fallback catalogue. diff --git a/vendor/symfony/translation/MessageSelector.php b/vendor/symfony/translation/MessageSelector.php index 31304cd0d..5de171c5f 100644 --- a/vendor/symfony/translation/MessageSelector.php +++ b/vendor/symfony/translation/MessageSelector.php @@ -82,7 +82,7 @@ public function choose($message, $number, $locale) if (!isset($standardRules[$position])) { // when there's exactly one rule given, and that rule is a standard // rule, use this rule - if (1 === count($parts) && isset($standardRules[0])) { + if (1 === \count($parts) && isset($standardRules[0])) { return $standardRules[0]; } diff --git a/vendor/symfony/translation/PluralizationRules.php b/vendor/symfony/translation/PluralizationRules.php index 38dde743a..3aca0ba96 100644 --- a/vendor/symfony/translation/PluralizationRules.php +++ b/vendor/symfony/translation/PluralizationRules.php @@ -35,14 +35,14 @@ public static function get($number, $locale) $locale = 'xbr'; } - if (strlen($locale) > 3) { - $locale = substr($locale, 0, -strlen(strrchr($locale, '_'))); + if (\strlen($locale) > 3) { + $locale = substr($locale, 0, -\strlen(strrchr($locale, '_'))); } if (isset(self::$rules[$locale])) { - $return = call_user_func(self::$rules[$locale], $number); + $return = \call_user_func(self::$rules[$locale], $number); - if (!is_int($return) || $return < 0) { + if (!\is_int($return) || $return < 0) { return 0; } @@ -107,6 +107,7 @@ public static function get($number, $locale) case 'nl': case 'nn': case 'no': + case 'oc': case 'om': case 'or': case 'pa': @@ -143,6 +144,7 @@ public static function get($number, $locale) case 'bs': case 'hr': case 'ru': + case 'sh': case 'sr': case 'uk': return ((1 == $number % 10) && (11 != $number % 100)) ? 0 : ((($number % 10 >= 2) && ($number % 10 <= 4) && (($number % 100 < 10) || ($number % 100 >= 20))) ? 1 : 2); @@ -199,8 +201,8 @@ public static function set(callable $rule, $locale) $locale = 'xbr'; } - if (strlen($locale) > 3) { - $locale = substr($locale, 0, -strlen(strrchr($locale, '_'))); + if (\strlen($locale) > 3) { + $locale = substr($locale, 0, -\strlen(strrchr($locale, '_'))); } self::$rules[$locale] = $rule; diff --git a/vendor/symfony/translation/Reader/TranslationReader.php b/vendor/symfony/translation/Reader/TranslationReader.php index d2ad774e2..948edec49 100644 --- a/vendor/symfony/translation/Reader/TranslationReader.php +++ b/vendor/symfony/translation/Reader/TranslationReader.php @@ -55,7 +55,7 @@ public function read($directory, MessageCatalogue $catalogue) $extension = $catalogue->getLocale().'.'.$format; $files = $finder->files()->name('*.'.$extension)->in($directory); foreach ($files as $file) { - $domain = substr($file->getFilename(), 0, -1 * strlen($extension) - 1); + $domain = substr($file->getFilename(), 0, -1 * \strlen($extension) - 1); $catalogue->addCatalogue($loader->load($file->getPathname(), $catalogue->getLocale(), $domain)); } } diff --git a/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php b/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php index 5611c877c..6665eca49 100644 --- a/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php +++ b/vendor/symfony/translation/Tests/DataCollector/TranslationDataCollectorTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\DataCollector; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\DataCollectorTranslator; use Symfony\Component\Translation\DataCollector\TranslationDataCollector; +use Symfony\Component\Translation\DataCollectorTranslator; class TranslationDataCollectorTest extends TestCase { @@ -42,85 +42,85 @@ public function testCollect() { $collectedMessages = array( array( - 'id' => 'foo', - 'translation' => 'foo (en)', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'foo', + 'translation' => 'foo (en)', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_DEFINED, + 'parameters' => array(), + 'transChoiceNumber' => null, ), array( - 'id' => 'bar', - 'translation' => 'bar (fr)', - 'locale' => 'fr', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'bar', + 'translation' => 'bar (fr)', + 'locale' => 'fr', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'parameters' => array(), + 'transChoiceNumber' => null, ), array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 3), - 'transChoiceNumber' => 3, + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'parameters' => array('%count%' => 3), + 'transChoiceNumber' => 3, ), array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 3), - 'transChoiceNumber' => 3, + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'parameters' => array('%count%' => 3), + 'transChoiceNumber' => 3, ), array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array('%count%' => 4, '%foo%' => 'bar'), - 'transChoiceNumber' => 4, + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'parameters' => array('%count%' => 4, '%foo%' => 'bar'), + 'transChoiceNumber' => 4, ), ); $expectedMessages = array( array( - 'id' => 'foo', - 'translation' => 'foo (en)', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'count' => 1, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'foo', + 'translation' => 'foo (en)', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_DEFINED, + 'count' => 1, + 'parameters' => array(), + 'transChoiceNumber' => null, ), array( - 'id' => 'bar', - 'translation' => 'bar (fr)', - 'locale' => 'fr', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'count' => 1, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'bar', + 'translation' => 'bar (fr)', + 'locale' => 'fr', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'count' => 1, + 'parameters' => array(), + 'transChoiceNumber' => null, ), array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'count' => 3, - 'parameters' => array( - array('%count%' => 3), - array('%count%' => 3), - array('%count%' => 4, '%foo%' => 'bar'), - ), - 'transChoiceNumber' => 3, + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'count' => 3, + 'parameters' => array( + array('%count%' => 3), + array('%count%' => 3), + array('%count%' => 4, '%foo%' => 'bar'), + ), + 'transChoiceNumber' => 3, ), ); diff --git a/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php b/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php index 1b417379c..1cdd33b39 100644 --- a/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php +++ b/vendor/symfony/translation/Tests/DataCollectorTranslatorTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\Translation\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Translator; use Symfony\Component\Translation\DataCollectorTranslator; use Symfony\Component\Translation\Loader\ArrayLoader; +use Symfony\Component\Translation\Translator; class DataCollectorTranslatorTest extends TestCase { @@ -31,49 +31,49 @@ public function testCollectMessages() $expectedMessages = array(); $expectedMessages[] = array( - 'id' => 'foo', - 'translation' => 'foo (en)', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_DEFINED, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'foo', + 'translation' => 'foo (en)', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_DEFINED, + 'parameters' => array(), + 'transChoiceNumber' => null, ); $expectedMessages[] = array( - 'id' => 'bar', - 'translation' => 'bar (fr)', - 'locale' => 'fr', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'bar', + 'translation' => 'bar (fr)', + 'locale' => 'fr', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'parameters' => array(), + 'transChoiceNumber' => null, ); $expectedMessages[] = array( - 'id' => 'choice', - 'translation' => 'choice', - 'locale' => 'en', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_MISSING, - 'parameters' => array(), - 'transChoiceNumber' => 0, + 'id' => 'choice', + 'translation' => 'choice', + 'locale' => 'en', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_MISSING, + 'parameters' => array(), + 'transChoiceNumber' => 0, ); $expectedMessages[] = array( - 'id' => 'bar_ru', - 'translation' => 'bar (ru)', - 'locale' => 'ru', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array(), - 'transChoiceNumber' => null, + 'id' => 'bar_ru', + 'translation' => 'bar (ru)', + 'locale' => 'ru', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'parameters' => array(), + 'transChoiceNumber' => null, ); $expectedMessages[] = array( - 'id' => 'bar_ru', - 'translation' => 'bar (ru)', - 'locale' => 'ru', - 'domain' => 'messages', - 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, - 'parameters' => array('foo' => 'bar'), - 'transChoiceNumber' => null, + 'id' => 'bar_ru', + 'translation' => 'bar (ru)', + 'locale' => 'ru', + 'domain' => 'messages', + 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK, + 'parameters' => array('foo' => 'bar'), + 'transChoiceNumber' => null, ); $this->assertEquals($expectedMessages, $collector->getCollectedMessages()); diff --git a/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php b/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php index 3e02cb434..759bb0e97 100644 --- a/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php +++ b/vendor/symfony/translation/Tests/DependencyInjection/TranslationDumperPassTest.php @@ -35,8 +35,8 @@ public function testProcessNoDefinitionFound() { $container = new ContainerBuilder(); - $definitionsBefore = count($container->getDefinitions()); - $aliasesBefore = count($container->getAliases()); + $definitionsBefore = \count($container->getDefinitions()); + $aliasesBefore = \count($container->getAliases()); $translationDumperPass = new TranslationDumperPass(); $translationDumperPass->process($container); diff --git a/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php b/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php index b3313e63e..14d164d0e 100644 --- a/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php +++ b/vendor/symfony/translation/Tests/DependencyInjection/TranslationExtractorPassTest.php @@ -35,8 +35,8 @@ public function testProcessNoDefinitionFound() { $container = new ContainerBuilder(); - $definitionsBefore = count($container->getDefinitions()); - $aliasesBefore = count($container->getAliases()); + $definitionsBefore = \count($container->getDefinitions()); + $aliasesBefore = \count($container->getAliases()); $translationDumperPass = new TranslationExtractorPass(); $translationDumperPass->process($container); diff --git a/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php b/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php index c0274738d..4c03aaca5 100644 --- a/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php +++ b/vendor/symfony/translation/Tests/DependencyInjection/TranslationPassTest.php @@ -57,7 +57,7 @@ public function testValidCollector() /** * @group legacy - * @expectedDeprecation The default value for $readerServiceId will change in 4.0 to "translation.reader". + * @expectedDeprecation The default value for $readerServiceId in "Symfony\Component\Translation\DependencyInjection\TranslatorPass::__construct()" will change in 4.0 to "translation.reader". * * A test that verifies the deprecated "translation.loader" gets the LoaderInterfaces added. * diff --git a/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php index 73fe922df..9a7a059a4 100644 --- a/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/CsvFileDumperTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Dumper; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Dumper\CsvFileDumper; +use Symfony\Component\Translation\MessageCatalogue; class CsvFileDumperTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php index 792051953..bac567fd5 100644 --- a/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/FileDumperTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Dumper; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Dumper\FileDumper; +use Symfony\Component\Translation\MessageCatalogue; class FileDumperTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php index 2f19d08db..78d0abb6e 100644 --- a/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/IcuResFileDumperTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Dumper; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Dumper\IcuResFileDumper; +use Symfony\Component\Translation\MessageCatalogue; class IcuResFileDumperTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php index 72bd9166f..5f3c1236c 100644 --- a/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/IniFileDumperTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Dumper; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Dumper\IniFileDumper; +use Symfony\Component\Translation\MessageCatalogue; class IniFileDumperTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php index 5e66f718d..b134ce4f2 100644 --- a/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/JsonFileDumperTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Dumper; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Dumper\JsonFileDumper; +use Symfony\Component\Translation\MessageCatalogue; class JsonFileDumperTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php index 3a2054f34..d0519675b 100644 --- a/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/MoFileDumperTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Dumper; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Dumper\MoFileDumper; +use Symfony\Component\Translation\MessageCatalogue; class MoFileDumperTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php index c2f703542..22a39dd43 100644 --- a/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/PhpFileDumperTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Dumper; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Dumper\PhpFileDumper; +use Symfony\Component\Translation\MessageCatalogue; class PhpFileDumperTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php index b00c5d136..5d7524710 100644 --- a/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/PoFileDumperTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Dumper; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Dumper\PoFileDumper; +use Symfony\Component\Translation\MessageCatalogue; class PoFileDumperTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php index 9213bbaec..8e4a6f43f 100644 --- a/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/QtFileDumperTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Dumper; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Dumper\QtFileDumper; +use Symfony\Component\Translation\MessageCatalogue; class QtFileDumperTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php index 738d4b3b2..443dccf2b 100644 --- a/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/XliffFileDumperTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Dumper; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Dumper\XliffFileDumper; +use Symfony\Component\Translation\MessageCatalogue; class XliffFileDumperTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php b/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php index 0541ac107..a5549a2e9 100644 --- a/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php +++ b/vendor/symfony/translation/Tests/Dumper/YamlFileDumperTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Dumper; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Dumper\YamlFileDumper; +use Symfony\Component\Translation\MessageCatalogue; class YamlFileDumperTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php index 27a4456e6..29efdef00 100644 --- a/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/CsvFileLoaderTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Loader; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Loader\CsvFileLoader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Translation\Loader\CsvFileLoader; class CsvFileLoaderTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php index 888fb6157..e28db6013 100644 --- a/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/IcuDatFileLoaderTest.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Translation\Tests\Loader; -use Symfony\Component\Translation\Loader\IcuDatFileLoader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Translation\Loader\IcuDatFileLoader; /** * @requires extension intl diff --git a/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php index 8d9ed1991..92d8933c8 100644 --- a/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/IcuResFileLoaderTest.php @@ -11,8 +11,8 @@ namespace Symfony\Component\Translation\Tests\Loader; -use Symfony\Component\Translation\Loader\IcuResFileLoader; use Symfony\Component\Config\Resource\DirectoryResource; +use Symfony\Component\Translation\Loader\IcuResFileLoader; /** * @requires extension intl diff --git a/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php index dbf22d103..d9dcc5e8f 100644 --- a/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/IniFileLoaderTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Loader; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Loader\IniFileLoader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Translation\Loader\IniFileLoader; class IniFileLoaderTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php index 46261b666..cea0aef4b 100644 --- a/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/JsonFileLoaderTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Loader; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Loader\JsonFileLoader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Translation\Loader\JsonFileLoader; class JsonFileLoaderTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Loader/LocalizedTestCase.php b/vendor/symfony/translation/Tests/Loader/LocalizedTestCase.php index a655c69d2..279e9fde5 100644 --- a/vendor/symfony/translation/Tests/Loader/LocalizedTestCase.php +++ b/vendor/symfony/translation/Tests/Loader/LocalizedTestCase.php @@ -17,7 +17,7 @@ abstract class LocalizedTestCase extends TestCase { protected function setUp() { - if (!extension_loaded('intl')) { + if (!\extension_loaded('intl')) { $this->markTestSkipped('Extension intl is required.'); } } diff --git a/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php index b9f754fcf..6ad3d44d2 100644 --- a/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/MoFileLoaderTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Loader; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Loader\MoFileLoader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Translation\Loader\MoFileLoader; class MoFileLoaderTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php index 9fc83e34f..01b7a5fea 100644 --- a/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/PhpFileLoaderTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Loader; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Loader\PhpFileLoader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Translation\Loader\PhpFileLoader; class PhpFileLoaderTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php index 884dec9a6..4176cb7ff 100644 --- a/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/PoFileLoaderTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Loader; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Loader\PoFileLoader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Translation\Loader\PoFileLoader; class PoFileLoaderTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php index 7ee62b06c..8a00fdedc 100644 --- a/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/QtFileLoaderTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Loader; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Loader\QtFileLoader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Translation\Loader\QtFileLoader; class QtFileLoaderTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php index a8182895e..c6958486c 100644 --- a/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/XliffFileLoaderTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Loader; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Loader\XliffFileLoader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Translation\Loader\XliffFileLoader; class XliffFileLoaderTest extends TestCase { @@ -66,7 +66,7 @@ public function testLoadWithResname() $loader = new XliffFileLoader(); $catalogue = $loader->load(__DIR__.'/../fixtures/resname.xlf', 'en', 'domain1'); - $this->assertEquals(array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo'), $catalogue->all('domain1')); + $this->assertEquals(array('foo' => 'bar', 'bar' => 'baz', 'baz' => 'foo', 'qux' => 'qux source'), $catalogue->all('domain1')); } public function testIncompleteResource() diff --git a/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php b/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php index e1ba514b3..bb3c1a99a 100644 --- a/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php +++ b/vendor/symfony/translation/Tests/Loader/YamlFileLoaderTest.php @@ -12,8 +12,8 @@ namespace Symfony\Component\Translation\Tests\Loader; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Loader\YamlFileLoader; use Symfony\Component\Config\Resource\FileResource; +use Symfony\Component\Translation\Loader\YamlFileLoader; class YamlFileLoaderTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/LoggingTranslatorTest.php b/vendor/symfony/translation/Tests/LoggingTranslatorTest.php index 891230a2d..022379e93 100644 --- a/vendor/symfony/translation/Tests/LoggingTranslatorTest.php +++ b/vendor/symfony/translation/Tests/LoggingTranslatorTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\Translation\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Translator; -use Symfony\Component\Translation\LoggingTranslator; use Symfony\Component\Translation\Loader\ArrayLoader; +use Symfony\Component\Translation\LoggingTranslator; +use Symfony\Component\Translation\Translator; class LoggingTranslatorTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/PluralizationRulesTest.php b/vendor/symfony/translation/Tests/PluralizationRulesTest.php index a0624e297..5eb6c01f5 100644 --- a/vendor/symfony/translation/Tests/PluralizationRulesTest.php +++ b/vendor/symfony/translation/Tests/PluralizationRulesTest.php @@ -100,9 +100,9 @@ protected function validateMatrix($nplural, $matrix, $expectSuccess = true) foreach ($matrix as $langCode => $data) { $indexes = array_flip($data); if ($expectSuccess) { - $this->assertEquals($nplural, count($indexes), "Langcode '$langCode' has '$nplural' plural forms."); + $this->assertEquals($nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms."); } else { - $this->assertNotEquals((int) $nplural, count($indexes), "Langcode '$langCode' has '$nplural' plural forms."); + $this->assertNotEquals((int) $nplural, \count($indexes), "Langcode '$langCode' has '$nplural' plural forms."); } } } diff --git a/vendor/symfony/translation/Tests/TranslatorCacheTest.php b/vendor/symfony/translation/Tests/TranslatorCacheTest.php index a60690f85..3e71ae74e 100644 --- a/vendor/symfony/translation/Tests/TranslatorCacheTest.php +++ b/vendor/symfony/translation/Tests/TranslatorCacheTest.php @@ -15,8 +15,8 @@ use Symfony\Component\Config\Resource\SelfCheckingResourceInterface; use Symfony\Component\Translation\Loader\ArrayLoader; use Symfony\Component\Translation\Loader\LoaderInterface; -use Symfony\Component\Translation\Translator; use Symfony\Component\Translation\MessageCatalogue; +use Symfony\Component\Translation\Translator; class TranslatorCacheTest extends TestCase { diff --git a/vendor/symfony/translation/Tests/TranslatorTest.php b/vendor/symfony/translation/Tests/TranslatorTest.php index d30ea587f..3e54839f7 100644 --- a/vendor/symfony/translation/Tests/TranslatorTest.php +++ b/vendor/symfony/translation/Tests/TranslatorTest.php @@ -12,9 +12,9 @@ namespace Symfony\Component\Translation\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Component\Translation\Translator; use Symfony\Component\Translation\Loader\ArrayLoader; use Symfony\Component\Translation\MessageCatalogue; +use Symfony\Component\Translation\Translator; class TranslatorTest extends TestCase { @@ -297,12 +297,12 @@ public function testFallbackCatalogueResources() $resources = $translator->getCatalogue('en')->getResources(); $this->assertCount(1, $resources); - $this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources); + $this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources); $resources = $translator->getCatalogue('en_GB')->getResources(); $this->assertCount(2, $resources); - $this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'empty.yml', $resources); - $this->assertContains(__DIR__.DIRECTORY_SEPARATOR.'fixtures'.DIRECTORY_SEPARATOR.'resources.yml', $resources); + $this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'empty.yml', $resources); + $this->assertContains(__DIR__.\DIRECTORY_SEPARATOR.'fixtures'.\DIRECTORY_SEPARATOR.'resources.yml', $resources); } /** diff --git a/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php b/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php index 8837553d5..26a846ea9 100644 --- a/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php +++ b/vendor/symfony/translation/Tests/Writer/TranslationWriterTest.php @@ -20,7 +20,7 @@ class TranslationWriterTest extends TestCase { /** * @group legacy - * @expectedDeprecation Method Symfony\Component\Translation\Writer\TranslationWriter::writeTranslations() is deprecated since Symfony 3.4 and will be removed in 4.0. Use write() instead. + * @expectedDeprecation The "Symfony\Component\Translation\Writer\TranslationWriter::writeTranslations()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Use write() instead. */ public function testWriteTranslations() { diff --git a/vendor/symfony/translation/Tests/fixtures/resname.xlf b/vendor/symfony/translation/Tests/fixtures/resname.xlf index 2df16af94..4fa5c0017 100644 --- a/vendor/symfony/translation/Tests/fixtures/resname.xlf +++ b/vendor/symfony/translation/Tests/fixtures/resname.xlf @@ -14,6 +14,9 @@ baz foo + + qux source + diff --git a/vendor/symfony/translation/Translator.php b/vendor/symfony/translation/Translator.php index 411eec716..c965a0bb4 100644 --- a/vendor/symfony/translation/Translator.php +++ b/vendor/symfony/translation/Translator.php @@ -11,17 +11,17 @@ namespace Symfony\Component\Translation; -use Symfony\Component\Translation\Loader\LoaderInterface; -use Symfony\Component\Translation\Exception\NotFoundResourceException; +use Symfony\Component\Config\ConfigCacheFactory; +use Symfony\Component\Config\ConfigCacheFactoryInterface; +use Symfony\Component\Config\ConfigCacheInterface; use Symfony\Component\Translation\Exception\InvalidArgumentException; use Symfony\Component\Translation\Exception\LogicException; +use Symfony\Component\Translation\Exception\NotFoundResourceException; use Symfony\Component\Translation\Exception\RuntimeException; -use Symfony\Component\Config\ConfigCacheInterface; -use Symfony\Component\Config\ConfigCacheFactoryInterface; -use Symfony\Component\Config\ConfigCacheFactory; -use Symfony\Component\Translation\Formatter\MessageFormatterInterface; use Symfony\Component\Translation\Formatter\ChoiceMessageFormatterInterface; use Symfony\Component\Translation\Formatter\MessageFormatter; +use Symfony\Component\Translation\Formatter\MessageFormatterInterface; +use Symfony\Component\Translation\Loader\LoaderInterface; /** * @author Fabien Potencier @@ -87,7 +87,7 @@ public function __construct($locale, $formatter = null, $cacheDir = null, $debug if ($formatter instanceof MessageSelector) { $formatter = new MessageFormatter($formatter); - @trigger_error(sprintf('Passing a "%s" instance into the "%s" as a second argument is deprecated since Symfony 3.4 and will be removed in 4.0. Inject a "%s" implementation instead.', MessageSelector::class, __METHOD__, MessageFormatterInterface::class), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a "%s" instance into the "%s()" method as a second argument is deprecated since Symfony 3.4 and will be removed in 4.0. Inject a "%s" implementation instead.', MessageSelector::class, __METHOD__, MessageFormatterInterface::class), E_USER_DEPRECATED); } elseif (null === $formatter) { $formatter = new MessageFormatter(); } @@ -133,7 +133,7 @@ public function addResource($format, $resource, $locale, $domain = null) $this->resources[$locale][] = array($format, $resource, $domain); - if (in_array($locale, $this->fallbackLocales)) { + if (\in_array($locale, $this->fallbackLocales)) { $this->catalogues = array(); } else { unset($this->catalogues[$locale]); @@ -179,7 +179,7 @@ public function setFallbackLocales(array $locales) /** * Gets the fallback locales. * - * @return array $locales The fallback locales + * @return array The fallback locales */ public function getFallbackLocales() { @@ -204,7 +204,7 @@ public function trans($id, array $parameters = array(), $domain = null, $locale public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null) { if (!$this->formatter instanceof ChoiceMessageFormatterInterface) { - throw new LogicException(sprintf('The formatter "%s" does not support plural translations.', get_class($this->formatter))); + throw new LogicException(sprintf('The formatter "%s" does not support plural translations.', \get_class($this->formatter))); } if (null === $domain) { @@ -413,7 +413,7 @@ protected function computeFallbackLocales($locale) } if (false !== strrchr($locale, '_')) { - array_unshift($locales, substr($locale, 0, -strlen(strrchr($locale, '_')))); + array_unshift($locales, substr($locale, 0, -\strlen(strrchr($locale, '_')))); } return array_unique($locales); diff --git a/vendor/symfony/translation/Util/ArrayConverter.php b/vendor/symfony/translation/Util/ArrayConverter.php index 9c0a420a8..e8b7559df 100644 --- a/vendor/symfony/translation/Util/ArrayConverter.php +++ b/vendor/symfony/translation/Util/ArrayConverter.php @@ -54,7 +54,7 @@ private static function &getElementByPath(array &$tree, array $parts) $parentOfElem = null; foreach ($parts as $i => $part) { - if (isset($elem[$part]) && is_string($elem[$part])) { + if (isset($elem[$part]) && \is_string($elem[$part])) { /* Process next case: * 'foo': 'test1', * 'foo.bar': 'test2' @@ -62,14 +62,14 @@ private static function &getElementByPath(array &$tree, array $parts) * $tree['foo'] was string before we found array {bar: test2}. * Treat new element as string too, e.g. add $tree['foo.bar'] = 'test2'; */ - $elem = &$elem[implode('.', array_slice($parts, $i))]; + $elem = &$elem[implode('.', \array_slice($parts, $i))]; break; } $parentOfElem = &$elem; $elem = &$elem[$part]; } - if (is_array($elem) && count($elem) > 0 && $parentOfElem) { + if ($elem && \is_array($elem) && $parentOfElem) { /* Process next case: * 'foo.bar': 'test1' * 'foo': 'test2' @@ -89,7 +89,7 @@ private static function cancelExpand(array &$tree, $prefix, array $node) $prefix .= '.'; foreach ($node as $id => $value) { - if (is_string($value)) { + if (\is_string($value)) { $tree[$prefix.$id] = $value; } else { self::cancelExpand($tree, $prefix.$id, $value); diff --git a/vendor/symfony/translation/Writer/TranslationWriter.php b/vendor/symfony/translation/Writer/TranslationWriter.php index 5ff5cd855..459f707fa 100644 --- a/vendor/symfony/translation/Writer/TranslationWriter.php +++ b/vendor/symfony/translation/Writer/TranslationWriter.php @@ -11,10 +11,10 @@ namespace Symfony\Component\Translation\Writer; -use Symfony\Component\Translation\MessageCatalogue; use Symfony\Component\Translation\Dumper\DumperInterface; use Symfony\Component\Translation\Exception\InvalidArgumentException; use Symfony\Component\Translation\Exception\RuntimeException; +use Symfony\Component\Translation\MessageCatalogue; /** * TranslationWriter writes translation messages. @@ -97,7 +97,7 @@ public function write(MessageCatalogue $catalogue, $format, $options = array()) */ public function writeTranslations(MessageCatalogue $catalogue, $format, $options = array()) { - @trigger_error(sprintf('Method %s() is deprecated since Symfony 3.4 and will be removed in 4.0. Use write() instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.4 and will be removed in 4.0. Use write() instead.', __METHOD__), E_USER_DEPRECATED); $this->write($catalogue, $format, $options); } } diff --git a/vendor/symfony/translation/phpunit.xml.dist b/vendor/symfony/translation/phpunit.xml.dist index 1fafa4691..21d324618 100644 --- a/vendor/symfony/translation/phpunit.xml.dist +++ b/vendor/symfony/translation/phpunit.xml.dist @@ -1,7 +1,7 @@ count($params)) { - $values[] = new EnumStub(array_splice($values, count($params)), false); + if (\count($values) < \count($params)) { + $params = \array_slice($params, 0, \count($values)); + } elseif (\count($values) > \count($params)) { + $values[] = new EnumStub(array_splice($values, \count($params)), false); $params[] = $variadic; } if (array('...') === $params) { diff --git a/vendor/symfony/var-dumper/Caster/Caster.php b/vendor/symfony/var-dumper/Caster/Caster.php index 2676fb78b..30cb9fc0d 100644 --- a/vendor/symfony/var-dumper/Caster/Caster.php +++ b/vendor/symfony/var-dumper/Caster/Caster.php @@ -49,7 +49,7 @@ class Caster public static function castObject($obj, $class, $hasDebugInfo = false) { if ($class instanceof \ReflectionClass) { - @trigger_error(sprintf('Passing a ReflectionClass to %s() is deprecated since Symfony 3.3 and will be unsupported in 4.0. Pass the class name as string instead.', __METHOD__), E_USER_DEPRECATED); + @trigger_error(sprintf('Passing a ReflectionClass to "%s()" is deprecated since Symfony 3.3 and will be unsupported in 4.0. Pass the class name as string instead.', __METHOD__), E_USER_DEPRECATED); $hasDebugInfo = $class->hasMethod('__debugInfo'); $class = $class->name; } @@ -122,10 +122,10 @@ public static function filter(array $a, $filter, array $listedProperties = array } elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || array() === $v) { $type |= self::EXCLUDE_EMPTY & $filter; } - if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !in_array($k, $listedProperties, true)) { + if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !\in_array($k, $listedProperties, true)) { $type |= self::EXCLUDE_NOT_IMPORTANT; } - if ((self::EXCLUDE_VERBOSE & $filter) && in_array($k, $listedProperties, true)) { + if ((self::EXCLUDE_VERBOSE & $filter) && \in_array($k, $listedProperties, true)) { $type |= self::EXCLUDE_VERBOSE; } diff --git a/vendor/symfony/var-dumper/Caster/ClassStub.php b/vendor/symfony/var-dumper/Caster/ClassStub.php index 2e1f41c15..859c1ec45 100644 --- a/vendor/symfony/var-dumper/Caster/ClassStub.php +++ b/vendor/symfony/var-dumper/Caster/ClassStub.php @@ -19,15 +19,15 @@ class ClassStub extends ConstStub { /** - * @param string A PHP identifier, e.g. a class, method, interface, etc. name - * @param callable The callable targeted by the identifier when it is ambiguous or not a real PHP identifier + * @param string $identifier A PHP identifier, e.g. a class, method, interface, etc. name + * @param callable $callable The callable targeted by the identifier when it is ambiguous or not a real PHP identifier */ public function __construct($identifier, $callable = null) { $this->value = $identifier; if (0 < $i = strrpos($identifier, '\\')) { - $this->attr['ellipsis'] = strlen($identifier) - $i; + $this->attr['ellipsis'] = \strlen($identifier) - $i; $this->attr['ellipsis-type'] = 'class'; $this->attr['ellipsis-tail'] = 1; } @@ -36,9 +36,9 @@ public function __construct($identifier, $callable = null) if (null !== $callable) { if ($callable instanceof \Closure) { $r = new \ReflectionFunction($callable); - } elseif (is_object($callable)) { + } elseif (\is_object($callable)) { $r = array($callable, '__invoke'); - } elseif (is_array($callable)) { + } elseif (\is_array($callable)) { $r = $callable; } elseif (false !== $i = strpos($callable, '::')) { $r = array(substr($callable, 0, $i), substr($callable, 2 + $i)); @@ -51,7 +51,7 @@ public function __construct($identifier, $callable = null) $r = new \ReflectionClass($identifier); } - if (is_array($r)) { + if (\is_array($r)) { try { $r = new \ReflectionMethod($r[0], $r[1]); } catch (\ReflectionException $e) { @@ -70,13 +70,13 @@ public function __construct($identifier, $callable = null) public static function wrapCallable($callable) { - if (is_object($callable) || !is_callable($callable)) { + if (\is_object($callable) || !\is_callable($callable)) { return $callable; } - if (!is_array($callable)) { + if (!\is_array($callable)) { $callable = new static($callable); - } elseif (is_string($callable[0])) { + } elseif (\is_string($callable[0])) { $callable[0] = new static($callable[0]); } else { $callable[1] = new static($callable[1], $callable); diff --git a/vendor/symfony/var-dumper/Caster/CutArrayStub.php b/vendor/symfony/var-dumper/Caster/CutArrayStub.php index f2a803053..0e4fb363d 100644 --- a/vendor/symfony/var-dumper/Caster/CutArrayStub.php +++ b/vendor/symfony/var-dumper/Caster/CutArrayStub.php @@ -25,6 +25,6 @@ public function __construct(array $value, array $preservedKeys) parent::__construct($value); $this->preservedSubset = array_intersect_key($value, array_flip($preservedKeys)); - $this->cut -= count($this->preservedSubset); + $this->cut -= \count($this->preservedSubset); } } diff --git a/vendor/symfony/var-dumper/Caster/CutStub.php b/vendor/symfony/var-dumper/Caster/CutStub.php index 61140eb36..690338f54 100644 --- a/vendor/symfony/var-dumper/Caster/CutStub.php +++ b/vendor/symfony/var-dumper/Caster/CutStub.php @@ -24,17 +24,17 @@ public function __construct($value) { $this->value = $value; - switch (gettype($value)) { + switch (\gettype($value)) { case 'object': $this->type = self::TYPE_OBJECT; - $this->class = get_class($value); + $this->class = \get_class($value); $this->cut = -1; break; case 'array': $this->type = self::TYPE_ARRAY; $this->class = self::ARRAY_ASSOC; - $this->cut = $this->value = count($value); + $this->cut = $this->value = \count($value); break; case 'resource': @@ -51,7 +51,7 @@ public function __construct($value) case 'string': $this->type = self::TYPE_STRING; $this->class = preg_match('//u', $value) ? self::STRING_UTF8 : self::STRING_BINARY; - $this->cut = self::STRING_BINARY === $this->class ? strlen($value) : mb_strlen($value, 'UTF-8'); + $this->cut = self::STRING_BINARY === $this->class ? \strlen($value) : mb_strlen($value, 'UTF-8'); $this->value = ''; break; } diff --git a/vendor/symfony/var-dumper/Caster/DateCaster.php b/vendor/symfony/var-dumper/Caster/DateCaster.php index 7e8831296..175d98655 100644 --- a/vendor/symfony/var-dumper/Caster/DateCaster.php +++ b/vendor/symfony/var-dumper/Caster/DateCaster.php @@ -76,7 +76,7 @@ public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stu { $location = $timeZone->getLocation(); $formatted = (new \DateTime('now', $timeZone))->format($location ? 'e (P)' : 'P'); - $title = $location && extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code'], \Locale::getDefault()) : ''; + $title = $location && \extension_loaded('intl') ? \Locale::getDisplayRegion('-'.$location['country_code'], \Locale::getDefault()) : ''; $z = array(Caster::PREFIX_VIRTUAL.'timezone' => new ConstStub($formatted, $title)); @@ -85,7 +85,7 @@ public static function castTimeZone(\DateTimeZone $timeZone, array $a, Stub $stu public static function castPeriod(\DatePeriod $p, array $a, Stub $stub, $isNested, $filter) { - if (defined('HHVM_VERSION_ID') || \PHP_VERSION_ID < 50620 || (\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70005)) { // see https://bugs.php.net/bug.php?id=71635 + if (\defined('HHVM_VERSION_ID') || \PHP_VERSION_ID < 50620 || (\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70005)) { // see https://bugs.php.net/bug.php?id=71635 return $a; } @@ -124,6 +124,6 @@ private static function formatDateTime(\DateTimeInterface $d, $extra = '') private static function formatSeconds($s, $us) { - return sprintf('%02d.%s', $s, 0 === ($len = strlen($t = rtrim($us, '0'))) ? '0' : ($len <= 3 ? str_pad($t, 3, '0') : $us)); + return sprintf('%02d.%s', $s, 0 === ($len = \strlen($t = rtrim($us, '0'))) ? '0' : ($len <= 3 ? str_pad($t, 3, '0') : $us)); } } diff --git a/vendor/symfony/var-dumper/Caster/DoctrineCaster.php b/vendor/symfony/var-dumper/Caster/DoctrineCaster.php index f6573b34f..785d0270d 100644 --- a/vendor/symfony/var-dumper/Caster/DoctrineCaster.php +++ b/vendor/symfony/var-dumper/Caster/DoctrineCaster.php @@ -12,8 +12,8 @@ namespace Symfony\Component\VarDumper\Caster; use Doctrine\Common\Proxy\Proxy as CommonProxy; -use Doctrine\ORM\Proxy\Proxy as OrmProxy; use Doctrine\ORM\PersistentCollection; +use Doctrine\ORM\Proxy\Proxy as OrmProxy; use Symfony\Component\VarDumper\Cloner\Stub; /** diff --git a/vendor/symfony/var-dumper/Caster/ExceptionCaster.php b/vendor/symfony/var-dumper/Caster/ExceptionCaster.php index df61aefb6..49df71da7 100644 --- a/vendor/symfony/var-dumper/Caster/ExceptionCaster.php +++ b/vendor/symfony/var-dumper/Caster/ExceptionCaster.php @@ -12,8 +12,8 @@ namespace Symfony\Component\VarDumper\Caster; use Symfony\Component\Debug\Exception\SilencedErrorContext; -use Symfony\Component\VarDumper\Exception\ThrowingCasterException; use Symfony\Component\VarDumper\Cloner\Stub; +use Symfony\Component\VarDumper\Exception\ThrowingCasterException; /** * Casts common Exception classes to array representation. @@ -71,8 +71,8 @@ public static function castThrowingCasterException(ThrowingCasterException $e, a if (isset($a[$xPrefix.'previous'], $a[$trace]) && $a[$xPrefix.'previous'] instanceof \Exception) { $b = (array) $a[$xPrefix.'previous']; - self::traceUnshift($b[$xPrefix.'trace'], get_class($a[$xPrefix.'previous']), $b[$prefix.'file'], $b[$prefix.'line']); - $a[$trace] = new TraceStub($b[$xPrefix.'trace'], false, 0, -count($a[$trace]->value)); + self::traceUnshift($b[$xPrefix.'trace'], \get_class($a[$xPrefix.'previous']), $b[$prefix.'file'], $b[$prefix.'line']); + $a[$trace] = new TraceStub($b[$xPrefix.'trace'], false, 0, -\count($a[$trace]->value)); } unset($a[$xPrefix.'previous'], $a[$prefix.'code'], $a[$prefix.'file'], $a[$prefix.'line']); @@ -118,7 +118,7 @@ public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, $is $prefix = Caster::PREFIX_VIRTUAL; $a = array(); - $j = count($frames); + $j = \count($frames); if (0 > $i = $trace->sliceOffset) { $i = max(0, $j + $i); } @@ -175,7 +175,7 @@ public static function castTraceStub(TraceStub $trace, array $a, Stub $stub, $is $lastCall = $call; } if (null !== $trace->sliceLength) { - $a = array_slice($a, 0, $trace->sliceLength, true); + $a = \array_slice($a, 0, $trace->sliceLength, true); } return $a; @@ -199,7 +199,7 @@ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, $is $a[$prefix.'src'] = self::$framesCache[$cacheKey]; } else { if (preg_match('/\((\d+)\)(?:\([\da-f]{32}\))? : (?:eval\(\)\'d code|runtime-created function)$/', $f['file'], $match)) { - $f['file'] = substr($f['file'], 0, -strlen($match[0])); + $f['file'] = substr($f['file'], 0, -\strlen($match[0])); $f['line'] = (int) $match[1]; } $caller = isset($f['function']) ? sprintf('in %s() on line %d', (isset($f['class']) ? $f['class'].$f['type'] : '').$f['function'], $f['line']) : null; @@ -212,7 +212,7 @@ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, $is if (file_exists($f['file']) && 0 <= self::$srcContext) { if (!empty($f['class']) && (is_subclass_of($f['class'], 'Twig\Template') || is_subclass_of($f['class'], 'Twig_Template')) && method_exists($f['class'], 'getDebugInfo')) { - $template = isset($f['object']) ? $f['object'] : unserialize(sprintf('O:%d:"%s":0:{}', strlen($f['class']), $f['class'])); + $template = isset($f['object']) ? $f['object'] : unserialize(sprintf('O:%d:"%s":0:{}', \strlen($f['class']), $f['class'])); $ellipsis = 0; $templateSrc = method_exists($template, 'getSourceContext') ? $template->getSourceContext()->getCode() : (method_exists($template, 'getSource') ? $template->getSource() : ''); @@ -231,7 +231,7 @@ public static function castFrameStub(FrameStub $frame, array $a, Stub $stub, $is $src = self::extractSource(file_get_contents($f['file']), $f['line'], self::$srcContext, $caller, 'php', $f['file']); $srcKey .= ':'.$f['line']; if ($ellipsis) { - $ellipsis += 1 + strlen($f['line']); + $ellipsis += 1 + \strlen($f['line']); } } $srcAttr .= '&separator= '; diff --git a/vendor/symfony/var-dumper/Caster/LinkStub.php b/vendor/symfony/var-dumper/Caster/LinkStub.php index 24f360b8f..f32f3420a 100644 --- a/vendor/symfony/var-dumper/Caster/LinkStub.php +++ b/vendor/symfony/var-dumper/Caster/LinkStub.php @@ -30,7 +30,7 @@ public function __construct($label, $line = 0, $href = null) if (null === $href) { $href = $label; } - if (!is_string($href)) { + if (!\is_string($href)) { return; } if (0 === strpos($href, 'file://')) { @@ -53,11 +53,11 @@ public function __construct($label, $line = 0, $href = null) return; } if ($composerRoot = $this->getComposerRoot($href, $this->inVendor)) { - $this->attr['ellipsis'] = strlen($href) - strlen($composerRoot) + 1; + $this->attr['ellipsis'] = \strlen($href) - \strlen($composerRoot) + 1; $this->attr['ellipsis-type'] = 'path'; - $this->attr['ellipsis-tail'] = 1 + ($this->inVendor ? 2 + strlen(implode(array_slice(explode(DIRECTORY_SEPARATOR, substr($href, 1 - $this->attr['ellipsis'])), 0, 2))) : 0); - } elseif (3 < count($ellipsis = explode(DIRECTORY_SEPARATOR, $href))) { - $this->attr['ellipsis'] = 2 + strlen(implode(array_slice($ellipsis, -2))); + $this->attr['ellipsis-tail'] = 1 + ($this->inVendor ? 2 + \strlen(implode('', \array_slice(explode(\DIRECTORY_SEPARATOR, substr($href, 1 - $this->attr['ellipsis'])), 0, 2))) : 0); + } elseif (3 < \count($ellipsis = explode(\DIRECTORY_SEPARATOR, $href))) { + $this->attr['ellipsis'] = 2 + \strlen(implode('', \array_slice($ellipsis, -2))); $this->attr['ellipsis-type'] = 'path'; $this->attr['ellipsis-tail'] = 1; } @@ -71,16 +71,16 @@ private function getComposerRoot($file, &$inVendor) foreach (get_declared_classes() as $class) { if ('C' === $class[0] && 0 === strpos($class, 'ComposerAutoloaderInit')) { $r = new \ReflectionClass($class); - $v = dirname(dirname($r->getFileName())); + $v = \dirname(\dirname($r->getFileName())); if (file_exists($v.'/composer/installed.json')) { - self::$vendorRoots[] = $v.DIRECTORY_SEPARATOR; + self::$vendorRoots[] = $v.\DIRECTORY_SEPARATOR; } } } } $inVendor = false; - if (isset(self::$composerRoots[$dir = dirname($file)])) { + if (isset(self::$composerRoots[$dir = \dirname($file)])) { return self::$composerRoots[$dir]; } @@ -96,13 +96,13 @@ private function getComposerRoot($file, &$inVendor) // open_basedir restriction in effect break; } - if ($parent === dirname($parent)) { + if ($parent === \dirname($parent)) { return self::$composerRoots[$dir] = false; } - $parent = dirname($parent); + $parent = \dirname($parent); } - return self::$composerRoots[$dir] = $parent.DIRECTORY_SEPARATOR; + return self::$composerRoots[$dir] = $parent.\DIRECTORY_SEPARATOR; } } diff --git a/vendor/symfony/var-dumper/Caster/PdoCaster.php b/vendor/symfony/var-dumper/Caster/PdoCaster.php index b86678247..83a001d96 100644 --- a/vendor/symfony/var-dumper/Caster/PdoCaster.php +++ b/vendor/symfony/var-dumper/Caster/PdoCaster.php @@ -70,7 +70,7 @@ public static function castPdo(\PDO $c, array $a, Stub $stub, $isNested) } try { - $attr[$k] = 'ERRMODE' === $k ? $errmode : $c->getAttribute(constant('PDO::ATTR_'.$k)); + $attr[$k] = 'ERRMODE' === $k ? $errmode : $c->getAttribute(\constant('PDO::ATTR_'.$k)); if ($v && isset($v[$attr[$k]])) { $attr[$k] = new ConstStub($v[$attr[$k]], $attr[$k]); } diff --git a/vendor/symfony/var-dumper/Caster/RedisCaster.php b/vendor/symfony/var-dumper/Caster/RedisCaster.php index 07a3a1b09..409a0d48a 100644 --- a/vendor/symfony/var-dumper/Caster/RedisCaster.php +++ b/vendor/symfony/var-dumper/Caster/RedisCaster.php @@ -30,7 +30,7 @@ public static function castRedis(\Redis $c, array $a, Stub $stub, $isNested) { $prefix = Caster::PREFIX_VIRTUAL; - if (defined('HHVM_VERSION_ID')) { + if (\defined('HHVM_VERSION_ID')) { if (isset($a[Caster::PREFIX_PROTECTED.'serializer'])) { $ser = $a[Caster::PREFIX_PROTECTED.'serializer']; $a[Caster::PREFIX_PROTECTED.'serializer'] = isset(self::$serializer[$ser]) ? new ConstStub(self::$serializer[$ser], $ser) : $ser; @@ -46,7 +46,7 @@ public static function castRedis(\Redis $c, array $a, Stub $stub, $isNested) } $ser = $c->getOption(\Redis::OPT_SERIALIZER); - $retry = defined('Redis::OPT_SCAN') ? $c->getOption(\Redis::OPT_SCAN) : 0; + $retry = \defined('Redis::OPT_SCAN') ? $c->getOption(\Redis::OPT_SCAN) : 0; return $a + array( $prefix.'isConnected' => $connected, diff --git a/vendor/symfony/var-dumper/Caster/ReflectionCaster.php b/vendor/symfony/var-dumper/Caster/ReflectionCaster.php index 4634fb915..9bfef0698 100644 --- a/vendor/symfony/var-dumper/Caster/ReflectionCaster.php +++ b/vendor/symfony/var-dumper/Caster/ReflectionCaster.php @@ -39,6 +39,11 @@ public static function castClosure(\Closure $c, array $a, Stub $stub, $isNested, $stub->class = 'Closure'; // HHVM generates unique class names for closures $a = static::castFunctionAbstract($c, $a, $stub, $isNested, $filter); + if (false === strpos($c->name, '{closure}')) { + $stub->class = isset($a[$prefix.'class']) ? $a[$prefix.'class']->value.'::'.$c->name : $c->name; + unset($a[$prefix.'class']); + } + if (isset($a[$prefix.'parameters'])) { foreach ($a[$prefix.'parameters']->value as &$v) { $param = $v; @@ -199,7 +204,7 @@ public static function castFunctionAbstract(\ReflectionFunctionAbstract $c, arra if ($v = $c->getStaticVariables()) { foreach ($v as $k => &$v) { - if (is_object($v)) { + if (\is_object($v)) { $a[$prefix.'use']['$'.$k] = new CutStub($v); } else { $a[$prefix.'use']['$'.$k] = &$v; diff --git a/vendor/symfony/var-dumper/Caster/SplCaster.php b/vendor/symfony/var-dumper/Caster/SplCaster.php index e8be74d60..0780c0a37 100644 --- a/vendor/symfony/var-dumper/Caster/SplCaster.php +++ b/vendor/symfony/var-dumper/Caster/SplCaster.php @@ -29,30 +29,12 @@ class SplCaster public static function castArrayObject(\ArrayObject $c, array $a, Stub $stub, $isNested) { - $prefix = Caster::PREFIX_VIRTUAL; - $class = $stub->class; - $flags = $c->getFlags(); - - $b = array( - $prefix.'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST), - $prefix.'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS), - $prefix.'iteratorClass' => new ClassStub($c->getIteratorClass()), - $prefix.'storage' => $c->getArrayCopy(), - ); - - if ('ArrayObject' === $class) { - $a = $b; - } else { - if (!($flags & \ArrayObject::STD_PROP_LIST)) { - $c->setFlags(\ArrayObject::STD_PROP_LIST); - $a = Caster::castObject($c, $class); - $c->setFlags($flags); - } - - $a += $b; - } + return self::castSplArray($c, $a, $stub, $isNested); + } - return $a; + public static function castArrayIterator(\ArrayIterator $c, array $a, Stub $stub, $isNested) + { + return self::castSplArray($c, $a, $stub, $isNested); } public static function castHeap(\Iterator $c, array $a, Stub $stub, $isNested) @@ -186,7 +168,7 @@ public static function castObjectStorage(\SplObjectStorage $c, array $a, Stub $s $clone = clone $c; foreach ($clone as $obj) { - $storage[spl_object_hash($obj)] = array( + $storage[] = array( 'object' => $obj, 'info' => $clone->getInfo(), ); @@ -205,4 +187,27 @@ public static function castOuterIterator(\OuterIterator $c, array $a, Stub $stub return $a; } + + private static function castSplArray($c, array $a, Stub $stub, $isNested) + { + $prefix = Caster::PREFIX_VIRTUAL; + $class = $stub->class; + $flags = $c->getFlags(); + + if (!($flags & \ArrayObject::STD_PROP_LIST)) { + $c->setFlags(\ArrayObject::STD_PROP_LIST); + $a = Caster::castObject($c, $class); + $c->setFlags($flags); + } + $a += array( + $prefix.'flag::STD_PROP_LIST' => (bool) ($flags & \ArrayObject::STD_PROP_LIST), + $prefix.'flag::ARRAY_AS_PROPS' => (bool) ($flags & \ArrayObject::ARRAY_AS_PROPS), + ); + if ($c instanceof \ArrayObject) { + $a[$prefix.'iteratorClass'] = new ClassStub($c->getIteratorClass()); + } + $a[$prefix.'storage'] = $c->getArrayCopy(); + + return $a; + } } diff --git a/vendor/symfony/var-dumper/Caster/StubCaster.php b/vendor/symfony/var-dumper/Caster/StubCaster.php index 2ec096c5a..b0bf5dc80 100644 --- a/vendor/symfony/var-dumper/Caster/StubCaster.php +++ b/vendor/symfony/var-dumper/Caster/StubCaster.php @@ -30,7 +30,7 @@ public static function castStub(Stub $c, array $a, Stub $stub, $isNested) $stub->cut = $c->cut; $stub->attr = $c->attr; - if (Stub::TYPE_REF === $c->type && !$c->class && is_string($c->value) && !preg_match('//u', $c->value)) { + if (Stub::TYPE_REF === $c->type && !$c->class && \is_string($c->value) && !preg_match('//u', $c->value)) { $stub->type = Stub::TYPE_STRING; $stub->class = Stub::STRING_BINARY; } @@ -49,7 +49,7 @@ public static function castCutArray(CutArrayStub $c, array $a, Stub $stub, $isNe public static function cutInternals($obj, array $a, Stub $stub, $isNested) { if ($isNested) { - $stub->cut += count($a); + $stub->cut += \count($a); return array(); } diff --git a/vendor/symfony/var-dumper/Cloner/AbstractCloner.php b/vendor/symfony/var-dumper/Cloner/AbstractCloner.php index e32469270..5501fc698 100644 --- a/vendor/symfony/var-dumper/Cloner/AbstractCloner.php +++ b/vendor/symfony/var-dumper/Cloner/AbstractCloner.php @@ -95,6 +95,7 @@ abstract class AbstractCloner implements ClonerInterface 'AMQPEnvelope' => array('Symfony\Component\VarDumper\Caster\AmqpCaster', 'castEnvelope'), 'ArrayObject' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayObject'), + 'ArrayIterator' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castArrayIterator'), 'SplDoublyLinkedList' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castDoublyLinkedList'), 'SplFileInfo' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castFileInfo'), 'SplFileObject' => array('Symfony\Component\VarDumper\Caster\SplCaster', 'castFileObject'), @@ -151,7 +152,7 @@ public function __construct(array $casters = null) $casters = static::$defaultCasters; } $this->addCasters($casters); - $this->useExt = extension_loaded('symfony_debug'); + $this->useExt = \extension_loaded('symfony_debug'); } /** @@ -167,7 +168,7 @@ public function __construct(array $casters = null) public function addCasters(array $casters) { foreach ($casters as $type => $callback) { - $this->casters[strtolower($type)][] = is_string($callback) && false !== strpos($callback, '::') ? explode('::', $callback, 2) : $callback; + $this->casters[strtolower($type)][] = \is_string($callback) && false !== strpos($callback, '::') ? explode('::', $callback, 2) : $callback; } } @@ -219,7 +220,7 @@ public function cloneVar($var, $filter = 0) } if ($this->prevErrorHandler) { - return call_user_func($this->prevErrorHandler, $type, $msg, $file, $line, $context); + return \call_user_func($this->prevErrorHandler, $type, $msg, $file, $line, $context); } return false; diff --git a/vendor/symfony/var-dumper/Cloner/Data.php b/vendor/symfony/var-dumper/Cloner/Data.php index 75ded2912..8e4700d84 100644 --- a/vendor/symfony/var-dumper/Cloner/Data.php +++ b/vendor/symfony/var-dumper/Cloner/Data.php @@ -44,7 +44,7 @@ public function getType() $item = $item->value; } if (!$item instanceof Stub) { - return gettype($item); + return \gettype($item); } if (Stub::TYPE_STRING === $item->type) { return 'string'; @@ -63,7 +63,7 @@ public function getType() /** * @param bool $recursive Whether values should be resolved recursively or not * - * @return string|int|float|bool|array|null|Data[] A native representation of the original value + * @return string|int|float|bool|array|Data[]|null A native representation of the original value */ public function getValue($recursive = false) { @@ -106,13 +106,13 @@ public function getValue($recursive = false) public function count() { - return count($this->getValue()); + return \count($this->getValue()); } public function getIterator() { - if (!is_array($value = $this->getValue())) { - throw new \LogicException(sprintf('%s object holds non-iterable type "%s".', self::class, gettype($value))); + if (!\is_array($value = $this->getValue())) { + throw new \LogicException(sprintf('%s object holds non-iterable type "%s".', self::class, \gettype($value))); } foreach ($value as $k => $v) { @@ -158,11 +158,11 @@ public function __toString() { $value = $this->getValue(); - if (!is_array($value)) { + if (!\is_array($value)) { return (string) $value; } - return sprintf('%s (count=%d)', $this->getType(), count($value)); + return sprintf('%s (count=%d)', $this->getType(), \count($value)); } /** @@ -172,7 +172,7 @@ public function __toString() */ public function getRawData() { - @trigger_error(sprintf('The %s() method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the array or object access instead.', __METHOD__)); + @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Use the array or object access instead.', __METHOD__)); return $this->data; } @@ -312,7 +312,7 @@ private function dumpItem($dumper, $cursor, &$refs, $item) $cursor->hardRefCount = $item->refCount; } $cursor->attr = $item->attr; - $type = $item->class ?: gettype($item->value); + $type = $item->class ?: \gettype($item->value); $item = $this->getStub($item->value); } if ($item instanceof Stub) { @@ -334,7 +334,7 @@ private function dumpItem($dumper, $cursor, &$refs, $item) if ($cursor->stop) { if ($cut >= 0) { - $cut += count($children); + $cut += \count($children); } $children = array(); } @@ -363,7 +363,7 @@ private function dumpItem($dumper, $cursor, &$refs, $item) $cut = $this->dumpChildren($dumper, $cursor, $refs, $children, $cut, $item->type, null !== $item->class); } } elseif ($children && 0 <= $cut) { - $cut += count($children); + $cut += \count($children); } $cursor->skipChildren = false; $dumper->leaveHash($cursor, $item->type, $item->class, $withChildren, $cut); @@ -401,7 +401,7 @@ private function dumpChildren($dumper, $parentCursor, &$refs, $children, $hashCu ++$cursor->depth; $cursor->hashType = $hashType; $cursor->hashIndex = 0; - $cursor->hashLength = count($children); + $cursor->hashLength = \count($children); $cursor->hashCut = $hashCut; foreach ($children as $key => $child) { $cursor->hashKeyIsBinary = isset($key[0]) && !preg_match('//u', $key); diff --git a/vendor/symfony/var-dumper/Cloner/VarCloner.php b/vendor/symfony/var-dumper/Cloner/VarCloner.php index 3664609c5..7a3816cf6 100644 --- a/vendor/symfony/var-dumper/Cloner/VarCloner.php +++ b/vendor/symfony/var-dumper/Cloner/VarCloner.php @@ -304,13 +304,13 @@ private static function initHashMask() self::$hashOffset = 16 - PHP_INT_SIZE; self::$hashMask = -1; - if (defined('HHVM_VERSION')) { + if (\defined('HHVM_VERSION')) { self::$hashOffset += 16; } else { // check if we are nested in an output buffering handler to prevent a fatal error with ob_start() below $obFuncs = array('ob_clean', 'ob_end_clean', 'ob_flush', 'ob_end_flush', 'ob_get_contents', 'ob_get_flush'); foreach (debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS) as $frame) { - if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && in_array($frame['function'], $obFuncs)) { + if (isset($frame['function'][0]) && !isset($frame['class']) && 'o' === $frame['function'][0] && \in_array($frame['function'], $obFuncs)) { $frame['line'] = 0; break; } diff --git a/vendor/symfony/var-dumper/Dumper/AbstractDumper.php b/vendor/symfony/var-dumper/Dumper/AbstractDumper.php index e27675ad1..228f8f2e5 100644 --- a/vendor/symfony/var-dumper/Dumper/AbstractDumper.php +++ b/vendor/symfony/var-dumper/Dumper/AbstractDumper.php @@ -49,7 +49,7 @@ public function __construct($output = null, $charset = null, $flags = 0) $this->decimalPoint = localeconv(); $this->decimalPoint = $this->decimalPoint['decimal_point']; $this->setOutput($output ?: static::$defaultOutput); - if (!$output && is_string(static::$defaultOutput)) { + if (!$output && \is_string(static::$defaultOutput)) { static::$defaultOutput = $this->outputStream; } } @@ -65,11 +65,11 @@ public function setOutput($output) { $prev = null !== $this->outputStream ? $this->outputStream : $this->lineDumper; - if (is_callable($output)) { + if (\is_callable($output)) { $this->outputStream = null; $this->lineDumper = $output; } else { - if (is_string($output)) { + if (\is_string($output)) { $output = fopen($output, 'wb'); } $this->outputStream = $output; @@ -164,7 +164,7 @@ public function dump(Data $data, $output = null) */ protected function dumpLine($depth) { - call_user_func($this->lineDumper, $this->line, $depth, $this->indentPad); + \call_user_func($this->lineDumper, $this->line, $depth, $this->indentPad); $this->line = ''; } @@ -195,7 +195,7 @@ protected function utf8Encode($s) return $s; } - if (!function_exists('iconv')) { + if (!\function_exists('iconv')) { throw new \RuntimeException('Unable to convert a non-UTF-8 string to UTF-8: required function iconv() does not exist. You should install ext-iconv or symfony/polyfill-iconv.'); } diff --git a/vendor/symfony/var-dumper/Dumper/CliDumper.php b/vendor/symfony/var-dumper/Dumper/CliDumper.php index f1de350d2..419cfeb49 100644 --- a/vendor/symfony/var-dumper/Dumper/CliDumper.php +++ b/vendor/symfony/var-dumper/Dumper/CliDumper.php @@ -62,7 +62,7 @@ public function __construct($output = null, $charset = null, $flags = 0) { parent::__construct($output, $charset, $flags); - if ('\\' === DIRECTORY_SEPARATOR && !$this->isWindowsTrueColor()) { + if ('\\' === \DIRECTORY_SEPARATOR && !$this->isWindowsTrueColor()) { // Use only the base 16 xterm colors when using ANSICON or standard Windows 10 CLI $this->setStyles(array( 'default' => '31', @@ -186,7 +186,7 @@ public function dumpString(Cursor $cursor, $str, $bin, $cut) unset($str[1]); $str[0] .= "\n"; } - $m = count($str) - 1; + $m = \count($str) - 1; $i = $lineCut = 0; if (self::DUMP_STRING_LENGTH & $this->flags) { @@ -339,7 +339,7 @@ protected function dumpKey(Cursor $cursor) $style = 'index'; // no break case Cursor::HASH_ASSOC: - if (is_int($key)) { + if (\is_int($key)) { $this->line .= $this->style($style, $key).' => '; } else { $this->line .= $bin.'"'.$this->style($style, $key).'" => '; @@ -417,8 +417,8 @@ protected function style($style, $value, $attr = array()) if (isset($attr['ellipsis'], $attr['ellipsis-type'])) { $prefix = substr($value, 0, -$attr['ellipsis']); - if ('cli' === PHP_SAPI && 'path' === $attr['ellipsis-type'] && isset($_SERVER[$pwd = '\\' === DIRECTORY_SEPARATOR ? 'CD' : 'PWD']) && 0 === strpos($prefix, $_SERVER[$pwd])) { - $prefix = '.'.substr($prefix, strlen($_SERVER[$pwd])); + if ('cli' === \PHP_SAPI && 'path' === $attr['ellipsis-type'] && isset($_SERVER[$pwd = '\\' === \DIRECTORY_SEPARATOR ? 'CD' : 'PWD']) && 0 === strpos($prefix, $_SERVER[$pwd])) { + $prefix = '.'.substr($prefix, \strlen($_SERVER[$pwd])); } if (!empty($attr['ellipsis-tail'])) { $prefix .= substr($value, -$attr['ellipsis'], $attr['ellipsis-tail']); @@ -439,7 +439,7 @@ protected function style($style, $value, $attr = array()) $s = $startCchr; $c = $c[$i = 0]; do { - $s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', ord($c[$i])); + $s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i])); } while (isset($c[++$i])); return $s.$endCchr; @@ -447,12 +447,12 @@ protected function style($style, $value, $attr = array()) if ($this->colors) { if ($cchrCount && "\033" === $value[0]) { - $value = substr($value, strlen($startCchr)); + $value = substr($value, \strlen($startCchr)); } else { $value = "\033[{$style}m".$value; } - if ($cchrCount && $endCchr === substr($value, -strlen($endCchr))) { - $value = substr($value, 0, -strlen($endCchr)); + if ($cchrCount && $endCchr === substr($value, -\strlen($endCchr))) { + $value = substr($value, 0, -\strlen($endCchr)); } else { $value .= "\033[{$this->styles['default']}m"; } @@ -474,7 +474,7 @@ protected function supportsColors() } if (isset($_SERVER['argv'][1])) { $colors = $_SERVER['argv']; - $i = count($colors); + $i = \count($colors); while (--$i > 0) { if (isset($colors[$i][5])) { switch ($colors[$i]) { @@ -537,23 +537,27 @@ protected function endValue(Cursor $cursor) */ private function hasColorSupport($stream) { - if (!is_resource($stream) || 'stream' !== get_resource_type($stream)) { + if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) { return false; } - if (DIRECTORY_SEPARATOR === '\\') { - return (function_exists('sapi_windows_vt100_support') + if ('Hyper' === getenv('TERM_PROGRAM')) { + return true; + } + + if (\DIRECTORY_SEPARATOR === '\\') { + return (\function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support($stream)) || false !== getenv('ANSICON') || 'ON' === getenv('ConEmuANSI') || 'xterm' === getenv('TERM'); } - if (function_exists('stream_isatty')) { + if (\function_exists('stream_isatty')) { return @stream_isatty($stream); } - if (function_exists('posix_isatty')) { + if (\function_exists('posix_isatty')) { return @posix_isatty($stream); } @@ -575,9 +579,10 @@ private function isWindowsTrueColor() { $result = 183 <= getenv('ANSICON_VER') || 'ON' === getenv('ConEmuANSI') - || 'xterm' === getenv('TERM'); + || 'xterm' === getenv('TERM') + || 'Hyper' === getenv('TERM_PROGRAM'); - if (!$result && PHP_VERSION_ID >= 70200) { + if (!$result && \PHP_VERSION_ID >= 70200) { $version = sprintf( '%s.%s.%s', PHP_WINDOWS_VERSION_MAJOR, diff --git a/vendor/symfony/var-dumper/Dumper/HtmlDumper.php b/vendor/symfony/var-dumper/Dumper/HtmlDumper.php index 2ba7ebf57..d498e12f8 100644 --- a/vendor/symfony/var-dumper/Dumper/HtmlDumper.php +++ b/vendor/symfony/var-dumper/Dumper/HtmlDumper.php @@ -826,10 +826,10 @@ protected function style($style, $value, $attr = array()) } $label = esc(substr($value, -$attr['ellipsis'])); $style = str_replace(' title="', " title=\"$v\n", $style); - $v = sprintf('%s', $class, substr($v, 0, -strlen($label))); + $v = sprintf('%s', $class, substr($v, 0, -\strlen($label))); if (!empty($attr['ellipsis-tail'])) { - $tail = strlen(esc(substr($value, -$attr['ellipsis'], $attr['ellipsis-tail']))); + $tail = \strlen(esc(substr($value, -$attr['ellipsis'], $attr['ellipsis-tail']))); $v .= sprintf('%s%s', substr($label, 0, $tail), substr($label, $tail)); } else { $v .= $label; @@ -840,7 +840,7 @@ protected function style($style, $value, $attr = array()) $s = ''; $c = $c[$i = 0]; do { - $s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', ord($c[$i])); + $s .= isset($map[$c[$i]]) ? $map[$c[$i]] : sprintf('\x%02X', \ord($c[$i])); } while (isset($c[++$i])); return $s.''; @@ -895,7 +895,7 @@ private function getSourceLink($file, $line) $options = $this->extraDisplayOptions + $this->displayOptions; if ($fmt = $options['fileLinkFormat']) { - return is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line); + return \is_string($fmt) ? strtr($fmt, array('%f' => $file, '%l' => $line)) : $fmt->format($file, $line); } return false; diff --git a/vendor/symfony/var-dumper/Exception/ThrowingCasterException.php b/vendor/symfony/var-dumper/Exception/ThrowingCasterException.php index 976f4439b..af47753ad 100644 --- a/vendor/symfony/var-dumper/Exception/ThrowingCasterException.php +++ b/vendor/symfony/var-dumper/Exception/ThrowingCasterException.php @@ -21,6 +21,6 @@ class ThrowingCasterException extends \Exception */ public function __construct(\Exception $prev) { - parent::__construct('Unexpected '.get_class($prev).' thrown from a caster: '.$prev->getMessage(), 0, $prev); + parent::__construct('Unexpected '.\get_class($prev).' thrown from a caster: '.$prev->getMessage(), 0, $prev); } } diff --git a/vendor/symfony/var-dumper/Resources/functions/dump.php b/vendor/symfony/var-dumper/Resources/functions/dump.php index 95d8bb598..0e0e4d043 100644 --- a/vendor/symfony/var-dumper/Resources/functions/dump.php +++ b/vendor/symfony/var-dumper/Resources/functions/dump.php @@ -17,8 +17,8 @@ */ function dump($var) { - foreach (func_get_args() as $var) { - VarDumper::dump($var); + foreach (func_get_args() as $v) { + VarDumper::dump($v); } if (1 < func_num_args()) { diff --git a/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php b/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php index 0fffd5512..aae113b6c 100644 --- a/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php +++ b/vendor/symfony/var-dumper/Test/VarDumperTestTrait.php @@ -21,8 +21,8 @@ trait VarDumperTestTrait { public function assertDumpEquals($dump, $data, $filter = 0, $message = '') { - if (is_string($filter)) { - @trigger_error(sprintf('The $message argument of the "%s()" method at 3rd position is deprecated since Symfony 3.4 and will be moved at 4th position in 4.0.', __METHOD__), E_USER_DEPRECATED); + if (\is_string($filter)) { + @trigger_error(sprintf('The $message argument of the "%s()" method at the 3rd position is deprecated since Symfony 3.4 and will be moved at the 4th position in 4.0.', __METHOD__), E_USER_DEPRECATED); $message = $filter; $filter = 0; } @@ -32,8 +32,8 @@ public function assertDumpEquals($dump, $data, $filter = 0, $message = '') public function assertDumpMatchesFormat($dump, $data, $filter = 0, $message = '') { - if (is_string($filter)) { - @trigger_error(sprintf('The $message argument of the "%s()" method at 3rd position is deprecated since Symfony 3.4 and will be moved at 4th position in 4.0.', __METHOD__), E_USER_DEPRECATED); + if (\is_string($filter)) { + @trigger_error(sprintf('The $message argument of the "%s()" method at the 3rd position is deprecated since Symfony 3.4 and will be moved at the 4th position in 4.0.', __METHOD__), E_USER_DEPRECATED); $message = $filter; $filter = 0; } diff --git a/vendor/symfony/var-dumper/Tests/Caster/DateCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/DateCasterTest.php index 96c167d3e..dafa16cdd 100644 --- a/vendor/symfony/var-dumper/Tests/Caster/DateCasterTest.php +++ b/vendor/symfony/var-dumper/Tests/Caster/DateCasterTest.php @@ -29,7 +29,7 @@ class DateCasterTest extends TestCase */ public function testDumpDateTime($time, $timezone, $xDate, $xTimestamp) { - if ((defined('HHVM_VERSION_ID') || PHP_VERSION_ID <= 50509) && preg_match('/[-+]\d{2}:\d{2}/', $timezone)) { + if ((\defined('HHVM_VERSION_ID') || \PHP_VERSION_ID <= 50509) && preg_match('/[-+]\d{2}:\d{2}/', $timezone)) { $this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.'); } @@ -49,7 +49,7 @@ public function testDumpDateTime($time, $timezone, $xDate, $xTimestamp) */ public function testCastDateTime($time, $timezone, $xDate, $xTimestamp, $xInfos) { - if ((defined('HHVM_VERSION_ID') || PHP_VERSION_ID <= 50509) && preg_match('/[-+]\d{2}:\d{2}/', $timezone)) { + if ((\defined('HHVM_VERSION_ID') || \PHP_VERSION_ID <= 50509) && preg_match('/[-+]\d{2}:\d{2}/', $timezone)) { $this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.'); } @@ -102,7 +102,7 @@ public function provideDateTimes() */ public function testDumpInterval($intervalSpec, $ms, $invert, $expected) { - if ($ms && PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) { + if ($ms && \PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) { $this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.'); } @@ -122,7 +122,7 @@ public function testDumpInterval($intervalSpec, $ms, $invert, $expected) */ public function testDumpIntervalExcludingVerbosity($intervalSpec, $ms, $invert, $expected) { - if ($ms && PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) { + if ($ms && \PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) { $this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.'); } @@ -142,7 +142,7 @@ public function testDumpIntervalExcludingVerbosity($intervalSpec, $ms, $invert, */ public function testCastInterval($intervalSpec, $ms, $invert, $xInterval, $xSeconds) { - if ($ms && PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) { + if ($ms && \PHP_VERSION_ID >= 70200 && version_compare(PHP_VERSION, '7.2.0rc3', '<=')) { $this->markTestSkipped('Skipped on 7.2 before rc4 because of php bug #75354.'); } @@ -220,7 +220,7 @@ public function provideIntervals() */ public function testDumpTimeZone($timezone, $expected) { - if ((defined('HHVM_VERSION_ID') || PHP_VERSION_ID <= 50509) && !preg_match('/\w+\/\w+/', $timezone)) { + if ((\defined('HHVM_VERSION_ID') || \PHP_VERSION_ID <= 50509) && !preg_match('/\w+\/\w+/', $timezone)) { $this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.'); } @@ -240,7 +240,7 @@ public function testDumpTimeZone($timezone, $expected) */ public function testDumpTimeZoneExcludingVerbosity($timezone, $expected) { - if ((defined('HHVM_VERSION_ID') || PHP_VERSION_ID <= 50509) && !preg_match('/\w+\/\w+/', $timezone)) { + if ((\defined('HHVM_VERSION_ID') || \PHP_VERSION_ID <= 50509) && !preg_match('/\w+\/\w+/', $timezone)) { $this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.'); } @@ -260,7 +260,7 @@ public function testDumpTimeZoneExcludingVerbosity($timezone, $expected) */ public function testCastTimeZone($timezone, $xTimezone, $xRegion) { - if ((defined('HHVM_VERSION_ID') || PHP_VERSION_ID <= 50509) && !preg_match('/\w+\/\w+/', $timezone)) { + if ((\defined('HHVM_VERSION_ID') || \PHP_VERSION_ID <= 50509) && !preg_match('/\w+\/\w+/', $timezone)) { $this->markTestSkipped('DateTimeZone GMT offsets are supported since 5.5.10. See https://github.com/facebook/hhvm/issues/5875 for HHVM.'); } @@ -295,7 +295,7 @@ public function testCastTimeZone($timezone, $xTimezone, $xRegion) public function provideTimeZones() { - $xRegion = extension_loaded('intl') ? '%s' : ''; + $xRegion = \extension_loaded('intl') ? '%s' : ''; return array( // type 1 (UTC offset) @@ -325,11 +325,11 @@ public function provideTimeZones() */ public function testDumpPeriod($start, $interval, $end, $options, $expected) { - if (defined('HHVM_VERSION_ID') || \PHP_VERSION_ID < 50620 || (\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70005)) { + if (\defined('HHVM_VERSION_ID') || \PHP_VERSION_ID < 50620 || (\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70005)) { $this->markTestSkipped(); } - $p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), is_int($end) ? $end : new \DateTime($end), $options); + $p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), \is_int($end) ? $end : new \DateTime($end), $options); $xDump = <<= 70000 && \PHP_VERSION_ID < 70005)) { + if (\defined('HHVM_VERSION_ID') || \PHP_VERSION_ID < 50620 || (\PHP_VERSION_ID >= 70000 && \PHP_VERSION_ID < 70005)) { $this->markTestSkipped(); } - $p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), is_int($end) ? $end : new \DateTime($end), $options); + $p = new \DatePeriod(new \DateTime($start), new \DateInterval($interval), \is_int($end) ? $end : new \DateTime($end), $options); $stub = new Stub(); $cast = DateCaster::castPeriod($p, array(), $stub, false, 0); diff --git a/vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php index c9cc24f2d..4f9b538a0 100644 --- a/vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php +++ b/vendor/symfony/var-dumper/Tests/Caster/ExceptionCasterTest.php @@ -164,16 +164,16 @@ public function testHtmlDump() */ public function testFrameWithTwig() { - require_once dirname(__DIR__).'/Fixtures/Twig.php'; + require_once \dirname(__DIR__).'/Fixtures/Twig.php'; $f = array( new FrameStub(array( - 'file' => dirname(__DIR__).'/Fixtures/Twig.php', + 'file' => \dirname(__DIR__).'/Fixtures/Twig.php', 'line' => 20, 'class' => '__TwigTemplate_VarDumperFixture_u75a09', )), new FrameStub(array( - 'file' => dirname(__DIR__).'/Fixtures/Twig.php', + 'file' => \dirname(__DIR__).'/Fixtures/Twig.php', 'line' => 21, 'class' => '__TwigTemplate_VarDumperFixture_u75a09', 'object' => new \__TwigTemplate_VarDumperFixture_u75a09(null, __FILE__), diff --git a/vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php index 80acdb667..ed14494ec 100644 --- a/vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php +++ b/vendor/symfony/var-dumper/Tests/Caster/RedisCasterTest.php @@ -26,7 +26,7 @@ public function testNotConnected() { $redis = new \Redis(); - if (defined('HHVM_VERSION_ID')) { + if (\defined('HHVM_VERSION_ID')) { $xCast = <<<'EODUMP' Redis { #host: "" @@ -52,7 +52,7 @@ public function testConnected() self::markTestSkipped($e['message']); } - if (defined('HHVM_VERSION_ID')) { + if (\defined('HHVM_VERSION_ID')) { $xCast = <<<'EODUMP' Redis { #host: "127.0.0.1" diff --git a/vendor/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php index 71eecc1aa..4e6759155 100644 --- a/vendor/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php +++ b/vendor/symfony/var-dumper/Tests/Caster/ReflectionCasterTest.php @@ -85,6 +85,34 @@ public function testClosureCaster() ); } + public function testFromCallableClosureCaster() + { + if (\defined('HHVM_VERSION_ID')) { + $this->markTestSkipped('Not for HHVM.'); + } + $var = array( + (new \ReflectionMethod($this, __FUNCTION__))->getClosure($this), + (new \ReflectionMethod(__CLASS__, 'tearDownAfterClass'))->getClosure(), + ); + + $this->assertDumpMatchesFormat( + << Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest::testFromCallableClosureCaster { + this: Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest { …} + file: "%sReflectionCasterTest.php" + line: "%d to %d" + } + 1 => %sTestCase::tearDownAfterClass { + file: "%sTestCase.php" + line: "%d to %d" + } +] +EOTXT + , $var + ); + } + public function testClosureCasterExcludingVerbosity() { $var = function () {}; @@ -163,7 +191,7 @@ class: "Symfony\Component\VarDumper\Tests\Caster\ReflectionCasterTest" */ public function testGenerator() { - if (extension_loaded('xdebug')) { + if (\extension_loaded('xdebug')) { $this->markTestSkipped('xdebug is active'); } diff --git a/vendor/symfony/var-dumper/Tests/Caster/SplCasterTest.php b/vendor/symfony/var-dumper/Tests/Caster/SplCasterTest.php index 48531562d..d3c9ec25f 100644 --- a/vendor/symfony/var-dumper/Tests/Caster/SplCasterTest.php +++ b/vendor/symfony/var-dumper/Tests/Caster/SplCasterTest.php @@ -163,4 +163,51 @@ public function testCastObjectStorageDumpsInfo() $this->assertDumpMatchesFormat('%ADateTime%A', $var); } + + public function testCastArrayObject() + { + if (\defined('HHVM_VERSION')) { + $this->markTestSkipped('HHVM as different internal details.'); + } + $var = new \ArrayObject(array(123)); + $var->foo = 234; + + $expected = << 123 + ] +} +EOTXT; + $this->assertDumpEquals($expected, $var); + } + + public function testArrayIterator() + { + if (\defined('HHVM_VERSION')) { + $this->markTestSkipped('HHVM as different internal details.'); + } + $var = new MyArrayIterator(array(234)); + + $expected = << 234 + ] +} +EOTXT; + $this->assertDumpEquals($expected, $var); + } +} + +class MyArrayIterator extends \ArrayIterator +{ + private $foo = 123; } diff --git a/vendor/symfony/var-dumper/Tests/Cloner/DataTest.php b/vendor/symfony/var-dumper/Tests/Cloner/DataTest.php index 83f6b6007..d10951be9 100644 --- a/vendor/symfony/var-dumper/Tests/Cloner/DataTest.php +++ b/vendor/symfony/var-dumper/Tests/Cloner/DataTest.php @@ -26,14 +26,14 @@ public function testBasicData() $clonedValues = array(); $this->assertInstanceOf(Data::class, $data); - $this->assertCount(count($values), $data); + $this->assertCount(\count($values), $data); $this->assertFalse(isset($data->{0})); $this->assertFalse(isset($data[0])); foreach ($data as $k => $v) { $this->assertTrue(isset($data->{$k})); $this->assertTrue(isset($data[$k])); - $this->assertSame(gettype($values[$k]), $data->seek($k)->getType()); + $this->assertSame(\gettype($values[$k]), $data->seek($k)->getType()); $this->assertSame($values[$k], $data->seek($k)->getValue()); $this->assertSame($values[$k], $data->{$k}); $this->assertSame($values[$k], $data[$k]); diff --git a/vendor/symfony/var-dumper/Tests/Dumper/CliDumperTest.php b/vendor/symfony/var-dumper/Tests/Dumper/CliDumperTest.php index 88c7f3008..298c33e62 100644 --- a/vendor/symfony/var-dumper/Tests/Dumper/CliDumperTest.php +++ b/vendor/symfony/var-dumper/Tests/Dumper/CliDumperTest.php @@ -48,7 +48,7 @@ public function testGet() $intMax = PHP_INT_MAX; $res = (int) $var['res']; - $r = defined('HHVM_VERSION') ? '' : '#%d'; + $r = \defined('HHVM_VERSION') ? '' : '#%d'; $this->assertStringMatchesFormat( <<markTestSkipped(); } @@ -384,7 +384,7 @@ public function testThrowingCaster() $dumper->dump($data, $out); $out = stream_get_contents($out, -1, 0); - $r = defined('HHVM_VERSION') ? '' : '#%d'; + $r = \defined('HHVM_VERSION') ? '' : '#%d'; $this->assertStringMatchesFormat( <<cloneVar($var); $out = $dumper->dump($data, true); - $r = defined('HHVM_VERSION') ? '' : '#%d'; + $r = \defined('HHVM_VERSION') ? '' : '#%d'; $this->assertStringMatchesFormat( << + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\VarDumper\Tests\Dumper; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\VarDumper\Cloner\VarCloner; +use Symfony\Component\VarDumper\Dumper\CliDumper; +use Symfony\Component\VarDumper\VarDumper; + +class FunctionsTest extends TestCase +{ + public function testDumpReturnsFirstArg() + { + $this->setupVarDumper(); + + $var1 = 'a'; + + ob_start(); + $return = dump($var1); + $out = ob_get_clean(); + + $this->assertEquals($var1, $return); + } + + public function testDumpReturnsAllArgsInArray() + { + $this->setupVarDumper(); + + $var1 = 'a'; + $var2 = 'b'; + $var3 = 'c'; + + ob_start(); + $return = dump($var1, $var2, $var3); + $out = ob_get_clean(); + + $this->assertEquals(array($var1, $var2, $var3), $return); + } + + protected function setupVarDumper() + { + $cloner = new VarCloner(); + $dumper = new CliDumper('php://output'); + VarDumper::setHandler(function ($var) use ($cloner, $dumper) { + $dumper->dump($cloner->cloneVar($var)); + }); + } +} diff --git a/vendor/symfony/var-dumper/Tests/Dumper/HtmlDumperTest.php b/vendor/symfony/var-dumper/Tests/Dumper/HtmlDumperTest.php index eac82644f..98ca471ac 100644 --- a/vendor/symfony/var-dumper/Tests/Dumper/HtmlDumperTest.php +++ b/vendor/symfony/var-dumper/Tests/Dumper/HtmlDumperTest.php @@ -51,7 +51,7 @@ public function testGet() $dumpId = $dumpId[0]; $res = (int) $var['res']; - $r = defined('HHVM_VERSION') ? '' : '#%d'; + $r = \defined('HHVM_VERSION') ? '' : '#%d'; $this->assertStringMatchesFormat( <<array:24 [ diff --git a/vendor/symfony/var-dumper/VarDumper.php b/vendor/symfony/var-dumper/VarDumper.php index 137c47478..a9ed05b3b 100644 --- a/vendor/symfony/var-dumper/VarDumper.php +++ b/vendor/symfony/var-dumper/VarDumper.php @@ -29,13 +29,13 @@ public static function dump($var) { if (null === self::$handler) { $cloner = new VarCloner(); - $dumper = \in_array(PHP_SAPI, array('cli', 'phpdbg'), true) ? new CliDumper() : new HtmlDumper(); + $dumper = \in_array(\PHP_SAPI, array('cli', 'phpdbg'), true) ? new CliDumper() : new HtmlDumper(); self::$handler = function ($var) use ($cloner, $dumper) { $dumper->dump($cloner->cloneVar($var)); }; } - return call_user_func(self::$handler, $var); + return \call_user_func(self::$handler, $var); } public static function setHandler(callable $callable = null) diff --git a/vendor/symfony/var-dumper/phpunit.xml.dist b/vendor/symfony/var-dumper/phpunit.xml.dist index 4a25f42db..3243fcd02 100644 --- a/vendor/symfony/var-dumper/phpunit.xml.dist +++ b/vendor/symfony/var-dumper/phpunit.xml.dist @@ -1,7 +1,7 @@ echo; echo "Running php lint"; - find . -name \*.php ! -path "./vendor/*" | parallel --gnu php -d display_errors=stderr -l {} > /dev/null \; + find . -name \*.php ! -path "./vendor/*" | xargs -n1 php -d display_errors=stderr -l diff --git a/vendor/typo3/class-alias-loader/README.md b/vendor/typo3/class-alias-loader/README.md index 13bebdcb6..a7d1f2075 100644 --- a/vendor/typo3/class-alias-loader/README.md +++ b/vendor/typo3/class-alias-loader/README.md @@ -17,7 +17,7 @@ is loaded and the alias is established, so that third party packages can use old ## Configuration in composer.json -You can define multiple class alias map files in the extra section of the `omposer.json` like this: +You can define multiple class alias map files in the extra section of the `composer.json` like this: ``` "extra": { @@ -36,6 +36,21 @@ Such a mapping file can look like this: \TYPO3\CMS\About\Controller\AboutController::class, + 'Tx_About_Domain_Model_Extension' => \TYPO3\CMS\About\Domain\Model\Extension::class, + 'Tx_About_Domain_Repository_ExtensionRepository' => \TYPO3\CMS\About\Domain\Repository\ExtensionRepository::class, + 'Tx_Aboutmodules_Controller_ModulesController' => \TYPO3\CMS\Aboutmodules\Controller\ModulesController::class, +); +``` + +The '::class' constant is not available before PHP 5.5. Under a PHP before 5.5 the mapping file can look like this: + +``` + 'TYPO3\\CMS\\About\\Controller\\AboutController', + 'Tx_About_Domain_Model_Extension' => 'TYPO3\\CMS\\About\\Domain\\Model\\Extension', + 'Tx_About_Domain_Repository_ExtensionRepository' => 'TYPO3\\CMS\\About\\Domain\\Repository\\ExtensionRepository', + 'Tx_Aboutmodules_Controller_ModulesController' => 'TYPO3\\CMS\\Aboutmodules\\Controller\\ModulesController', ); ``` diff --git a/vendor/typo3/class-alias-loader/composer.json b/vendor/typo3/class-alias-loader/composer.json index c3b6efa50..27fb834a8 100644 --- a/vendor/typo3/class-alias-loader/composer.json +++ b/vendor/typo3/class-alias-loader/composer.json @@ -26,7 +26,7 @@ "require-dev": { "composer/composer": "dev-master", "mikey179/vfsStream": "1.4.*@dev", - "phpunit/phpunit": "~4.7.0" + "phpunit/phpunit": "^4.8" }, "replace": { "helhum/class-alias-loader": "*" diff --git a/vendor/typo3/class-alias-loader/src/ClassAliasMapGenerator.php b/vendor/typo3/class-alias-loader/src/ClassAliasMapGenerator.php index 18113c16d..164f98c08 100644 --- a/vendor/typo3/class-alias-loader/src/ClassAliasMapGenerator.php +++ b/vendor/typo3/class-alias-loader/src/ClassAliasMapGenerator.php @@ -117,7 +117,7 @@ public function generateAliasMap() } $caseSensitiveClassLoadingString = $caseSensitiveClassLoading ? 'true' : 'false'; - $this->IO->write('Generating ' . ($classAliasMappingFound ? ' ' : 'empty ') . 'class alias map file'); + $this->IO->write('Generating ' . ($classAliasMappingFound ? '' : 'empty ') . 'class alias map file'); $this->generateAliasMapFile($aliasToClassNameMapping, $classNameToAliasMapping, $targetDir); $suffix = null; diff --git a/vendor/vlucas/phpdotenv/composer.json b/vendor/vlucas/phpdotenv/composer.json index 2abf464f6..2db50fef4 100644 --- a/vendor/vlucas/phpdotenv/composer.json +++ b/vendor/vlucas/phpdotenv/composer.json @@ -2,7 +2,7 @@ "name": "vlucas/phpdotenv", "description": "Loads environment variables from `.env` to `getenv()`, `$_ENV` and `$_SERVER` automagically.", "keywords": ["env", "dotenv", "environment"], - "license" : "BSD-3-Clause-Attribution", + "license" : "BSD-3-Clause", "authors" : [ { "name": "Vance Lucas", @@ -14,7 +14,7 @@ "php": ">=5.3.9" }, "require-dev": { - "phpunit/phpunit": "^4.8 || ^5.0" + "phpunit/phpunit": "^4.8.35 || ^5.0" }, "autoload": { "psr-4": { @@ -23,7 +23,7 @@ }, "extra": { "branch-alias": { - "dev-master": "2.4-dev" + "dev-master": "2.5-dev" } } } diff --git a/vendor/vlucas/phpdotenv/src/Dotenv.php b/vendor/vlucas/phpdotenv/src/Dotenv.php index e77802f57..22fc0f18b 100644 --- a/vendor/vlucas/phpdotenv/src/Dotenv.php +++ b/vendor/vlucas/phpdotenv/src/Dotenv.php @@ -2,6 +2,8 @@ namespace Dotenv; +use Dotenv\Exception\InvalidPathException; + /** * This is the dotenv class. * @@ -48,6 +50,21 @@ public function load() return $this->loadData(); } + /** + * Load environment file in given directory, suppress InvalidPathException. + * + * @return array + */ + public function safeLoad() + { + try { + return $this->loadData(); + } catch (InvalidPathException $e) { + // suppressing exception + return array(); + } + } + /** * Load environment file in given directory. * @@ -86,9 +103,7 @@ protected function getFilePath($path, $file) */ protected function loadData($overload = false) { - $this->loader = new Loader($this->filePath, !$overload); - - return $this->loader->load(); + return $this->loader->setImmutable(!$overload)->load(); } /** @@ -102,4 +117,14 @@ public function required($variable) { return new Validator((array) $variable, $this->loader); } + + /** + * Get the list of environment variables declared inside the 'env' file. + * + * @return array + */ + public function getEnvironmentVariableNames() + { + return $this->loader->variableNames; + } } diff --git a/vendor/vlucas/phpdotenv/src/Loader.php b/vendor/vlucas/phpdotenv/src/Loader.php index 7f11ffd99..cb3508fac 100644 --- a/vendor/vlucas/phpdotenv/src/Loader.php +++ b/vendor/vlucas/phpdotenv/src/Loader.php @@ -28,6 +28,13 @@ class Loader */ protected $immutable; + /** + * The list of environment variables declared inside the 'env' file. + * + * @var array + */ + public $variableNames = array(); + /** * Create a new loader instance. * @@ -42,6 +49,29 @@ public function __construct($filePath, $immutable = false) $this->immutable = $immutable; } + /** + * Set immutable value. + * + * @param bool $immutable + * @return $this + */ + public function setImmutable($immutable = false) + { + $this->immutable = $immutable; + + return $this; + } + + /** + * Get immutable value. + * + * @return bool + */ + public function getImmutable() + { + return $this->immutable; + } + /** * Load `.env` file in given directory. * @@ -92,9 +122,7 @@ protected function ensureFileIsReadable() */ protected function normaliseEnvironmentVariable($name, $value) { - list($name, $value) = $this->splitCompoundStringIntoParts($name, $value); - list($name, $value) = $this->sanitiseVariableName($name, $value); - list($name, $value) = $this->sanitiseVariableValue($name, $value); + list($name, $value) = $this->processFilters($name, $value); $value = $this->resolveNestedVariables($value); @@ -104,7 +132,7 @@ protected function normaliseEnvironmentVariable($name, $value) /** * Process the runtime filters. * - * Called from the `VariableFactory`, passed as a callback in `$this->loadFromFile()`. + * Called from `normaliseEnvironmentVariable` and the `VariableFactory`, passed as a callback in `$this->loadFromFile()`. * * @param string $name * @param string $value @@ -147,7 +175,9 @@ protected function readLinesFromFile($filePath) */ protected function isComment($line) { - return strpos(ltrim($line), '#') === 0; + $line = ltrim($line); + + return isset($line[0]) && $line[0] === '#'; } /** @@ -203,16 +233,16 @@ protected function sanitiseVariableValue($name, $value) $quote = $value[0]; $regexPattern = sprintf( '/^ - %1$s # match a quote at the start of the value - ( # capturing sub-pattern used - (?: # we do not need to capture this - [^%1$s\\\\] # any character other than a quote or backslash - |\\\\\\\\ # or two backslashes together - |\\\\%1$s # or an escaped quote e.g \" - )* # as many characters that match the previous rules - ) # end of the capturing sub-pattern - %1$s # and the closing quote - .*$ # and discard any string after the closing quote + %1$s # match a quote at the start of the value + ( # capturing sub-pattern used + (?: # we do not need to capture this + [^%1$s\\\\]* # any character other than a quote or backslash + |\\\\\\\\ # or two backslashes together + |\\\\%1$s # or an escaped quote e.g \" + )* # as many characters that match the previous rules + ) # end of the capturing sub-pattern + %1$s # and the closing quote + .*$ # and discard any string after the closing quote /mx', $quote ); @@ -225,7 +255,12 @@ protected function sanitiseVariableValue($name, $value) // Unquoted values cannot contain whitespace if (preg_match('/\s+/', $value) > 0) { - throw new InvalidFileException('Dotenv values containing spaces must be surrounded by quotes.'); + // Check if value is a comment (usually triggered when empty value with comment) + if (preg_match('/^#/', $value) > 0) { + $value = ''; + } else { + throw new InvalidFileException('Dotenv values containing spaces must be surrounded by quotes.'); + } } } @@ -235,7 +270,7 @@ protected function sanitiseVariableValue($name, $value) /** * Resolve the nested variables. * - * Look for {$varname} patterns in the variable value and replace with an + * Look for ${varname} patterns in the variable value and replace with an * existing environment variable. * * @param string $value @@ -247,7 +282,7 @@ protected function resolveNestedVariables($value) if (strpos($value, '$') !== false) { $loader = $this; $value = preg_replace_callback( - '/\${([a-zA-Z0-9_]+)}/', + '/\${([a-zA-Z0-9_.]+)}/', function ($matchedPatterns) use ($loader) { $nestedVariable = $loader->getEnvironmentVariable($matchedPatterns[1]); if ($nestedVariable === null) { @@ -287,7 +322,7 @@ protected function sanitiseVariableName($name, $value) */ protected function beginsWithAQuote($value) { - return strpbrk($value[0], '"\'') !== false; + return isset($value[0]) && ($value[0] === '"' || $value[0] === '\''); } /** @@ -329,6 +364,8 @@ public function setEnvironmentVariable($name, $value = null) { list($name, $value) = $this->normaliseEnvironmentVariable($name, $value); + $this->variableNames[] = $name; + // Don't overwrite existing environment variables if we're immutable // Ruby's dotenv does this with `ENV[key] ||= value`. if ($this->immutable && $this->getEnvironmentVariable($name) !== null) { diff --git a/vendor/vlucas/phpdotenv/src/Validator.php b/vendor/vlucas/phpdotenv/src/Validator.php index aa3cb0e40..53a7fd5af 100644 --- a/vendor/vlucas/phpdotenv/src/Validator.php +++ b/vendor/vlucas/phpdotenv/src/Validator.php @@ -77,6 +77,25 @@ function ($value) { ); } + /** + * Assert that each specified variable is a boolean. + * + * @return \Dotenv\Validator + */ + public function isBoolean() + { + return $this->assertCallback( + function ($value) { + if ($value === '') { + return false; + } + + return (filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE) !== NULL); + }, + 'is not a boolean' + ); + } + /** * Assert that each variable is amongst the given choices. * diff --git a/workflow/engine/classes/ActionsByEmailCoreClass.php b/workflow/engine/classes/ActionsByEmailCoreClass.php index 6f956d48e..a52f45e44 100644 --- a/workflow/engine/classes/ActionsByEmailCoreClass.php +++ b/workflow/engine/classes/ActionsByEmailCoreClass.php @@ -1,6 +1,6 @@ createAppDelegation() + * @link https://wiki.processmaker.com/3.3/Actions_by_Email */ public function sendActionsByEmail($data, $dataAbe) { @@ -131,21 +138,8 @@ public function sendActionsByEmail($data, $dataAbe) $_SESSION['CURRENT_DYN_UID'] = $configuration['DYN_UID']; $__ABE__ = ''; - $conf = new Configurations(); - $envSkin = defined("SYS_SKIN") ? SYS_SKIN : $conf->getConfiguration('SKIN_CRON', ''); - $envHost = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : SERVER_NAME; - $envProtocol = defined("REQUEST_SCHEME") && REQUEST_SCHEME === "https"; - if (isset($_SERVER['SERVER_PORT'])) { - $envPort = ($_SERVER['SERVER_PORT'] != "80") ? ":" . $_SERVER['SERVER_PORT'] : ""; - } else if (defined('SERVER_PORT')) { - $envPort = (SERVER_PORT . "" != "80") ? ":" . SERVER_PORT : ""; - } else { - $envPort = ""; // Empty by default - } - if (!empty($envPort) && strpos($envHost, $envPort) === false) { - $envHost = $envHost . $envPort; - } - $link = (G::is_https() || $envProtocol ? 'https://' : 'http://') . $envHost . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . $envSkin . '/services/ActionsByEmail'; + + $link = System::getServerMainPath() . '/services/ActionsByEmail'; switch ($configuration['ABE_TYPE']) { case 'CUSTOM': @@ -259,14 +253,22 @@ public function sendActionsByEmail($data, $dataAbe) $user = new Users(); + $emailFrom = ''; if (!$configuration['ABE_MAILSERVER_OR_MAILCURRENT'] && $configuration['ABE_TYPE'] !== '') { if ($data->PREVIOUS_USR_UID !== '') { $userDetails = $user->loadDetails($data->PREVIOUS_USR_UID); $emailFrom = ($userDetails["USR_FULLNAME"] . ' <' . $userDetails["USR_EMAIL"] . '>'); } else { global $RBAC; - $currentUser = $RBAC->aUserInfo['USER_INFO']; - $emailFrom = ($currentUser["USR_FIRSTNAME"] . ' ' . $currentUser["USR_LASTNAME"] . ' <' . $currentUser["USR_EMAIL"] . '>'); + if ($RBAC != null && is_array($RBAC->aUserInfo['USER_INFO'])) { + $currentUser = $RBAC->aUserInfo['USER_INFO']; + $emailFrom = ($currentUser["USR_FIRSTNAME"] . ' ' . $currentUser["USR_LASTNAME"] . ' <' . $currentUser["USR_EMAIL"] . '>'); + } else { + $usersPeer = UsersPeer::retrieveByPK($data->USR_UID); + if (!empty($usersPeer)) { + $emailFrom = ($usersPeer->getUsrFirstname() . ' ' . $usersPeer->getUsrLastname() . ' <' . $usersPeer->getUsrEmail() . '>'); + } + } } } else { if (isset($emailSetup["MESS_FROM_NAME"]) && isset($emailSetup["MESS_FROM_MAIL"])) { @@ -290,7 +292,8 @@ public function sendActionsByEmail($data, $dataAbe) true, $data->DEL_INDEX, $emailSetup, - 0 + 0, + WsBase::MESSAGE_TYPE_ACTIONS_BY_EMAIL ); $abeRequest['ABE_REQ_STATUS'] = ($result->status_code == 0 ? 'SENT' : 'ERROR'); diff --git a/workflow/engine/classes/Applications.php b/workflow/engine/classes/Applications.php index af0b1630a..9ceee71f0 100644 --- a/workflow/engine/classes/Applications.php +++ b/workflow/engine/classes/Applications.php @@ -7,7 +7,7 @@ class Applications /** * This function return information by searching cases * - * The query is related to advanced search with diferents filters + * The query is related to advanced search with different filters * We can search by process, status of case, category of process, users, delegate date from and to * * @param string $userUid @@ -17,11 +17,12 @@ class Applications * @param integer $process the pro_id * @param integer $status of the case * @param string $dir if the order is DESC or ASC - * @param string $sort name of column by sort + * @param string $sort name of column by sort, can be: + * [APP_NUMBER, APP_TITLE, APP_PRO_TITLE, APP_TAS_TITLE, APP_CURRENT_USER, APP_UPDATE_DATE, DEL_DELEGATE_DATE, DEL_TASK_DUE_DATE, APP_STATUS_LABEL] * @param string $category uid for the process * @param date $dateFrom * @param date $dateTo - * @param string $columnSearch name of column for a specific search + * @param string $filterBy name of column for a specific search, can be: [APP_NUMBER, APP_TITLE, TAS_TITLE] * @return array $result result of the query */ public function searchAll( @@ -36,11 +37,8 @@ public function searchAll( $category = null, $dateFrom = null, $dateTo = null, - $columnSearch = 'APP_TITLE' + $filterBy = 'APP_TITLE' ) { - //Exclude the Task Dummies in the delegations - $arrayTaskTypeToExclude = array("WEBENTRYEVENT", "END-MESSAGE-EVENT", "START-MESSAGE-EVENT", "INTERMEDIATE-THROW-MESSAGE-EVENT", "INTERMEDIATE-CATCH-MESSAGE-EVENT"); - //Start the connection to database $con = Propel::getConnection(AppDelegationPeer::DATABASE_NAME); @@ -58,7 +56,7 @@ public function searchAll( $category = $inputFilter->escapeUsingConnection($category, $con); $dateFrom = $inputFilter->escapeUsingConnection($dateFrom, $con); $dateTo = $inputFilter->escapeUsingConnection($dateTo, $con); - $columnSearch = $inputFilter->escapeUsingConnection($columnSearch, $con); + $filterBy = $inputFilter->escapeUsingConnection($filterBy, $con); //Start the transaction $con->begin(); @@ -101,18 +99,20 @@ public function searchAll( FROM APP_DELEGATION "; $sqlData .= " LEFT JOIN APPLICATION ON (APP_DELEGATION.APP_NUMBER = APPLICATION.APP_NUMBER)"; - $sqlData .= " LEFT JOIN TASK ON (APP_DELEGATION.TAS_ID = TASK.TAS_ID)"; + $sqlData .= " LEFT JOIN TASK ON (APP_DELEGATION.TAS_ID = TASK.TAS_ID "; + //Exclude the Task Dummies in the delegations + $sqlData .= " AND TASK.TAS_TYPE <> 'WEBENTRYEVENT' AND TASK.TAS_TYPE <> 'END-MESSAGE-EVENT' AND TASK.TAS_TYPE <> 'START-MESSAGE-EVENT' AND TASK.TAS_TYPE <> 'INTERMEDIATE-THROW')"; $sqlData .= " LEFT JOIN USERS ON (APP_DELEGATION.USR_ID = USERS.USR_ID)"; $sqlData .= " LEFT JOIN PROCESS ON (APP_DELEGATION.PRO_ID = PROCESS.PRO_ID)"; - $sqlData .= " WHERE TASK.TAS_TYPE NOT IN ('" . implode("','", $arrayTaskTypeToExclude) . "')"; + $sqlData .= " WHERE 1"; switch ($status) { case 1: //DRAFT - $sqlData .= " AND APP_DELEGATION.DEL_THREAD_STATUS='OPEN'"; + $sqlData .= " AND APP_DELEGATION.DEL_THREAD_STATUS = 'OPEN'"; $sqlData .= " AND APPLICATION.APP_STATUS_ID = 1"; break; case 2: //TO_DO - $sqlData .= " AND APP_DELEGATION.DEL_THREAD_STATUS='OPEN'"; + $sqlData .= " AND APP_DELEGATION.DEL_THREAD_STATUS = 'OPEN'"; $sqlData .= " AND APPLICATION.APP_STATUS_ID = 2"; break; case 3: //COMPLETED @@ -148,40 +148,28 @@ public function searchAll( } if (!empty($search)) { - //If the filter is related to the APPLICATION table: APP_NUMBER or APP_TITLE - if ($columnSearch === 'APP_NUMBER' || $columnSearch === 'APP_TITLE') { - $sqlSearch = "SELECT APPLICATION.APP_NUMBER FROM APPLICATION"; - $sqlSearch .= " WHERE APPLICATION.{$columnSearch} LIKE '%{$search}%'"; - switch ($columnSearch) { - case 'APP_TITLE': - break; - case 'APP_NUMBER': - //Cast the search criteria to string - if (!is_string($search)) { - $search = (string)$search; - } - //Only if is integer we will to add to greater equal in the query - if (substr($search, 0, 1) != '0' && ctype_digit($search)) { - $sqlSearch .= " AND APPLICATION.{$columnSearch} >= {$search}"; - } - break; + //Search: we need to considerate the filterBy and the sortColumn + $appColumns = ['APP_NUMBER', 'APP_TITLE']; + if (in_array($sort, $appColumns) && in_array($filterBy, $appColumns)) { + $sqlData .= " AND APP_DELEGATION.APP_NUMBER IN ("; + //Sub query: get the appNumber(s) that match with the search + $sqlData .= " SELECT APPLICATION.APP_NUMBER FROM APPLICATION WHERE APPLICATION.{$filterBy} LIKE '%{$search}%'"; + $sqlData .= " ORDER BY APPLICATION.{$sort} " . $dir; + //End sub query + $sqlData .= " )"; + } else { + //If the filter is related to the APP_DELEGATION table: APP_NUMBER + if ($filterBy === 'APP_NUMBER') { + $sqlData .= " AND APP_DELEGATION.APP_NUMBER LIKE '%{$search}%' "; } - if (!empty($start)) { - $sqlSearch .= " LIMIT $start, " . $limit; - } else { - $sqlSearch .= " LIMIT " . $limit; + //If the filter is related to the APPLICATION table: APP_TITLE + if ($filterBy === 'APP_TITLE') { + $sqlData .= " AND APPLICATION.APP_TITLE LIKE '%{$search}%' "; } - $dataset = $stmt->executeQuery($sqlSearch); - $appNumbers = [-1]; - while ($dataset->next()) { - $newRow = $dataset->getRow(); - array_push($appNumbers, $newRow['APP_NUMBER']); + //If the filter is related to the TASK table: TAS_TITLE + if ($filterBy === 'TAS_TITLE') { + $sqlData .= " AND TASK.TAS_TITLE LIKE '%{$search}%' "; } - $sqlData .= " AND APP_DELEGATION.APP_NUMBER IN (" . implode(",", $appNumbers) . ")"; - } - //If the filter is related to the TASK table: TAS_TITLE - if ($columnSearch === 'TAS_TITLE') { - $sqlData .= " AND TASK.TAS_TITLE LIKE '%{$search}%' "; } } @@ -194,7 +182,6 @@ public function searchAll( $sqlData .= " AND APP_DELEGATION.DEL_DELEGATE_DATE <= '{$dateTo}'"; } - //Add the additional filters //Sorts the records in descending order by default if (!empty($sort)) { switch ($sort) { @@ -203,6 +190,7 @@ public function searchAll( $orderBy = 'APP_DELEGATION.APP_NUMBER ' . $dir; break; case 'APP_CURRENT_USER': + //@todo: this section needs to use 'User Name Display Format', currently in the extJs is defined this //The column APP_CURRENT_USER is result of concat those fields $orderBy = 'USR_LASTNAME ' . $dir . ' ,USR_FIRSTNAME ' . $dir; break; @@ -216,12 +204,12 @@ public function searchAll( if (empty($limit)) { $limit = 25; } - if (!empty($start) && empty($search)) { + if (!empty($start)) { $sqlData .= " LIMIT $start, " . $limit; } else { $sqlData .= " LIMIT " . $limit; } - + $dataset = $stmt->executeQuery($sqlData); $result = []; //By performance enable always the pagination @@ -236,6 +224,7 @@ public function searchAll( if (isset( $row['DEL_PRIORITY'] )) { $row['DEL_PRIORITY'] = G::LoadTranslation( "ID_PRIORITY_{$priorities[$row['DEL_PRIORITY']]}" ); } + //@todo: this section needs to use 'User Name Display Format', currently in the extJs is defined this $row["APP_CURRENT_USER"] = $row["USR_LASTNAME"].' '.$row["USR_FIRSTNAME"]; $row["APPDELCR_APP_TAS_TITLE"] = ''; $row["USRCR_USR_UID"] = $row["USR_UID"]; @@ -1162,6 +1151,7 @@ public function getSteps($appUid, $index, $tasUid, $proUid) // if it has a condition if (trim($caseStep->getStepCondition()) != '') { $pmScript->setScript($caseStep->getStepCondition()); + $pmScript->setExecutedOn(PMScript::CONDITION); if (! $pmScript->evaluate()) { //evaluated false, jump & continue with the others steps diff --git a/workflow/engine/classes/Calendar.php b/workflow/engine/classes/Calendar.php index fe49aca98..91f257418 100644 --- a/workflow/engine/classes/Calendar.php +++ b/workflow/engine/classes/Calendar.php @@ -315,7 +315,7 @@ public function validateCalendarInfo ($fields, $defaultCalendar) * @param string(32) $proUid * @param string(32) $tasUid */ - function Calendar ($userUid = NULL, $proUid = NULL, $tasUid = NULL) + function __construct($userUid = NULL, $proUid = NULL, $tasUid = NULL) { $this->userUid = $userUid; $this->proUid = $proUid; diff --git a/workflow/engine/classes/Cases.php b/workflow/engine/classes/Cases.php index 773cf02ea..ddc1281e1 100644 --- a/workflow/engine/classes/Cases.php +++ b/workflow/engine/classes/Cases.php @@ -5,7 +5,7 @@ /*----------------------------------********---------------------------------*/ use ProcessMaker\Core\System; use ProcessMaker\Plugins\PluginRegistry; - +use ProcessMaker\Util\DateTime; /** * A Cases object where you can do start, load, update, refresh about cases @@ -18,6 +18,7 @@ class Cases public $dir = 'ASC'; public $sort = 'APP_MSG_DATE'; public $arrayTriggerExecutionTime = []; + private $triggerMessageExecution = ''; public function __construct() { @@ -27,6 +28,28 @@ public function __construct() } } + /** + * Get the triggerMessageExecution + * + * @return string + */ + public function getTriggerMessageExecution() + { + return $this->triggerMessageExecution; + } + + /** + * Add messages related to the trigger execution + * + * @param string $v + * + * @return void + */ + public function addTriggerMessageExecution($v) + { + $this->triggerMessageExecution .= $v; + } + /** * Ask if an user can start a case * @param string $sUIDUser @@ -443,44 +466,44 @@ public function loadCase($sAppUid, $iDelIndex = 0, $jump = '') { try { $oApp = new Application; - $aFields = $oApp->Load($sAppUid); + $fields = $oApp->Load($sAppUid); - $appData = self::unserializeData($aFields['APP_DATA']); + $appData = self::unserializeData($fields['APP_DATA']); - $aFields['APP_DATA'] = G::array_merges(G::getSystemConstants(), $appData); + $fields['APP_DATA'] = G::array_merges(G::getSystemConstants(), $appData); switch ($oApp->getAppStatus()) { case 'COMPLETED': - $aFields['STATUS'] = G::LoadTranslation('ID_COMPLETED'); + $fields['STATUS'] = G::LoadTranslation('ID_COMPLETED'); break; case 'CANCELLED': - $aFields['STATUS'] = G::LoadTranslation('ID_CANCELLED'); + $fields['STATUS'] = G::LoadTranslation('ID_CANCELLED'); break; case 'PAUSED': - $aFields['STATUS'] = G::LoadTranslation('ID_PAUSED'); + $fields['STATUS'] = G::LoadTranslation('ID_PAUSED'); break; case 'DRAFT': - $aFields['STATUS'] = G::LoadTranslation('ID_DRAFT'); + $fields['STATUS'] = G::LoadTranslation('ID_DRAFT'); break; case 'TO_DO': - $aFields['STATUS'] = G::LoadTranslation('ID_TO_DO'); + $fields['STATUS'] = G::LoadTranslation('ID_TO_DO'); break; } $oUser = new Users(); try { $oUser->load($oApp->getAppInitUser()); $uFields = $oUser->toArray(BasePeer::TYPE_FIELDNAME); - $aFields['TITLE'] = $aFields['APP_TITLE']; - $aFields['DESCRIPTION'] = $aFields['APP_DESCRIPTION']; - $aFields['CREATOR'] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname(); - $aFields['CREATE_DATE'] = $oApp->getAppCreateDate(); - $aFields['UPDATE_DATE'] = $oApp->getAppUpdateDate(); + $fields['TITLE'] = $fields['APP_TITLE']; + $fields['DESCRIPTION'] = $fields['APP_DESCRIPTION']; + $fields['CREATOR'] = $oUser->getUsrFirstname() . ' ' . $oUser->getUsrLastname(); + $fields['CREATE_DATE'] = $oApp->getAppCreateDate(); + $fields['UPDATE_DATE'] = $oApp->getAppUpdateDate(); } catch (Exception $oError) { - $aFields['TITLE'] = $oApp->getAppTitle(); - $aFields['DESCRIPTION'] = ''; - $aFields['CREATOR'] = '(USER_DELETED)'; - $aFields['CREATE_DATE'] = $oApp->getAppCreateDate(); - $aFields['UPDATE_DATE'] = $oApp->getAppUpdateDate(); + $fields['TITLE'] = $oApp->getAppTitle(); + $fields['DESCRIPTION'] = ''; + $fields['CREATOR'] = '(USER_DELETED)'; + $fields['CREATE_DATE'] = $oApp->getAppCreateDate(); + $fields['UPDATE_DATE'] = $oApp->getAppUpdateDate(); } if ($iDelIndex > 0) { @@ -488,50 +511,52 @@ public function loadCase($sAppUid, $iDelIndex = 0, $jump = '') $oAppDel = new AppDelegation(); $oAppDel->Load($sAppUid, $iDelIndex); $aAppDel = $oAppDel->toArray(BasePeer::TYPE_FIELDNAME); - $aFields['TAS_UID'] = $aAppDel['TAS_UID']; - $aFields['DEL_INDEX'] = $aAppDel['DEL_INDEX']; - $aFields['DEL_PREVIOUS'] = $aAppDel['DEL_PREVIOUS']; - $aFields['DEL_TYPE'] = $aAppDel['DEL_TYPE']; - $aFields['DEL_PRIORITY'] = $aAppDel['DEL_PRIORITY']; - $aFields['DEL_THREAD_STATUS'] = $aAppDel['DEL_THREAD_STATUS']; - $aFields['DEL_THREAD'] = $aAppDel['DEL_THREAD']; - $aFields['DEL_DELEGATE_DATE'] = $aAppDel['DEL_DELEGATE_DATE']; - $aFields['DEL_INIT_DATE'] = $aAppDel['DEL_INIT_DATE']; - $aFields['DEL_TASK_DUE_DATE'] = $aAppDel['DEL_TASK_DUE_DATE']; - $aFields['DEL_FINISH_DATE'] = $aAppDel['DEL_FINISH_DATE']; - $aFields['CURRENT_USER_UID'] = $aAppDel['USR_UID']; + $fields['TAS_UID'] = $aAppDel['TAS_UID']; + $fields['DEL_INDEX'] = $aAppDel['DEL_INDEX']; + $fields['DEL_PREVIOUS'] = $aAppDel['DEL_PREVIOUS']; + $fields['DEL_TYPE'] = $aAppDel['DEL_TYPE']; + $fields['DEL_PRIORITY'] = $aAppDel['DEL_PRIORITY']; + $fields['DEL_THREAD_STATUS'] = $aAppDel['DEL_THREAD_STATUS']; + $fields['DEL_THREAD'] = $aAppDel['DEL_THREAD']; + $fields['DEL_DELEGATE_DATE'] = $aAppDel['DEL_DELEGATE_DATE']; + $fields['DEL_INIT_DATE'] = $aAppDel['DEL_INIT_DATE']; + $fields['DEL_TASK_DUE_DATE'] = $aAppDel['DEL_TASK_DUE_DATE']; + $fields['DEL_FINISH_DATE'] = $aAppDel['DEL_FINISH_DATE']; + $fields['CURRENT_USER_UID'] = $aAppDel['USR_UID']; //Update the global variables - $aFields['TASK'] = $aAppDel['TAS_UID']; - $aFields['INDEX'] = $aAppDel['DEL_INDEX']; - $aFields['TAS_ID'] = $aAppDel['TAS_ID']; - $aFields['PRO_ID'] = $aAppDel['PRO_ID']; + $fields['TASK'] = $aAppDel['TAS_UID']; + $fields['INDEX'] = $aAppDel['DEL_INDEX']; + $fields['TAS_ID'] = $aAppDel['TAS_ID']; + $fields['PRO_ID'] = $aAppDel['PRO_ID']; try { $oCurUser = new Users(); if ($jump != '') { - $aCases = $oAppDel->LoadParallel($sAppUid); - $aFields['TAS_UID'] = ''; - $aFields['CURRENT_USER'] = array(); - foreach ($aCases as $key => $value) { + $cases = $oAppDel->LoadParallel($sAppUid); + if (!empty($cases)) { + $fields['TAS_UID'] = ''; + } + $fields['CURRENT_USER'] = array(); + foreach ($cases as $key => $value) { $oCurUser->load($value['USR_UID']); - $aFields['CURRENT_USER'][] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname(); - $aFields['TAS_UID'] .= (($aFields['TAS_UID'] != '') ? '|' : '') . $value['TAS_UID']; + $fields['CURRENT_USER'][] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname(); + $fields['TAS_UID'] .= (($fields['TAS_UID'] != '') ? '|' : '') . $value['TAS_UID']; } - $aFields['CURRENT_USER'] = implode(" - ", array_values($aFields['CURRENT_USER'])); - $tasksArray = array_filter(explode('|', $aFields['TAS_UID'])); + $fields['CURRENT_USER'] = implode(" - ", array_values($fields['CURRENT_USER'])); + $tasksArray = array_filter(explode('|', $fields['TAS_UID'])); if (count($tasksArray) == 1) { - $aFields['TAS_UID'] = $tasksArray[0]; + $fields['TAS_UID'] = $tasksArray[0]; } } else { $oCurUser->load($aAppDel['USR_UID']); - $aFields['CURRENT_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname(); + $fields['CURRENT_USER'] = $oCurUser->getUsrFirstname() . ' ' . $oCurUser->getUsrLastname(); } } catch (Exception $oError) { - $aFields['CURRENT_USER'] = ''; + $fields['CURRENT_USER'] = ''; } } - return $aFields; + return $fields; } catch (exception $e) { throw ($e); } @@ -609,87 +634,32 @@ public function refreshCaseLabel($sAppUid, $aAppData, $sLabel) } /** - * This function loads the title and description label in a case - * PROCESO: - * If there is a label then it is loaded - * To get APP_DELEGATIONS that they are opened in the case - * To look for APP_DELEGATIONS wich TASK in it, It has a label defined(CASE_TITLE) - * We need to read the last APP_DELEGATION->TASK - * @param string $sAppUid - * @param array $aAppData - * @return $res - */ - public function refreshCaseTitleAndDescription($sAppUid, $aAppData) - { - $res['APP_TITLE'] = null; - $res['APP_DESCRIPTION'] = null; - //$res['APP_PROC_CODE'] = null; - - $oApplication = new Application; - try { - $fields = $oApplication->load($sAppUid); - } catch (Exception $e) { - return $res; - } - - $res['APP_TITLE'] = $fields['APP_TITLE']; // $oApplication->$getAppLabel(); - $res['APP_DESCRIPTION'] = $fields['APP_DESCRIPTION']; - - $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; - $bUpdatedDefTitle = false; - $bUpdatedDefDescription = false; - $cri = new Criteria; - $cri->add(AppDelegationPeer::APP_UID, $sAppUid); - $cri->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"); - $currentDelegations = AppDelegationPeer::doSelect($cri); - //load only the tas_def fields, because these three or two values are needed - for ($r = count($currentDelegations) - 1; $r >= 0; $r--) { - $c = new Criteria(); - $c->clearSelectColumns(); - $c->addSelectColumn(TaskPeer::TAS_DEF_TITLE); - $c->addSelectColumn(TaskPeer::TAS_DEF_DESCRIPTION); - $c->add(TaskPeer::TAS_UID, $currentDelegations[$r]->getTasUid()); - $rs = TaskPeer::doSelectRS($c); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - while ($rs->next()) { - $row = $rs->getRow(); - $tasDefTitle = $row['TAS_DEF_TITLE']; - if ($tasDefTitle != '' && !$bUpdatedDefTitle) { - $res['APP_TITLE'] = G::replaceDataField($tasDefTitle, $aAppData); - $bUpdatedDefTitle = true; - } - $tasDefDescription = $row['TAS_DEF_DESCRIPTION']; - if ($tasDefDescription != '' && !$bUpdatedDefDescription) { - $res['APP_DESCRIPTION'] = G::replaceDataField($tasDefDescription, $aAppData); - $bUpdatedDefDescription = true; - } - } - } - return $res; - } - - /** - * optimized for speed. This function loads the title and description label in a case + * Optimized for speed. This function loads the title and description label in a case * If there is a label then it is loaded * Get Open APP_DELEGATIONS in the case - * To look for APP_DELEGATIONS wich TASK in it, It has a label defined(CASE_TITLE) + * To look for APP_DELEGATIONS which TASK in it, It has a label defined(CASE_TITLE) * We need to read the last APP_DELEGATION->TASK - * @param string $sAppUid - * @param array $aAppData - * @return $res + * + * @param string $appUid + * @param array $fields + * @param array $lastFieldsCase + * + * @return array + * + * @see classes/Cases->startCase() + * @see classes/Cases->updateCase() */ - public function newRefreshCaseTitleAndDescription($sAppUid, $fields, $aAppData) + public function newRefreshCaseTitleAndDescription($appUid, $fields, $lastFieldsCase = []) { - $res = array(); + $res = []; - $lang = defined('SYS_LANG') ? SYS_LANG : 'en'; - $bUpdatedDefTitle = false; - $bUpdatedDefDescription = false; + $flagTitle = false; + $flagDescription = false; $cri = new Criteria; $cri->clearSelectColumns(); $cri->addSelectColumn(AppDelegationPeer::TAS_UID); - $cri->add(AppDelegationPeer::APP_UID, $sAppUid); + $cri->add(AppDelegationPeer::APP_UID, $appUid); $cri->add(AppDelegationPeer::DEL_THREAD_STATUS, "OPEN"); if (isset($fields['DEL_INDEX'])) { $cri->add(AppDelegationPeer::DEL_INDEX, $fields['DEL_INDEX']); @@ -710,36 +680,38 @@ public function newRefreshCaseTitleAndDescription($sAppUid, $fields, $aAppData) $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($rs->next()) { $row = $rs->getRow(); + $newValues = []; + //Get the case title $tasDefTitle = trim($row['TAS_DEF_TITLE']); - if ($tasDefTitle != '' && !$bUpdatedDefTitle) { - $newAppTitle = G::replaceDataField($tasDefTitle, $aAppData); - $res['APP_TITLE'] = $newAppTitle; - if (!(isset($fields['APP_TITLE']) && $fields['APP_TITLE'] == $newAppTitle)) { - $bUpdatedDefTitle = true; - $appData = array(); - $appData['APP_UID'] = $sAppUid; - $appData['APP_TITLE'] = $newAppTitle; - $oApplication = new Application(); - $oApplication->update($appData); + if (!empty($tasDefTitle) && !$flagTitle) { + $newAppProperty = G::replaceDataField($tasDefTitle, $lastFieldsCase); + $res['APP_TITLE'] = $newAppProperty; + if (!(isset($currentValue) && ($currentValue == $tasDefTitle))) { + $newValues['APP_TITLE'] = $newAppProperty; + $flagTitle = true; } } + //Get the case description $tasDefDescription = trim($row['TAS_DEF_DESCRIPTION']); - if ($tasDefDescription != '' && !$bUpdatedDefDescription) { - $newAppDescription = G::replaceDataField($tasDefDescription, $aAppData); - $res['APP_DESCRIPTION'] = $newAppDescription; - if (!(isset($fields['APP_DESCRIPTION']) && $fields['APP_DESCRIPTION'] == $newAppDescription)) { - $bUpdatedDefDescription = true; - $appData = array(); - $appData['APP_UID'] = $sAppUid; - $appData['APP_DESCRIPTION'] = $newAppDescription; - $oApplication = new Application(); - $oApplication->update($appData); + if (!empty($tasDefDescription) && !$flagDescription) { + $newAppProperty = G::replaceDataField($tasDefDescription, $lastFieldsCase); + $res['APP_DESCRIPTION'] = $newAppProperty; + if (!(isset($currentValue) && ($currentValue == $tasDefDescription))) { + $newValues['APP_DESCRIPTION'] = $newAppProperty; + $flagDescription = true; } } + + if (!empty($newValues)) { + $application = new Application(); + $newValues['APP_UID'] = $appUid; + $application->update($newValues); + } } $rsCri->next(); $rowCri = $rsCri->getRow(); } + return $res; } @@ -843,27 +815,74 @@ public function array_key_intersect(&$a, &$b) * Update an existing case, this info is used in CaseResume * * @name updateCase - * @param string $sAppUid - * @param integer $iDelIndex > 0 //get the Delegation fields + * + * @param string $appUid + * @param array $Fields + * * @return Fields + * @throws Exception + * + * @see Cases->cancelCase() + * @see Cases->executeTriggerFromList() + * @see Cases->executeTriggersAfterExternal() + * @see Cases->getExecuteTriggerProcess() + * @see Cases->unCancelCase() + * @see Cases->cancelCase() + * @see executeCaseSelfService()/cron_single.php + * @see handleErrors()/class.pmFunctions.php + * @see handleFatalErrors()/class.pmFunctions.php + * @see PMFRedirectToStep()/class.pmFunctions.php + * @see setCaseTrackerCode()/class.pmFunctions.php + * @see Derivation::derivate() + * @see Derivation::verifyIsCaseChild() + * @see WsBase::executeTrigger() + * @see WsBase::executeTriggerFromDerivate() + * @see WsBase::newCase() + * @see WsBase::newCaseImpersonate() + * @see WsBase::sendVariables() + * @see AdditionalTables->saveDataInTable() + * @see AppEvent->executeEvents() + * @see cases_Derivate.php + * @see cases_SaveData.php + * @see cases_SaveDataSupervisor.php + * @see cases_SaveDocument.php + * @see cases_Step.php + * @see cases_SupervisorSaveDocument.php + * @see saveForm.php + * @see ActionByEmail.php + * @see ActionByEmailDataFormPost.php + * @see cases_StartExternal.php + * @see upload.php + * @see \ProcessMaker\BusinessModel\Cases::deleteMultipleFile() + * @see \ProcessMaker\BusinessModel\Cases::putExecuteTriggers() + * @see \ProcessMaker\BusinessModel\Cases::setCaseVariables() + * @see \ProcessMaker\BusinessModel\Consolidated::consolidatedUpdate() + * @see \ProcessMaker\BusinessModel\Consolidated::postDerivate() + * @see \ProcessMaker\BusinessModel\Light::doExecuteTriggerCase() + * @see \ProcessMaker\BusinessModel\Light::getPrepareInformation() + * @see \ProcessMaker\BusinessModel\Light::startCase() + * @see \ProcessMaker\BusinessModel\MessageApplication::catchMessageEvent() + * @see \ProcessMaker\BusinessModel\ScriptTask::execScriptByActivityUid() + * @see \ProcessMaker\BusinessModel\Cases\InputDocument::addCasesInputDocument() + * @see \ProcessMaker\BusinessModel\Cases\InputDocument::uploadFileCase() + * @see \ProcessMaker\BusinessModel\Cases\Variable::create() + * @see \ProcessMaker\BusinessModel\Cases\Variable::delete() + * @see \ProcessMaker\BusinessModel\Cases\Variable::update() */ - public function updateCase($sAppUid, $Fields = array()) + public function updateCase($appUid, $Fields = []) { try { - $oApplication = new Application; - if (!$oApplication->exists($sAppUid)) { + $application = new Application; + if (!$application->exists($appUid)) { return false; } - $aApplicationFields = $Fields['APP_DATA']; - $Fields['APP_UID'] = $sAppUid; + $appData = $Fields['APP_DATA']; + $Fields['APP_UID'] = $appUid; $Fields['APP_UPDATE_DATE'] = 'now'; $Fields['APP_DATA'] = serialize($Fields['APP_DATA']); - /* - $oApp = new Application; - $appFields = $oApp->load($sAppUid); - */ - $oApp = ApplicationPeer::retrieveByPk($sAppUid); - $appFields = $oApp->toArray(BasePeer::TYPE_FIELDNAME); + + $app = ApplicationPeer::retrieveByPk($appUid); + $appFields = $app->toArray(BasePeer::TYPE_FIELDNAME); if (isset($Fields['APP_TITLE'])) { $appFields['APP_TITLE'] = $Fields['APP_TITLE']; } @@ -874,16 +893,21 @@ public function updateCase($sAppUid, $Fields = array()) $appFields['DEL_INDEX'] = $Fields['DEL_INDEX']; } - $arrayNewCaseTitleAndDescription = $this->newRefreshCaseTitleAndDescription($sAppUid, $appFields, $aApplicationFields); + //Get the appTitle and appDescription + $newTitleOrDescription = $this->newRefreshCaseTitleAndDescription( + $appUid, + $appFields, + $appData + ); //Start: Save History --By JHL if (isset($Fields['CURRENT_DYNAFORM'])) { //only when that variable is set.. from Save - $FieldsBefore = $this->loadCase($sAppUid); - $FieldsDifference = $this->arrayRecursiveDiff($FieldsBefore['APP_DATA'], $aApplicationFields); - $fieldsOnBoth = $this->array_key_intersect($FieldsBefore['APP_DATA'], $aApplicationFields); + $FieldsBefore = $this->loadCase($appUid); + $FieldsDifference = $this->arrayRecursiveDiff($FieldsBefore['APP_DATA'], $appData); + $fieldsOnBoth = $this->array_key_intersect($FieldsBefore['APP_DATA'], $appData); //Add fields that weren't in previous version - foreach ($aApplicationFields as $key => $value) { + foreach ($appData as $key => $value) { if (is_array($value) && isset($fieldsOnBoth[$key]) && is_array($fieldsOnBoth[$key])) { $afieldDifference = $this->arrayRecursiveDiff($value, $fieldsOnBoth[$key]); $dfieldDifference = $this->arrayRecursiveDiff($fieldsOnBoth[$key], $value); @@ -897,9 +921,9 @@ public function updateCase($sAppUid, $Fields = array()) } } if ((is_array($FieldsDifference)) && (count($FieldsDifference) > 0)) { - $oCurrentDynaform = new Dynaform(); + $dynaformInstance = new Dynaform(); try { - $currentDynaform = $oCurrentDynaform->Load($Fields['CURRENT_DYNAFORM']); + $currentDynaform = $dynaformInstance->Load($Fields['CURRENT_DYNAFORM']); } catch (Exception $e) { $currentDynaform["DYN_CONTENT"] = ""; } @@ -910,13 +934,13 @@ public function updateCase($sAppUid, $Fields = array()) $appDataWithoutDynContentHistory = serialize($FieldsDifference); $aFieldsHistory['APP_DATA'] = serialize($FieldsDifference); $appHistory->insertHistory($aFieldsHistory); - + /*----------------------------------********---------------------------------*/ } } //End Save History - //we are removing the app_title and app_description from this array, - //because they already be updated in newRefreshCaseTitleAndDescription function + + //We are removing the app_title and app_description because they already be updated in newRefreshCaseTitleAndDescription function if (isset($Fields['APP_TITLE'])) { unset($Fields['APP_TITLE']); } @@ -927,16 +951,18 @@ public function updateCase($sAppUid, $Fields = array()) if (isset($Fields['CURRENT_USER_UID'])) { $Fields['USR_UID'] = $Fields['CURRENT_USER_UID']; } - /*----------------------------------********---------------------------------*/ + //Will be update the status in the list Participated + $listParticipatedLast = new ListParticipatedLast(); + $listParticipatedLast->refreshStatus($Fields['APP_UID'], 'COMPLETED'); } - $oApp->update($Fields); - $DEL_INDEX = isset($Fields['DEL_INDEX']) ? $Fields['DEL_INDEX'] : ''; - $TAS_UID = isset($Fields['TAS_UID']) ? $Fields['TAS_UID'] : ''; + /** Update case*/ + $app->update($Fields); + //Update the reportTables and tables related to the case require_once 'classes/model/AdditionalTables.php'; - $oReportTables = new ReportTables(); - $addtionalTables = new additionalTables(); + $reportTables = new ReportTables(); + $additionalTables = new additionalTables(); if (!isset($Fields['APP_NUMBER'])) { $Fields['APP_NUMBER'] = $appFields['APP_NUMBER']; @@ -945,56 +971,33 @@ public function updateCase($sAppUid, $Fields = array()) $Fields['APP_STATUS'] = $appFields['APP_STATUS']; } - $oReportTables->updateTables($appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields); - $addtionalTables->updateReportTables( - $appFields['PRO_UID'], $sAppUid, $Fields['APP_NUMBER'], $aApplicationFields, $Fields['APP_STATUS'] + $reportTables->updateTables($appFields['PRO_UID'], $appUid, $Fields['APP_NUMBER'], $appData); + $additionalTables->updateReportTables( + $appFields['PRO_UID'], $appUid, $Fields['APP_NUMBER'], $appData, $Fields['APP_STATUS'] ); - //now update the priority in appdelegation table, using the defined variable in task - if (trim($DEL_INDEX) != '' && trim($TAS_UID) != '') { - //optimized code to avoid load task content row. - $c = new Criteria(); - $c->clearSelectColumns(); - $c->addSelectColumn(TaskPeer::TAS_PRIORITY_VARIABLE); - $c->add(TaskPeer::TAS_UID, $TAS_UID); - $rs = TaskPeer::doSelectRS($c); - $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $rs->next(); - $row = $rs->getRow(); - $VAR_PRI = substr($row['TAS_PRIORITY_VARIABLE'], 2); - //end optimized code. - - $x = unserialize($Fields['APP_DATA']); - if (isset($x[$VAR_PRI])) { - if (trim($x[$VAR_PRI]) != '') { - $oDel = new AppDelegation; - $array = array(); - $array['APP_UID'] = $sAppUid; - $array['DEL_INDEX'] = $DEL_INDEX; - $array['TAS_UID'] = $TAS_UID; - $array['DEL_PRIORITY'] = (isset($x[$VAR_PRI]) ? - ($x[$VAR_PRI] >= 1 && $x[$VAR_PRI] <= 5 ? $x[$VAR_PRI] : '3') : '3'); - $oDel->update($array); - } - } - } + //Update the priority related to the task + $delIndex = isset($Fields['DEL_INDEX']) ? trim($Fields['DEL_INDEX']) : ''; + $tasUid = isset($Fields['TAS_UID']) ? trim($Fields['TAS_UID']) : ''; + $appDel = new AppDelegation; + $appDel->updatePriority($delIndex, $tasUid, $appUid, $appData); + //Update Solr Index if ($this->appSolr != null) { - $this->appSolr->updateApplicationSearchIndex($sAppUid); + $this->appSolr->updateApplicationSearchIndex($appUid); } if ($Fields["APP_STATUS"] == "COMPLETED") { //Delete records of the table APP_ASSIGN_SELF_SERVICE_VALUE $appAssignSelfServiceValue = new AppAssignSelfServiceValue(); - - $appAssignSelfServiceValue->remove($sAppUid); + $appAssignSelfServiceValue->remove($appUid); } /*----------------------------------********---------------------------------*/ //Return return $Fields; - } catch (exception $e) { + } catch (Exception $e) { throw ($e); } } @@ -1105,12 +1108,13 @@ public function removeCase($sAppUid, $deleteDelegation = true) $nameFiles .= $node['file'] . ":" . $node['function'] . "(" . $node['line'] . ")\n"; } } - $dataLog = \Bootstrap::getDefaultContextLog(); - $dataLog['usrUid'] = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : G::LoadTranslation('UID_UNDEFINED_USER'); - $dataLog['appUid'] = $sAppUid; - $dataLog['request'] = $nameFiles; - $dataLog['action'] = 'DeleteCases'; - Bootstrap::registerMonolog('DeleteCases', 200, 'Delete Case', $dataLog, $dataLog['workspace'], 'processmaker.log'); + + /** ProcessMaker log*/ + $context = Bootstrap::getDefaultContextLog(); + $context['appUid'] = $sAppUid; + $context['request'] = $nameFiles; + Bootstrap::registerMonolog('DeleteCases', 200, 'Delete Case', $context); + return $result; } catch (exception $e) { throw ($e); @@ -2243,6 +2247,7 @@ public function getNextStep($sProUid = '', $sAppUid = '', $iDelIndex = 0, $iPosi if ($oStep) { if (trim($oStep->getStepCondition()) !== '') { $oPMScript->setScript($oStep->getStepCondition()); + $oPMScript->setExecutedOn(PMScript::CONDITION); $bAccessStep = $oPMScript->evaluate(); } else { $bAccessStep = true; @@ -2373,6 +2378,7 @@ public function getPreviousStep($sProUid = '', $sAppUid = '', $iDelIndex = 0, $i if ($oStep) { if (trim($oStep->getStepCondition()) !== '') { $oPMScript->setScript($oStep->getStepCondition()); + $oPMScript->setExecutedOn(PMScript::CONDITION); $bAccessStep = $oPMScript->evaluate(); } else { $bAccessStep = true; @@ -3325,53 +3331,185 @@ public function loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType) /** * Execute trigger in task * @name executeTriggers - * @param string $sTasUid - * @param string $sStepType - * @param array $sStepUidObj - * @param string $sTriggerType - * @param array $aFields + * @param string $tasUid + * @param string $stepType + * @param array $stepUidObj + * @param string $triggerType + * @param array $fieldsCase + * * @return integer */ - public function executeTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType, $aFields = array()) + public function executeTriggers($tasUid, $stepType, $stepUidObj, $triggerType, $fieldsCase = []) { + //Load the triggers assigned in the step + $triggersList = $this->loadTriggers($tasUid, $stepType, $stepUidObj, $triggerType); + + //Execute the trigger defined in the step + $lastFields = $this->executeTriggerFromList($triggersList, $fieldsCase, $stepType, $stepUidObj, $triggerType); + /*----------------------------------********---------------------------------*/ - $aTriggers = $this->loadTriggers($sTasUid, $sStepType, $sStepUidObj, $sTriggerType); + return $lastFields; + } - if (count($aTriggers) > 0) { - global $oPMScript; + /** + * This method executes the triggers send in an array + * + * @param array $triggersList + * @param array $fieldsCase + * @param string $stepType + * @param string $stepUidObj + * @param string $triggerType + * @param string $labelAssignment + * @param bool $useGlobal, needs to have the value true if the same case in execution is affected with this trigger + * + * @return array + * + * @see Cases::executeTriggers() + * @see Cases::getExecuteTriggerProcess() + * @see WsBase::executeTriggerFromDerivate() + * @see ScriptTask::execScriptByActivityUid() + * + * @link https://wiki.processmaker.com/3.2/Triggers#Custom_Trigger + * @link https://wiki.processmaker.com/3.2/Triggers#When_action_cases + * @link https://wiki.processmaker.com/3.1/Triggers + * @link https://wiki.processmaker.com/3.1/Tasks#ScriptTask + */ + public function executeTriggerFromList( + array $triggersList, + array $fieldsCase, + $stepType, + $stepUidObj, + $triggerType, + $labelAssignment = '', + $useGlobal = true + ) + { + if (count($triggersList) > 0) { + if ($useGlobal) { + /** + * The global $oPMScript is necessary when the trigger can be update the appData related to the case + * in execution + */ + global $oPMScript; + } - $oPMScript = new PMScript(); - $oPMScript->setFields($aFields); + $this->addTriggerMessageExecution("
" . $labelAssignment . "
"); + if (!isset($oPMScript)) { + $oPMScript = new PMScript(); + } /*----------------------------------********---------------------------------*/ - foreach ($aTriggers as $aTrigger) { + $varInAfterRouting = false; + $fieldsTrigger = []; + foreach ($triggersList as $trigger) { /*----------------------------------********---------------------------------*/ - //Execute - $bExecute = true; - - if ($aTrigger['ST_CONDITION'] !== '') { - $oPMScript->setDataTrigger($aTrigger); - $oPMScript->setScript($aTrigger['ST_CONDITION']); - $bExecute = $oPMScript->evaluate(); + $oPMScript->setFields($fieldsCase); + $execute = true; + //Check if the trigger has conditions for the execution + if (!empty($trigger['ST_CONDITION'])) { + $oPMScript->setDataTrigger($trigger); + $oPMScript->setScript($trigger['ST_CONDITION']); + $oPMScript->setExecutedOn(PMScript::CONDITION); + $execute = $oPMScript->evaluate(); } - if ($bExecute) { - $oPMScript->setDataTrigger($aTrigger); - $oPMScript->setScript($aTrigger['TRI_WEBBOT']); + //Execute the trigger + if ($execute) { + $oPMScript->setDataTrigger($trigger); + $oPMScript->setScript($trigger['TRI_WEBBOT']); + $executedOn = $oPMScript->getExecutionOriginForAStep($stepType, $stepUidObj, $triggerType); + $oPMScript->setExecutedOn($executedOn); $oPMScript->execute(); + //Return all the appData + variables changed in the execution + $appDataAfterTrigger = $oPMScript->aFields; + + /** + * This section of code its related to the route the case with parallel task in the same time + * @link https://processmaker.atlassian.net/browse/PMC-2 + * + * @todo: The solution for ticket HOR-4602 should be restated in another ticket, for now this change was reverted + */ + if ($oPMScript->executedOn() === $oPMScript::AFTER_ROUTING) { + //Get the variables changed with the trigger + $fieldsTrigger = getDiffBetweenModifiedVariables($appDataAfterTrigger, $fieldsCase); + $collection = collect($fieldsCase); + $merged = $collection->merge($fieldsTrigger); + //Merge the appData with variables changed + $fieldsCase = $merged->all(); + + //We will be load the last appData because: + //Other thread execution can be changed the variables + $appUid = !empty($fieldsCase['APPLICATION']) ? $fieldsCase['APPLICATION'] : ''; + //Save the fields changed in the trigger + if (!$varInAfterRouting && !empty($fieldsTrigger)) { + $varInAfterRouting = true; + } + } else { + $fieldsCase = $appDataAfterTrigger; + } - $this->arrayTriggerExecutionTime[$aTrigger['TRI_UID']] = $oPMScript->scriptExecutionTime; + //Register the time execution + $this->arrayTriggerExecutionTime[$trigger['TRI_UID']] = $oPMScript->scriptExecutionTime; + //Register the message of execution + $varTriggers = " - " . nl2br(htmlentities($trigger["TRI_TITLE"], ENT_QUOTES)) . "
"; + $this->addTriggerMessageExecution($varTriggers); } } + + /** + * Get the caseTitle from the nextTask and update the caseTitle + */ + if ($varInAfterRouting) { + $this->newRefreshCaseTitleAndDescription( + $appUid, + ['DEL_INDEX' => 0], + $fieldsCase + ); + } + /*----------------------------------********---------------------------------*/ + } - return $oPMScript->aFields; - } else { - return $aFields; + return $fieldsCase; + } + + /** + * Find keys and values into the appData + * + * @param array $appData + * @param array $keyToSearch + * + * @return array + */ + private function findKeysAndValues(array $appData, array $keyToSearch) + { + $keysAndValues = []; + foreach ($keyToSearch as $key) { + $keysAndValues[$key] = $appData[$key]; } + + return $keysAndValues; + } + + /** + * Review the code in the trigger if the feature is enable + * + * @param CodeScanner $cs + * @param string $code + * @param string $triTitle + * + * @return string + * + */ + private function codeScannerReview(CodeScanner $cs, $code, $triTitle) + { + $foundDisabledCode = ""; + /*----------------------------------********---------------------------------*/ + + return $foundDisabledCode; } /** @@ -4066,14 +4204,15 @@ public function unpauseCase($sApplicationUID, $iDelegation, $sUserUID) * @param string $appUid * @param integer $delIndex * @param string $usrUid + * @param bool $executeSameCase + * + * @see Ajax::cancelCase() + * @see cases_Ajax + * @see WsBase::cancelCase() * - * @return boolean|string */ - public function cancelCase($appUid, $delIndex = null, $usrUid = null) + public function cancelCase($appUid, $delIndex = null, $usrUid = null, $executeSameCase = true) { - /** Execute a trigger when a case is cancelled */ - $this->getExecuteTriggerProcess($appUid, 'CANCELED'); - $caseFields = $this->loadCase($appUid); $appStatusCurrent = $caseFields['APP_STATUS']; @@ -4102,6 +4241,9 @@ public function cancelCase($appUid, $delIndex = null, $usrUid = null) ); $delay->create($rowDelay); + /** Execute a trigger when a case is cancelled */ + $this->getExecuteTriggerProcess($appUid, 'CANCELED', $executeSameCase); + /*----------------------------------********---------------------------------*/ } } @@ -4385,14 +4527,16 @@ public function reassignCase($appUid, $delIndex, $currentUserUid, $newUserUid, $ $appDelay = new AppDelay(); $appDelay->create($newData); - //update searchindex + //Update searchindex if ($this->appSolr != null) { $this->appSolr->updateApplicationSearchIndex($appUid); } - /*----------------------------------********---------------------------------*/ + //Execute trigger $this->getExecuteTriggerProcess($appUid, 'REASSIGNED'); + /*----------------------------------********---------------------------------*/ + //Delete record of the table LIST_UNASSIGNED $unassigned = new ListUnassigned(); $unassigned->remove($appUid, $delIndex); @@ -5288,9 +5432,14 @@ public function loadDataSendEmail($aTaskInfo, $arrayData, $from, $typeSend) } /** + * This function send an email for each task in $arrayTask if $to is definded + * * @param $dataLastEmail * @param $arrayData * @param $arrayTask + * @return void + * + * @see \Cases->sendNotifications() */ public function sendMessage($dataLastEmail, $arrayData, $arrayTask) { @@ -5374,7 +5523,7 @@ public function sendMessage($dataLastEmail, $arrayData, $arrayTask) '', $dataLastEmail['applicationUid'], $dataLastEmail['delIndex'], - 'DERIVATION', + WsBase::MESSAGE_TYPE_TASK_NOTIFICATION, $dataLastEmail['subject'], $dataLastEmail['from'], $to, @@ -5384,7 +5533,7 @@ public function sendMessage($dataLastEmail, $arrayData, $arrayTask) '', '', 'pending', - '', + 1, $dataLastEmail['msgError'], true, isset($arrayData['APP_NUMBER']) ? $arrayData['APP_NUMBER'] : 0, @@ -6877,6 +7026,7 @@ public function getUsersParticipatedInCase($sAppUid, $usrStatus = '') * @param string $type * @param string $userUid * @return array|stdclass|string + * */ public function getCaseNotes($applicationID, $type = 'array', $userUid = '') { @@ -6889,7 +7039,7 @@ public function getCaseNotes($applicationID, $type = 'array', $userUid = '') if (is_array($appNotes)) { switch ($type) { case 'array': - $response = array(); + $response = []; foreach ($appNotes['array']['notes'] as $key => $value) { $list = array(); $list['FULL_NAME'] = $value['USR_FIRSTNAME'] . " " . $value['USR_LASTNAME']; @@ -6897,6 +7047,9 @@ public function getCaseNotes($applicationID, $type = 'array', $userUid = '') if ($keys != 'USR_FIRSTNAME' && $keys != 'USR_LASTNAME' && $keys != 'USR_EMAIL') { $list[$keys] = $value; } + if ($keys == 'NOTE_DATE') { + $list[$keys] = DateTime::convertUtcToTimeZone($value); + } } $response[$key + 1] = $list; } @@ -6909,6 +7062,9 @@ public function getCaseNotes($applicationID, $type = 'array', $userUid = '') if ($keys != 'USR_FIRSTNAME' && $keys != 'USR_LASTNAME' && $keys != 'USR_EMAIL') { $response->$key->$keys = $value; } + if ($keys == 'NOTE_DATE') { + $response->$key->$keys = DateTime::convertUtcToTimeZone($value); + } } } break; @@ -6918,7 +7074,7 @@ public function getCaseNotes($applicationID, $type = 'array', $userUid = '') $response .= $value['USR_FIRSTNAME'] . " " . $value['USR_LASTNAME'] . " " . "(" . $value['USR_USERNAME'] . ")" . - " " . $value['NOTE_CONTENT'] . " " . " (" . $value['NOTE_DATE'] . " ) " . + " " . $value['NOTE_CONTENT'] . " " . " (" . DateTime::convertUtcToTimeZone($value['NOTE_DATE']) . " ) " . " \n"; } break; @@ -6927,92 +7083,90 @@ public function getCaseNotes($applicationID, $type = 'array', $userUid = '') return $response; } - public function getExecuteTriggerProcess($appUid, $action) + /** + * Execute triggers when committing an action in cases + * + * @param string $appUid + * @param string $action, can be [OPEN, CANCELED, PAUSED, REASSIGNED, DELETED, CREATE, UNPAUSE] + * @param bool $executeSameCase + * + * @return bool + * + * @see cases_Open.php + * @see cancelCase/Cases.php pauseCase/Cases.php reassignCase/Cases.php removeCase/Cases.php unpauseCase/Cases.php on + * @link https://wiki.processmaker.com/3.2/Triggers#When_action_cases + */ + public function getExecuteTriggerProcess($appUid, $action, $executeSameCase = true) { - if ((!isset($appUid) && $appUid == '') || (!isset($action) && $action == '')) { + if (empty($appUid) || empty($action)) { return false; } - $aFields = $this->loadCase($appUid); - $proUid = $aFields['PRO_UID']; - require_once("classes/model/Process.php"); + $fieldsCase = $this->loadCase($appUid); + $proUid = $fieldsCase['PRO_UID']; + + //Set some global system variables + $fieldsCase['APP_DATA']['APPLICATION'] = $appUid; + $fieldsCase['APP_DATA']['PROCESS'] = $proUid; + + //Get the trigger configured in the process action $appProcess = new Process(); - $arrayWebBotTrigger = $appProcess->getTriggerWebBotProcess($proUid, $action); - - if ($arrayWebBotTrigger['TRI_WEBBOT'] != false && $arrayWebBotTrigger['TRI_WEBBOT'] != '') { - global $oPMScript; - $aFields['APP_DATA']['APPLICATION'] = $appUid; - $aFields['APP_DATA']['PROCESS'] = $proUid; - $oPMScript = new PMScript(); - $oPMScript->setDataTrigger($arrayWebBotTrigger); - $oPMScript->setFields($aFields['APP_DATA']); - $oPMScript->setScript($arrayWebBotTrigger['TRI_WEBBOT']); - $oPMScript->execute(); - - $aFields['APP_DATA'] = array_merge($aFields['APP_DATA'], $oPMScript->aFields); - unset($aFields['APP_STATUS']); - unset($aFields['APP_PROC_STATUS']); - unset($aFields['APP_PROC_CODE']); - unset($aFields['APP_PIN']); - $this->updateCase($aFields['APP_UID'], $aFields); + $triggersList = $appProcess->getTriggerWebBotProcess($proUid, $action); + + if (!empty($triggersList)){ + //Execute the trigger defined in the process action + $fieldsCase['APP_DATA'] = $this->executeTriggerFromList( + $triggersList, + $fieldsCase['APP_DATA'], + 'PROCESS_ACTION', + '', + '', + '', + $executeSameCase + ); + + //Update the case + $this->updateCase($appUid, $fieldsCase); return true; + } else { + return false; } - return false; } + /** + * When the case is deleted will be removed the case from the report tables related + * + * @param string $applicationUid + * + * @return void + * @throws Exception + */ public function reportTableDeleteRecord($applicationUid) { - $criteria1 = new Criteria("workflow"); - - //SELECT - $criteria1->addSelectColumn(ApplicationPeer::PRO_UID); - - //FROM - //WHERE - $criteria1->add(ApplicationPeer::APP_UID, $applicationUid); - - //QUERY - $rsCriteria1 = ApplicationPeer::doSelectRS($criteria1); - $rsCriteria1->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - $rsCriteria1->next(); - $row1 = $rsCriteria1->getRow(); - - $processUid = $row1["PRO_UID"]; - - $criteria2 = new Criteria("workflow"); - - //SELECT - $criteria2->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME); - - //FROM - //WHERE - - $criteria2->add(AdditionalTablesPeer::PRO_UID, $processUid); - - //QUERY - $rsCriteria2 = AdditionalTablesPeer::doSelectRS($criteria2); - $rsCriteria2->setFetchmode(ResultSet::FETCHMODE_ASSOC); - - $pmTable = new PmTable(); - - while ($rsCriteria2->next()) { - try { - $row2 = $rsCriteria2->getRow(); - $tableName = $row2["ADD_TAB_NAME"]; - $pmTableName = $pmTable->toCamelCase($tableName); - - //DELETE - require_once(PATH_WORKSPACE . "classes" . PATH_SEP . "$pmTableName.php"); - - $criteria3 = new Criteria("workflow"); - - eval("\$criteria3->add(" . $pmTableName . "Peer::APP_UID, \$applicationUid);"); - eval($pmTableName . "Peer::doDelete(\$criteria3);"); - } catch (Exception $e) { - throw $e; + $app = new Application(); + $applicationFields = $app->Load($applicationUid); + if (!empty($applicationFields["PRO_UID"])) { + $additionalTables = new AdditionalTables(); + $listTables = $additionalTables->getReportTables($applicationFields["PRO_UID"]); + $pmTable = new PmTable(); + foreach ($listTables as $row) { + try { + $tableName = $row["ADD_TAB_NAME"]; + $pmTableName = $pmTable->toCamelCase($tableName); + require_once(PATH_WORKSPACE . 'classes' . PATH_SEP . $pmTableName . '.php'); + $criteria = new Criteria("workflow"); + $pmTablePeer = $pmTableName . 'Peer'; + $criteria->add($pmTablePeer::APP_UID, $applicationUid); + $pmTablePeer::doDelete($criteria); + } catch (Exception $e) { + $context = Bootstrap::getDefaultContextLog(); + $context['appUid'] = $applicationUid; + $context['proUid'] = $applicationFields["PRO_UID"]; + $context['reportTable'] = $tableName; + Bootstrap::registerMonolog('DeleteCases', 400, $e->getMessage(), $context); + } } } } @@ -7162,5 +7316,183 @@ private function putCaseInInboxList(array $caseDataRow, $targetUserId) $caseDataRow["USR_UID"] = $targetUserId; $listInbox->create($caseDataRow); } + + /** + * Obtains the task information and the user delegated to the task for an specific case + * + * @param string $applicationUid + * @param string $processUid + * + * @see /workflow/engine/src/ProcessMaker/BusinessModel/Cases::getTasks($applicationUid) + * + * @return ResultSet + * @throws Exception + * + */ + public function getTasksInfoForACase($applicationUid, $processUid) + { + $conn = Propel::getConnection('workflow'); + + $sql = 'SELECT TASK.TAS_UID, TASK.TAS_TITLE, TASK.TAS_DESCRIPTION, TASK.TAS_START, + TASK.TAS_TYPE, TASK.TAS_DERIVATION, TASK.TAS_ASSIGN_TYPE, APP.USR_UID, USERS.USR_USERNAME, + USERS.USR_FIRSTNAME, USERS.USR_LASTNAME + FROM TASK LEFT JOIN (SELECT * FROM APP_DELEGATION WHERE APP_DELEGATION.APP_UID = ?) AS APP + ON TASK.TAS_UID = APP.TAS_UID LEFT JOIN USERS + ON (SELECT USR_UID FROM APP_DELEGATION WHERE APP_UID = ? AND TAS_UID = TASK.TAS_UID ORDER BY DEL_INDEX DESC LIMIT 1) = USERS.USR_UID + WHERE TASK.PRO_UID = ?'; + + $stmt = $conn->prepareStatement($sql); + + $stmt->set(1, $applicationUid); + $stmt->set(2, $applicationUid); + $stmt->set(3, $processUid); + + if (!$stmt->executeQuery()) { + throw Exception(G::LoadTranslation('ID_MSG_AJAX_FAILURE')); + } + + return $stmt->getResultSet(); + } + + /** + * Get the task information when the task is a sub-process + * + * @param string $processUid + * @param string $tasUid + * + * @see /workflow/engine/src/ProcessMaker/BusinessModel/Cases::getTasks($applicationUid) + * + * @return ResultSet + */ + public function getTaskInfoForSubProcess($processUid, $tasUid) + { + $criteria = new Criteria("workflow"); + + $criteria->addSelectColumn(SubProcessPeer::PRO_UID); + $criteria->addSelectColumn(TaskPeer::TAS_TITLE); + $criteria->addSelectColumn(TaskPeer::TAS_DESCRIPTION); + $criteria->addJoin(SubProcessPeer::TAS_PARENT, TaskPeer::TAS_UID, Criteria::LEFT_JOIN); + $criteria->add(SubProcessPeer::PRO_PARENT, $processUid); + $criteria->add(SubProcessPeer::TAS_PARENT, $tasUid); + + $rsCriteria = SubProcessPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + return $rsCriteria; + } + + /** + * Get the routes of a task + * + * @param string $processUid + * @param string $tasUid + * + * @see /workflow/engine/src/ProcessMaker/BusinessModel/Cases::getTasks($applicationUid) + * + * @return ResultSet + */ + public function getTaskRoutes($processUid, $tasUid) + { + $criteria = new Criteria("workflow"); + + $criteria->addAsColumn("ROU_NUMBER", RoutePeer::ROU_CASE); + $criteria->addSelectColumn(RoutePeer::ROU_TYPE); + $criteria->addSelectColumn(RoutePeer::ROU_CONDITION); + $criteria->addAsColumn("TAS_UID", RoutePeer::ROU_NEXT_TASK); + $criteria->add(RoutePeer::PRO_UID, $processUid, Criteria::EQUAL); + $criteria->add(RoutePeer::TAS_UID, $tasUid, Criteria::EQUAL); + $criteria->addAscendingOrderByColumn("ROU_NUMBER"); + + $rsCriteria = RoutePeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + return $rsCriteria; + } + + /** + * Get the delegations of an specific case + * + * @param string $applicationUid + * @param string $tasUid + * + * @see /workflow/engine/src/ProcessMaker/BusinessModel/Cases::getTasks($applicationUid) + * + * @return ResultSet + */ + public function getCaseDelegations($applicationUid, $tasUid) + { + $criteria = new Criteria("workflow"); + + $criteria->addSelectColumn(AppDelegationPeer::DEL_INDEX); + $criteria->addSelectColumn(AppDelegationPeer::DEL_DELEGATE_DATE); + $criteria->addSelectColumn(AppDelegationPeer::DEL_INIT_DATE); + $criteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); + $criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); + $criteria->addSelectColumn(UsersPeer::USR_UID); + $criteria->addSelectColumn(UsersPeer::USR_USERNAME); + $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); + $criteria->addSelectColumn(UsersPeer::USR_LASTNAME); + + $criteria->addJoin(AppDelegationPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); + + $criteria->add(AppDelegationPeer::APP_UID, $applicationUid, Criteria::EQUAL); + $criteria->add(AppDelegationPeer::TAS_UID, $tasUid, Criteria::EQUAL); + $criteria->addAscendingOrderByColumn(AppDelegationPeer::DEL_INDEX); + + $rsCriteria = AppDelegationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + return $rsCriteria; + } + + /** + * Get the total amount and the minimun date of the Delegation table for an specific case + * + * @param string $applicationUid + * @param string $tasUid + * + * @see /workflow/engine/src/ProcessMaker/BusinessModel/Cases::getTasks($applicationUid) + * + * @return ResultSet + */ + public function getTotalAndMinDateForACase($applicationUid, $tasUid) + { + $criteria = new Criteria("workflow"); + + $criteria->addAsColumn("CANT", "COUNT(" . AppDelegationPeer::APP_UID . ")"); + $criteria->addAsColumn("FINISH", "MIN(" . AppDelegationPeer::DEL_FINISH_DATE . ")"); + $criteria->add(AppDelegationPeer::APP_UID, $applicationUid, Criteria::EQUAL); + $criteria->add(AppDelegationPeer::TAS_UID, $tasUid, Criteria::EQUAL); + + $rsCriteria = AppDelegationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + return $rsCriteria; + } + + /** + * Get the DEL_FINISH_DATE of the Delegation table of an specific task in a case + * + * @param string $applicationUid + * @param string $tasUid + * + * @see /workflow/engine/src/ProcessMaker/BusinessModel/Cases::getTasks($applicationUid) + * + * @return ResultSet + */ + public function getDelegationFinishDate($applicationUid, $tasUid) + { + $criteria = new Criteria("workflow"); + + $criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); + $criteria->add(AppDelegationPeer::APP_UID, $applicationUid, Criteria::EQUAL); + $criteria->add(AppDelegationPeer::TAS_UID, $tasUid, Criteria::EQUAL); + $criteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); + + $rsCriteria = AppDelegationPeer::doSelectRS($criteria); + $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + return $rsCriteria; + } } diff --git a/workflow/engine/classes/DbConnections.php b/workflow/engine/classes/DbConnections.php index 22962ec0f..784d97230 100644 --- a/workflow/engine/classes/DbConnections.php +++ b/workflow/engine/classes/DbConnections.php @@ -194,7 +194,7 @@ public static function loadAdditionalConnections($force = false) $conf = Propel::getConfiguration(); // Iterate through the datasources of configuration, and only care about workflow, rbac or rp. Remove anything else. foreach ($conf['datasources'] as $key => $val) { - if (!in_array($key, ['workflow', 'rbac', 'rp'])) { + if (!in_array($key, ['workflow', 'rbac', 'rp', 'dbarray'])) { unset($conf['datasources'][$key]); } } diff --git a/workflow/engine/classes/Derivation.php b/workflow/engine/classes/Derivation.php index d45f3bd71..5f7cf9efd 100644 --- a/workflow/engine/classes/Derivation.php +++ b/workflow/engine/classes/Derivation.php @@ -179,6 +179,7 @@ public function prepareInformation(array $arrayData, $taskUid = "") $pmScript = new PMScript(); $pmScript->setFields($arrayApplicationData["APP_DATA"]); $pmScript->setScript($arrayRouteData["ROU_CONDITION"]); + $pmScript->setExecutedOn(PMScript::CONDITION); $flagAddDelegation = $pmScript->evaluate(); } @@ -662,14 +663,19 @@ function setTasLastAssigned ($tasUid, $usrUid) /** * Execute Event * - * @param string $dummyTaskUid Unique id of Element Origin (unique id of Task) This is the nextTask - * @param array $applicationData Case data - * @param bool $flagEventExecuteBeforeGateway Execute event before gateway - * @param bool $flagEventExecuteAfterGateway Execute event after gateway + * @param string $dummyTaskUid Unique id of Element Origin (unique id of Task) This is the nextTask + * @param array $applicationData Case data + * @param bool $flagEventExecuteBeforeGateway Execute event before gateway + * @param bool $flagEventExecuteAfterGateway Execute event after gateway + * @param int $taskId * * @return void + * @see Derivation->derivate() + * @see Derivation->doRouteWithoutThread() + * @see Derivation->finishProcess() + * @see Derivation->finishTask() */ - private function executeEvent($dummyTaskUid, array $applicationData, $flagEventExecuteBeforeGateway = true, $flagEventExecuteAfterGateway = true, $elementOriUid='') + private function executeEvent($dummyTaskUid, array $applicationData, $flagEventExecuteBeforeGateway = true, $flagEventExecuteAfterGateway = true, $elementOriUid='',$tasId = 0) { try { //Verify if the Project is BPMN @@ -742,7 +748,7 @@ private function executeEvent($dummyTaskUid, array $applicationData, $flagEventE if (preg_match("/^(?:END|INTERMEDIATE)$/", $event->getEvnType()) && $event->getEvnMarker() === 'EMAIL') { //Email-Event throw - $result = $emailEvent->sendEmail($applicationData["APP_UID"], $applicationData["PRO_UID"], $value['uid'], $applicationData); + $result = $emailEvent->sendEmail($applicationData["APP_UID"], $applicationData["PRO_UID"], $value['uid'], $applicationData, $tasId); $aContext['envUid'] = $value['uid']; $aContext['envType'] = $event->getEvnType(); @@ -816,7 +822,8 @@ function beforeDerivate($aDataForPrepareInfo, $tasks, $rouType, $aCurrentDerivat return $arrayDerivationResult; } - /** Route the case + /** + * Route the case * If need to create another thread we can execute the doDerivate * * @param array $currentDelegation @@ -824,7 +831,11 @@ function beforeDerivate($aDataForPrepareInfo, $tasks, $rouType, $aCurrentDerivat * @param bool $removeList * * @return void - * @throws /Exception + * @throws Exception + * + * @see beforeDerivate() + * @see doDerivation() + * @see verifyIsCaseChild() */ function derivate(array $currentDelegation, array $nextDelegations, $removeList = true) { @@ -854,6 +865,9 @@ function derivate(array $currentDelegation, array $nextDelegations, $removeList //We close the current derivation, then we'll try to derivate to each defined route $this->case->CloseCurrentDelegation( $currentDelegation['APP_UID'], $currentDelegation['DEL_INDEX'] ); + //Set THE APP_STATUS + $appFields['APP_STATUS'] = $currentDelegation['APP_STATUS']; + //Get data for current delegation (current Task) $task = TaskPeer::retrieveByPK($currentDelegation["TAS_UID"]); $bpmnActivity = BpmnActivityPeer::retrieveByPK($currentDelegation["TAS_UID"]); @@ -994,7 +1008,8 @@ function derivate(array $currentDelegation, array $nextDelegations, $removeList $appFields, true, true, - $currentDelegation["TAS_UID"] + $currentDelegation["TAS_UID"], + !empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0 ); //Route the case @@ -1017,6 +1032,9 @@ function derivate(array $currentDelegation, array $nextDelegations, $removeList break; default: $iNewDelIndex = $this->doDerivation($currentDelegation, $nextDel, $appFields, $aSP); + //Load Case Data again because the information could be change in method "doDerivation" + $verifyApplication = $this->case->loadCase($currentDelegation['APP_UID']); + $appFields['APP_DATA'] = $verifyApplication['APP_DATA']; //When the users route the case in the same time if($iNewDelIndex !== 0){ $arrayDerivationResult[] = [ @@ -1086,17 +1104,12 @@ function derivate(array $currentDelegation, array $nextDelegations, $removeList unset($aSP); } - /* Start Block : UPDATES APPLICATION */ - //Set THE APP_STATUS - $appFields['APP_STATUS'] = $currentDelegation['APP_STATUS']; /* Start Block : Count the open threads of $currentDelegation['APP_UID'] */ $openThreads = $this->case->GetOpenThreads( $currentDelegation['APP_UID'] ); - $flagUpdateCase = false; - //check if there is any paused thread - + //Check if there is any paused thread $existThreadPaused = false; if (isset($arraySiblings['pause'])) { if (!empty($arraySiblings['pause'])) { @@ -1839,7 +1852,15 @@ public function finishTask($currentDelegation, $nextDel, $appFields, $flagFirstI if (preg_match("/^(?:END-MESSAGE-EVENT|END-EMAIL-EVENT)$/", $taskDummy->getTasType()) && $multiInstanceCompleted && $executeEvent ) { - $this->executeEvent($nextDel["TAS_UID_DUMMY"], $appFields, $flagFirstIteration, true); + $nextDel["TAS_ID"] = $taskDummy->getTasId(); + $this->executeEvent( + $nextDel["TAS_UID_DUMMY"], + $appFields, + $flagFirstIteration, + true, + '', + !empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0 + ); } } $aContext['action'] = 'finish-task'; @@ -1866,12 +1887,27 @@ public function finishProcess($currentDelegation, $nextDel, $appFields, $flagFir $nextDel['ROU_CONDITION'] = ''; } //Execute the Intermediate Event After the End of Process - $this->executeEvent($nextDel["TAS_UID"], $appFields, true, true); + $this->executeEvent( + $nextDel["TAS_UID"], + $appFields, + true, + true, + '', + !empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0 + ); if (isset($nextDel["TAS_UID_DUMMY"]) ) { $taskDummy = TaskPeer::retrieveByPK($nextDel["TAS_UID_DUMMY"]); if (preg_match("/^(?:END-MESSAGE-EVENT|END-EMAIL-EVENT)$/", $taskDummy->getTasType())) { + $nextDel["TAS_ID"] = $taskDummy->getTasId(); //Throw Events - $this->executeEvent($nextDel["TAS_UID_DUMMY"], $appFields, $flagFirstIteration, true); + $this->executeEvent( + $nextDel["TAS_UID_DUMMY"], + $appFields, + $flagFirstIteration, + true, + '', + !empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0 + ); } } $aContext['action'] = 'end-process'; @@ -2193,7 +2229,14 @@ public function doRouteWithoutThread($appFields, $currentDelegation, $nextDel, $ //If the all Siblings are done execute the events if (sizeof($arraySiblings) === 0 && !$flagTypeMultipleInstance) { //Throw Events - $this->executeEvent($nextDel["TAS_UID"], $appFields, $flagFirstIteration, false); + $this->executeEvent( + $nextDel["TAS_UID"], + $appFields, + $flagFirstIteration, + false, + '', + !empty($nextDel["TAS_ID"]) ? $nextDel["TAS_ID"] : 0 + ); } //Close thread $this->case->closeAppThread( $currentDelegation['APP_UID'], $iAppThreadIndex ); diff --git a/workflow/engine/classes/Groups.php b/workflow/engine/classes/Groups.php index b00b776b1..08b393881 100644 --- a/workflow/engine/classes/Groups.php +++ b/workflow/engine/classes/Groups.php @@ -74,6 +74,44 @@ public function getActiveGroupsForAnUser($sUserUID) } } + /** + * Get the IDs of the active groups for an user + * + * @param string $usrUid + * + * @return array + * @throws Exception + */ + public function getActiveGroupsForAnUserById($usrUid) + { + try { + $criteria = new Criteria(); + $criteria->addSelectColumn(GroupUserPeer::GRP_ID); + $criteria->addJoin(GroupUserPeer::GRP_ID, GroupwfPeer::GRP_ID, Criteria::LEFT_JOIN); + //@todo: we need to add a new column GROUP_USER.USR_ID + $criteria->add(GroupUserPeer::USR_UID, $usrUid); + //@todo: we need to add a new column GROUPWF.GRP_STATUS_ID + $criteria->add(GroupwfPeer::GRP_STATUS, 'ACTIVE'); + $dataset = GroupUserPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + + //If the user does not relate with any group we will to return a default value for avoiding problems with the IN + $groups = [-1]; + $row = $dataset->getRow(); + while (is_array($row)) { + $groups[] = $row['GRP_ID']; + $dataset->next(); + $row = $dataset->getRow(); + } + + return $groups; + } catch (Exception $error) { + throw ($error); + } + } + + /** * Set a user to group * diff --git a/workflow/engine/classes/JavaBridgePM.php b/workflow/engine/classes/JavaBridgePM.php index ca64882ce..ea3d8ffc4 100644 --- a/workflow/engine/classes/JavaBridgePM.php +++ b/workflow/engine/classes/JavaBridgePM.php @@ -1,5 +1,7 @@ assign( 'heightDetail', count( $xmlFields ) * 15 + 20 ); $template->assign( 'PAGE_NUMBER', '{PAGE_NUMBER}' ); - $logoReporte = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/images/processmaker.logo.jpg'; + $logoReporte = System::getServerProtocolHost() . '/images/processmaker.logo.jpg'; $template->assign( 'logoReporte', $logoReporte ); foreach ($xmlFields as $key => $val) { diff --git a/workflow/engine/classes/License_Application.php b/workflow/engine/classes/License_Application.php index 93edf4462..f93cbf14f 100644 --- a/workflow/engine/classes/License_Application.php +++ b/workflow/engine/classes/License_Application.php @@ -27,12 +27,18 @@ class license_application extends Padl * * @access public * @param $use_mcrypt boolean Determines if mcrypt encryption is used or not (defaults to true, - * however if mcrypt is not available, it is set to false) + * however if mcrypt is not available, it is set to false) * @param $use_time boolean Sets if time binding should be used in the key (defaults to true) * @param $use_server boolean Sets if server binding should be used in the key (defaults to true) * @param $allow_local boolean Sets if server binding is in use then localhost servers are valid (defaults to false) - * */ - public function license_application($license_path = 'license.dat', $use_mcrypt = true, $use_time = true, $use_server = true, $allow_local = false, $challenge = false) + * + * @see PmLicenseManager::__construct() + * @see PmLicenseManager::installLicense() + * @see PmLicenseManager::validateLicense() + * @link https://wiki.processmaker.com/3.2/Enterprise_Manager_Tool#Importing_a_License + * @link https://wiki.processmaker.com/3.2/Upgrading_ProcessMaker#Activating_the_License + */ + public function __construct($license_path = 'license.dat', $use_mcrypt = true, $use_time = true, $use_server = true, $allow_local = false, $challenge = false) { //Check to see if the class has been secured if (isset($_SESSION)) { @@ -145,15 +151,15 @@ public function _get_os_var($var_name, $os) * * @access private * @return string config file data - * */ + * @see _get_ip_address() + * @see _get_mac_address() + */ public function _get_config() { # check to see if the class has been secured $this->_check_secure(); - if (ini_get('safe_mode')) { - # returns invalid because server is in safe mode thus not allowing - # sbin reads but will still allow it to open. a bit weird that one. - return 'SAFE_MODE'; + if (!$this->USE_SERVER) { + return 'NOT_USE_SERVER_CONFIG'; } # if anyone has any clues for windows environments # or other server types let me know @@ -198,15 +204,17 @@ public function _get_config() * @return array IP Address(s) if found (Note one machine may have more than one ip) * @return string ERROR_OPEN means config can't be found and thus not opened * @return string IP_404 means ip adress doesn't exist in the config file and can't be found in the $_SERVER - * @return string SAFE_MODE means server is in safe mode so config can't be read - * */ + * @return string NOT_USE_SERVER_CONFIG the server configuration is not used in license validation. + * + * @see set_server_vars() + */ public function _get_ip_address() { $ips = array(); # get the cofig file $conf = $this->_get_config(); # if the conf has returned and error return it - if ($conf != 'SAFE_MODE' && $conf != 'ERROR_OPEN') { + if ($conf != 'NOT_USE_SERVER_CONFIG' && $conf != 'ERROR_OPEN') { # if anyone has any clues for windows environments # or other server types let me know $os = strtolower(PHP_OS); @@ -266,7 +274,7 @@ public function _get_ip_address() return $ips; } # failed to find an ip check for conf error or return 404 - if ($conf == 'SAFE_MODE' || $conf == 'ERROR_OPEN') { + if ($conf == 'NOT_USE_SERVER_CONFIG' || $conf == 'ERROR_OPEN') { return $conf; } return 'IP_404'; @@ -283,8 +291,10 @@ public function _get_ip_address() * @return string Mac address if found * @return string ERROR_OPEN means config can't be found and thus not opened * @return string MAC_404 means mac adress doesn't exist in the config file - * @return string SAFE_MODE means server is in safe mode so config can't be read - * */ + * @return string NOT_USE_SERVER_CONFIG the server configuration is not used in license validation. + * + * @see __construct() + */ public function _get_mac_address() { # open the config file diff --git a/workflow/engine/classes/Net.php b/workflow/engine/classes/Net.php index c410abeed..d5950d92e 100644 --- a/workflow/engine/classes/Net.php +++ b/workflow/engine/classes/Net.php @@ -253,14 +253,7 @@ public function tryConnectServer($pDbDriver, array $arrayServerData = array(), $ break; case 'mssql': //todo - if (!extension_loaded('sqlsrv')) { - if ($this->db_instance != "") { - $link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd); - } else { - $port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port; - $link = @mssql_connect($this->ip . $port, $this->db_user, $this->db_passwd); - } - } else { + if (extension_loaded('sqlsrv')) { if ($this->db_instance != "") { $server = $this->ip . "\\" . $this->db_instance; } else { @@ -274,6 +267,13 @@ public function tryConnectServer($pDbDriver, array $arrayServerData = array(), $ 'Database' => $this->db_sourcename ]; $link = @sqlsrv_connect($server, $opt); + } else { + if ($this->db_instance != "") { + $link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd); + } else { + $port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port; + $link = @mssql_connect($this->ip . $port, $this->db_user, $this->db_passwd); + } } if ($link) { @@ -397,14 +397,7 @@ public function tryOpenDataBase($pDbDriver, array $arrayServerData = array(), $d } break; case 'mssql': - if (!extension_loaded('sqlsrv')) { - if ($this->db_instance != "") { - $link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd); - } else { - $port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port; - $link = @mssql_connect($this->ip . $port, $this->db_user, $this->db_passwd); - } - } else { + if (extension_loaded('sqlsrv')) { if ($this->db_instance != "") { $server = $this->ip . "\\" . $this->db_instance; } else { @@ -418,6 +411,13 @@ public function tryOpenDataBase($pDbDriver, array $arrayServerData = array(), $d 'Database' => $this->db_sourcename ]; $link = $db = @sqlsrv_connect($server, $opt); + } else { + if ($this->db_instance != "") { + $link = @mssql_connect($this->ip . "\\" . $this->db_instance, $this->db_user, $this->db_passwd); + } else { + $port = (($this->db_port == "") || ($this->db_port == 0) || ($this->db_port == 1433)) ? "" : ":" . $this->db_port; + $link = @mssql_connect($this->ip . $port, $this->db_user, $this->db_passwd); + } } if ($link) { if (!extension_loaded('sqlsrv')) { diff --git a/workflow/engine/classes/PmDynaform.php b/workflow/engine/classes/PmDynaform.php index f614521d3..0cb611a06 100644 --- a/workflow/engine/classes/PmDynaform.php +++ b/workflow/engine/classes/PmDynaform.php @@ -64,6 +64,9 @@ public function __construct($fields = array()) $this->jsonReplace($json, $field->id, "id", $field); } $this->record["DYN_CONTENT"] = G::json_encode($json); + + //to do, this line should be removed. Related to PMC-196. + $this->record['DYN_CONTENT'] = G::fixStringCorrupted($this->record['DYN_CONTENT']); } } @@ -1039,7 +1042,7 @@ public function printTracker() }, token: credentials, submitRest: false, - googleMaps: googleMaps + googleMaps: typeof googleMaps !== 'undefined' ? googleMaps : null }); $(document).find(\"form\").submit(function (e) { e.preventDefault(); @@ -1101,7 +1104,7 @@ public function printView() " },\n" . " token: credentials,\n" . " submitRest: false,\n" . - " googleMaps: googleMaps\n" . + " googleMaps: typeof googleMaps !== 'undefined' ? googleMaps : null\n" . " });\n" . " $(document).find('form').find('button').on('click', function (e) {\n" . " e.preventDefault();\n" . @@ -1129,23 +1132,7 @@ public function printEdit() if (!isset($this->fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["PREVIOUS_STEP"])) { $this->fields["APP_DATA"]["__DYNAFORM_OPTIONS"]["PREVIOUS_STEP"] = ""; } - $msg = ""; - if (isset($_SESSION['G_MESSAGE_TYPE']) && isset($_SESSION['G_MESSAGE'])) { - $color = "green"; - if ($_SESSION['G_MESSAGE_TYPE'] === "ERROR") { - $color = "red"; - } - if ($_SESSION['G_MESSAGE_TYPE'] === "WARNING") { - $color = "#C3C380"; - } - if ($_SESSION['G_MESSAGE_TYPE'] === "INFO") { - $color = "green"; - } - $msg = "
" . $_SESSION['G_MESSAGE_TYPE'] . ": " . $_SESSION['G_MESSAGE'] . "
"; - unset($_SESSION['G_MESSAGE_TYPE']); - unset($_SESSION['G_MESSAGE']); - } - $title = $msg . + $title = $this->getSessionMessage() . "\n" . " \n" . " \n" . @@ -1196,19 +1183,8 @@ public function printEdit() public function printEditSupervisor() { ob_clean(); - $json = G::json_decode($this->record["DYN_CONTENT"]); $this->jsonr($json); - - $msg = ""; - - if (isset($_SESSION["G_MESSAGE_TYPE"]) && isset($_SESSION["G_MESSAGE"])) { - $msg = "
" . G::LoadTranslation("ID_INFO") . ": " . $_SESSION["G_MESSAGE"] . "
"; - - unset($_SESSION["G_MESSAGE_TYPE"]); - unset($_SESSION["G_MESSAGE"]); - } - $javascrip = " - -
- $msg + " . $this->getSessionMessageForSupervisor() . "
@@ -1320,6 +1294,7 @@ public function printABE($filename, $record) $this->getTheStringVariableForGoogleMaps() . "\n" . "\n" . "\n" . + $this->getSessionMessage() . "
\n" . " \n" . " \n" . @@ -1356,9 +1331,20 @@ public function printPmDynaform($js = "") exit(); } + /** + * Print PmDynaform for Action by Email. + * + * @param array $record + * @return string + * + * @see ActionsByEmailCoreClass->sendActionsByEmail() + * @link https://wiki.processmaker.com/3.3/Actions_by_Email + */ public function printPmDynaformAbe($record) { - ob_clean(); + if (ob_get_length() > 0) { + ob_clean(); + } $this->record = $record; $json = G::json_decode($this->record["DYN_CONTENT"]); $this->jsonr($json); @@ -1507,12 +1493,21 @@ private function jsons(&$json, $newVariable, $oldVariable) } } + /** + * Sync JSON definition of the Forms with Input Document information + * in all forms from a process + * + * @param string $processUid + * @param array $inputDocument + */ public function synchronizeInputDocument($processUid, $inputDocument) { - $criteria = new Criteria("workflow"); + $criteria = new Criteria('workflow'); $criteria->addSelectColumn(DynaformPeer::DYN_UID); $criteria->addSelectColumn(DynaformPeer::DYN_CONTENT); $criteria->add(DynaformPeer::PRO_UID, $processUid, Criteria::EQUAL); + // Only select the forms with an input document related to a field + $criteria->add(DynaformPeer::DYN_CONTENT, '%"sizeUnity":%', Criteria::LIKE); $rsCriteria = DynaformPeer::doSelectRS($criteria); $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); while ($rsCriteria->next()) { @@ -1524,7 +1519,7 @@ public function synchronizeInputDocument($processUid, $inputDocument) if ($json2 !== $aRow['DYN_CONTENT']) { $con = Propel::getConnection(DynaformPeer::DATABASE_NAME); $con->begin(); - $oPro = DynaformPeer::retrieveByPk($aRow["DYN_UID"]); + $oPro = DynaformPeer::retrieveByPk($aRow['DYN_UID']); $oPro->setDynContent($json2); $oPro->save(); $con->commit(); @@ -1532,6 +1527,13 @@ public function synchronizeInputDocument($processUid, $inputDocument) } } + /** + * Replace values from an Input Document related to the form, + * for fields of type "file" and "multipleFile" + * + * @param object $json + * @param array $inputDocument + */ private function jsonsid(&$json, $inputDocument) { foreach ($json as $key => $value) { @@ -1541,15 +1543,8 @@ private function jsonsid(&$json, $inputDocument) $this->jsonsid($value, $inputDocument); } if (!$sw1 && !$sw2) { - if ($key === "type" && $json->type === "file" && $json->variable !== "") { - $a = new Criteria("workflow"); - $a->addSelectColumn(ProcessVariablesPeer::INP_DOC_UID); - $a->add(ProcessVariablesPeer::VAR_NAME, $json->variable, Criteria::EQUAL); - $ds = DynaformPeer::doSelectRS($a); - $ds->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $ds->next(); - $row = $ds->getRow(); - if (isset($row) && $row["INP_DOC_UID"] === $inputDocument["INP_DOC_UID"]) { + if ($key === "type" && ($json->type === "file" || $json->type === "multipleFile") && isset($json->inp_doc_uid)) { + if ($json->inp_doc_uid === $inputDocument["INP_DOC_UID"]) { if (isset($json->size)) { $json->size = $inputDocument["INP_DOC_MAX_FILESIZE"]; } @@ -1560,6 +1555,8 @@ private function jsonsid(&$json, $inputDocument) $json->extensions = $inputDocument["INP_DOC_TYPE_FILE"]; } } + } else if ($key === "type" && $json->type === "grid" && !empty($json->columns)) { + $this->jsonsid($json->columns, $inputDocument); } } } @@ -2213,4 +2210,53 @@ private function getTheStringVariableForGoogleMaps() $result = 'var googleMaps = ' . G::json_encode($googleMaps) . ';'; return $result; } + + /** + * Get session message. + * + * @return string + * + * @see PmDynaform->printEdit() + * @see PmDynaform->printABE() + * @link https://wiki.processmaker.com/3.1/Multiple_File_Uploader#File_Extensions + */ + public function getSessionMessage() + { + $message = ""; + if (isset($_SESSION['G_MESSAGE_TYPE']) && isset($_SESSION['G_MESSAGE'])) { + $color = "green"; + if ($_SESSION['G_MESSAGE_TYPE'] === "ERROR") { + $color = "red"; + } + if ($_SESSION['G_MESSAGE_TYPE'] === "WARNING") { + $color = "#C3C380"; + } + if ($_SESSION['G_MESSAGE_TYPE'] === "INFO") { + $color = "green"; + } + $message = "
" . $_SESSION['G_MESSAGE_TYPE'] . ": " . $_SESSION['G_MESSAGE'] . "
"; + unset($_SESSION['G_MESSAGE_TYPE']); + unset($_SESSION['G_MESSAGE']); + } + return $message; + } + + /** + * Get session message for supervisor. + * + * @return string + * + * @see PmDynaform->printEditSupervisor(); + * @link https://wiki.processmaker.com/3.1/Multiple_File_Uploader#File_Extensions + */ + public function getSessionMessageForSupervisor() + { + $message = ""; + if (isset($_SESSION["G_MESSAGE_TYPE"]) && isset($_SESSION["G_MESSAGE"])) { + $message = "
" . G::LoadTranslation("ID_INFO") . ": " . $_SESSION["G_MESSAGE"] . "
"; + unset($_SESSION["G_MESSAGE_TYPE"]); + unset($_SESSION["G_MESSAGE"]); + } + return $message; + } } diff --git a/workflow/engine/classes/PmTable.php b/workflow/engine/classes/PmTable.php index b6e7eb075..11a1e7490 100644 --- a/workflow/engine/classes/PmTable.php +++ b/workflow/engine/classes/PmTable.php @@ -1006,4 +1006,24 @@ public function addPMFieldsToList($action) } return $oCriteria; } + + /** + * Get the type of the column ex: string, int, double, boolean + * + * @param string $pmTablePeer + * @param string $tableName + * @param string $columnName + * + * @return string + */ + public static function getTypeOfColumn($pmTablePeer, $tableName, $columnName) + { + try { + $type = $pmTablePeer::getMapBuilder()->getDatabaseMap()->getTable($tableName)->getColumn($columnName)->getCreoleType(); + } catch (Exception $e) { + return ''; + } + + return $type; + } } diff --git a/workflow/engine/classes/ProcessMap.php b/workflow/engine/classes/ProcessMap.php index 5f8142c64..2f5ffedae 100644 --- a/workflow/engine/classes/ProcessMap.php +++ b/workflow/engine/classes/ProcessMap.php @@ -1,5 +1,6 @@ validatePath($currentDirectory); + $file = $filter->validatePath($file); + + // Validate the main directory + switch ($mainDirectory) { case 'mailTemplates': - $sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . ($sCurrentDirectory != '' ? $sCurrentDirectory . PATH_SEP : ''); + $sDirectory = PATH_DATA_MAILTEMPLATES . $processUid . PATH_SEP . ($currentDirectory != '' ? $currentDirectory . PATH_SEP : ''); break; case 'public': - $sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . ($sCurrentDirectory != '' ? $sCurrentDirectory . PATH_SEP : ''); + $sDirectory = PATH_DATA_PUBLIC . $processUid . PATH_SEP . ($currentDirectory != '' ? $currentDirectory . PATH_SEP : ''); break; default: die(); break; } - if (file_exists($sDirectory . $sFile)) { - G::streamFile($sDirectory . $sFile, true); + + // Stream the file if path exists + if (file_exists($sDirectory . $file)) { + G::streamFile($sDirectory . $file, true); } } @@ -4718,38 +4729,22 @@ public function listNewWebEntry($sProcessUID, $sEventUID) $task->load($task_uid); $task_name = $task->getTasTitle(); - if (G::is_https()) { - $http = 'https://'; - } else { - $http = 'http://'; - } - - $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sProcessUID . '/'; + $link = System::getServerMainPath() . '/' . $sProcessUID . '/'; $row = array(); $c = 0; - /* - $oTask = new Task ( ); - $TaskFields = $oTask->kgetassigType ( $sProcessUID , $tas=''); - */ $TaskFields['TAS_ASSIGN_TYPE'] = ''; - //$row [] = array ('W_TITLE' => '', 'W_DELETE' => '', 'TAS_ASSIGN_TYPE' => $TaskFields ['TAS_ASSIGN_TYPE'] ); - if (is_dir(PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP . $sProcessUID)) { $dir = opendir(PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP . $sProcessUID); $dynTitle = str_replace(' ', '_', str_replace('/', '_', $dynTitle)); $arlink = $link . $dynTitle . '.php'; - //$arlink = "" . $alink . ""; } } } $row = array('W_LINK' => $arlink, 'DYN_TITLE' => $dynTitle, 'TAS_TITLE' => $task_name, 'USR_UID' => $usr_uid_evn, 'DYN_UID' => $dynUid ); - // $oJSON = new Services_JSON ( ); - // $tmpData = $oJSON->encode( $row ) ; - // $tmpData = str_replace("\\/","/",'{success:true,data:'.$tmpData.'}'); // unescape the slashes - // $result = $tmpData; + $result = array(); $result['success'] = true; $result['data'] = $row; diff --git a/workflow/engine/classes/Processes.php b/workflow/engine/classes/Processes.php index 16b7646cd..1b6aca12a 100644 --- a/workflow/engine/classes/Processes.php +++ b/workflow/engine/classes/Processes.php @@ -1029,7 +1029,7 @@ public function renewAllDynaformGuid(&$oData) $oData->process['PRO_DYNAFORMS']['PROCESS'] = ''; } - if ($oData->process['PRO_DYNAFORMS']['PROCESS'] != '') { + if (!empty($oData->process['PRO_DYNAFORMS']['PROCESS']) && !empty($map[$oData->process['PRO_DYNAFORMS']['PROCESS']])) { $oData->process['PRO_DYNAFORMS']['PROCESS'] = $map[$oData->process['PRO_DYNAFORMS']['PROCESS']]; } @@ -1768,25 +1768,33 @@ public function createProcessCategoryRow($row) /** * Create "Process User" records * - * @param array $arrayData Data to create + * @param array $arrayData * - * return void + * @return void + * @throws Exception */ public function createProcessUser(array $arrayData) { try { - $processUser = new ProcessUser(); - - foreach ($arrayData as $value) { - $record = $value; - - if ($processUser->Exists($record["PU_UID"])) { - $result = $processUser->remove($record["PU_UID"]); - } - - $result = $processUser->create($record); - } + $con = Propel::getConnection(ProcessUserPeer::DATABASE_NAME); + $con->begin(); + foreach ($arrayData as $row) { + //Prepare the delete + $criteria = new Criteria(ProcessUserPeer::DATABASE_NAME); + $criteria->addSelectColumn('*'); + $criteria->add(ProcessUserPeer::PU_UID, $row['PU_UID']); + BasePeer::doDelete($criteria, $con); + //Prepare the insert + $criteria = new Criteria(ProcessUserPeer::DATABASE_NAME); + $criteria->add(ProcessUserPeer::PU_UID, $row['PU_UID']); + $criteria->add(ProcessUserPeer::PRO_UID, $row['PRO_UID']); + $criteria->add(ProcessUserPeer::USR_UID, $row['USR_UID']); + $criteria->add(ProcessUserPeer::PU_TYPE, $row['PU_TYPE']); + BasePeer::doInsert($criteria, $con); + } + $con->commit(); } catch (Exception $e) { + $con->rollback(); throw $e; } } @@ -1832,23 +1840,41 @@ public function addNewProcessUser(array $arrayData) /** * Create "Process Variables" records * - * @param array $arrayData Data to create + * @param array $arrayData * - * return void + * @return void + * @throws Exception */ public function createProcessVariables(array $arrayData) { try { - foreach ($arrayData as $value) { - $processVariables = new ProcessVariables(); - $record = $value; - - if ($processVariables->Exists($record["VAR_UID"])) { - $result = $processVariables->remove($record["VAR_UID"]); - } - $result = $processVariables->create($record); - } + $con = Propel::getConnection(ProcessVariablesPeer::DATABASE_NAME); + $con->begin(); + foreach ($arrayData as $row) { + //Prepare the delete + $criteria = new Criteria(ProcessVariablesPeer::DATABASE_NAME); + $criteria->addSelectColumn('*'); + $criteria->add(ProcessVariablesPeer::VAR_UID, $row['VAR_UID']); + BasePeer::doDelete($criteria, $con); + //Prepare the insert + $criteria = new Criteria(ProcessVariablesPeer::DATABASE_NAME); + $criteria->add(ProcessVariablesPeer::VAR_UID, $row['VAR_UID']); + $criteria->add(ProcessVariablesPeer::PRJ_UID, $row['PRJ_UID']); + $criteria->add(ProcessVariablesPeer::VAR_NAME, $row['VAR_NAME']); + $criteria->add(ProcessVariablesPeer::VAR_FIELD_TYPE, $row['VAR_FIELD_TYPE']); + $criteria->add(ProcessVariablesPeer::VAR_FIELD_SIZE, $row['VAR_FIELD_SIZE']); + $criteria->add(ProcessVariablesPeer::VAR_LABEL, $row['VAR_LABEL']); + $criteria->add(ProcessVariablesPeer::VAR_DBCONNECTION, $row['VAR_DBCONNECTION']); + $criteria->add(ProcessVariablesPeer::VAR_SQL, $row['VAR_SQL']); + $criteria->add(ProcessVariablesPeer::VAR_NULL, $row['VAR_NULL']); + $criteria->add(ProcessVariablesPeer::VAR_DEFAULT, $row['VAR_DEFAULT']); + $criteria->add(ProcessVariablesPeer::VAR_ACCEPTED_VALUES, $row['VAR_ACCEPTED_VALUES']); + $criteria->add(ProcessVariablesPeer::INP_DOC_UID, $row['INP_DOC_UID']); + BasePeer::doInsert($criteria, $con); + } + $con->commit(); } catch (Exception $e) { + $con->rollback(); throw $e; } } @@ -1895,47 +1921,93 @@ public function addNewProcessVariables($arrayData) /** * Gets Input Documents Rows from aProcess. * - * @param $sProUid string. - * @return void + * @param string $proUid + * + * @return array + * @throws Exception */ - public function getInputRows($sProUid) + public function getInputRows($proUid) { try { - $aInput = array(); - $oCriteria = new Criteria('workflow'); - $oCriteria->add(InputDocumentPeer::PRO_UID, $sProUid); - $oDataset = InputDocumentPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - while ($aRow = $oDataset->getRow()) { - $oInput = new InputDocument(); - $aInput[] = $oInput->load($aRow['INP_DOC_UID']); - $oDataset->next(); + $inputList = []; + $criteria = new Criteria('workflow'); + $criteria->add(InputDocumentPeer::PRO_UID, $proUid); + $dataset = InputDocumentPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + while ($row = $dataset->getRow()) { + $input = new InputDocument(); + $infoInput = $input->load($row['INP_DOC_UID']); + unset($infoInput['INP_DOC_ID']); + $inputList[] = $infoInput; + $dataset->next(); } - return $aInput; - } catch (Exception $oError) { - throw ($oError); + + return $inputList; + } catch (Exception $error) { + throw ($error); } } /** - * Create Input Documents Rows from an array, removing those Objects - * with the same UID, and recreaiting the records from the array data. + * Create Input Documents + * + * @param array $input * - * @param $aInput array. * @return void + * @throws Exception */ - public function createInputRows($aInput) + public function createInputRows($input) { - foreach ($aInput as $key => $row) { - $oInput = new InputDocument(); - //unset ($row['TAS_UID']); - if ($oInput->InputExists($row['INP_DOC_UID'])) { - $oInput->remove($row['INP_DOC_UID']); - } - $res = $oInput->create($row); + try { + $con = Propel::getConnection(InputDocumentPeer::DATABASE_NAME); + $con->begin(); + foreach ($input as $key => $row) { + //Prepare the delete + $criteria = new Criteria(InputDocumentPeer::DATABASE_NAME); + $criteria->addSelectColumn('*'); + $criteria->add(InputDocumentPeer::INP_DOC_UID, $row['INP_DOC_UID']); + //Get the INP_DOC_ID column + $dataSet = BasePeer::doSelect($criteria, $con); + $dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); + if ($dataSet->next()) { + $inputInfo = $dataSet->getRow(); + $row['INP_DOC_ID'] = $inputInfo['INP_DOC_ID']; + } else { + $row['INP_DOC_ID'] = null; + } + BasePeer::doDelete($criteria, $con); + //Prepare the insert + $criteria = new Criteria(InputDocumentPeer::DATABASE_NAME); + $criteria->add(InputDocumentPeer::INP_DOC_ID, $row['INP_DOC_ID']); + $criteria->add(InputDocumentPeer::INP_DOC_UID, $row['INP_DOC_UID']); + $criteria->add(InputDocumentPeer::PRO_UID, $row['PRO_UID']); + $criteria->add(InputDocumentPeer::INP_DOC_TITLE, $row['INP_DOC_TITLE']); + $criteria->add(InputDocumentPeer::INP_DOC_DESCRIPTION, $row['INP_DOC_DESCRIPTION']); + $criteria->add(InputDocumentPeer::INP_DOC_FORM_NEEDED, $row['INP_DOC_FORM_NEEDED']); + $criteria->add(InputDocumentPeer::INP_DOC_ORIGINAL, $row['INP_DOC_ORIGINAL']); + $criteria->add(InputDocumentPeer::INP_DOC_PUBLISHED, $row['INP_DOC_PUBLISHED']); + $criteria->add(InputDocumentPeer::INP_DOC_VERSIONING, $row['INP_DOC_VERSIONING']); + $criteria->add(InputDocumentPeer::INP_DOC_DESTINATION_PATH, $row['INP_DOC_DESTINATION_PATH']); + $criteria->add(InputDocumentPeer::INP_DOC_TAGS, $row['INP_DOC_TAGS']); + $criteria->add(InputDocumentPeer::INP_DOC_TYPE_FILE, $row['INP_DOC_TYPE_FILE']); + $criteria->add(InputDocumentPeer::INP_DOC_MAX_FILESIZE, $row['INP_DOC_MAX_FILESIZE']); + $criteria->add(InputDocumentPeer::INP_DOC_MAX_FILESIZE_UNIT, $row['INP_DOC_MAX_FILESIZE_UNIT']); + BasePeer::doInsert($criteria, $con); + + //Insert in CONTENT + $labels = [ + 'INP_DOC_TITLE' => $row['INP_DOC_TITLE'], + 'INP_DOC_DESCRIPTION' => !empty($row['INP_DOC_DESCRIPTION']) ? $row['INP_DOC_DESCRIPTION'] : '' + ]; + $this->insertToContentTable($con, $labels, $row['INP_DOC_UID'], SYS_LANG); + } + $con->commit(); + } catch (Exception $e) { + $con->rollback(); + throw $e; } - return; + } /** @@ -2029,47 +2101,103 @@ public function renewAllInputGuid(&$oData) /** * Gets the Output Documents Rows from a Process. * - * @param $sProUid string. - * @return $aOutput array + * @param string $proUid + * + * @return array + * @throws Exception */ - public function getOutputRows($sProUid) + public function getOutputRows($proUid) { try { - $aOutput = array(); - $oCriteria = new Criteria('workflow'); - $oCriteria->add(OutputDocumentPeer::PRO_UID, $sProUid); - $oDataset = OutputDocumentPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - while ($aRow = $oDataset->getRow()) { - $oOutput = new OutputDocument(); - $aOutput[] = $oOutput->Load($aRow['OUT_DOC_UID']); - $oDataset->next(); + $outputList = []; + $criteria = new Criteria('workflow'); + $criteria->add(OutputDocumentPeer::PRO_UID, $proUid); + $dataset = OutputDocumentPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + while ($row = $dataset->getRow()) { + $output = new OutputDocument(); + $infoOutput = $output->Load($row['OUT_DOC_UID']); + unset($infoOutput['OUT_DOC_ID']); + $outputList[] = $infoOutput; + $dataset->next(); } - return $aOutput; - } catch (Exception $oError) { - throw ($oError); + + return $outputList; + } catch (Exception $error) { + throw ($error); } } /** - * Create Input Documents Rows from an array, removing those Objects - * with the same UID, and recreaiting the records from the array data. + * Create Input Documents + * + * @param array $output * - * @param $aOutput array. * @return void + * @throws Exception */ - public function createOutputRows($aOutput) + public function createOutputRows($output) { - foreach ($aOutput as $key => $row) { - $oOutput = new OutputDocument(); - //unset ($row['TAS_UID']); - if ($oOutput->OutputExists($row['OUT_DOC_UID'])) { - $oOutput->remove($row['OUT_DOC_UID']); - } - $res = $oOutput->create($row); + try { + $con = Propel::getConnection(OutputDocumentPeer::DATABASE_NAME); + $con->begin(); + foreach ($output as $key => $row) { + //Prepare the delete + $criteria = new Criteria(OutputDocumentPeer::DATABASE_NAME); + $criteria->addSelectColumn('*'); + $criteria->add(OutputDocumentPeer::OUT_DOC_UID, $row['OUT_DOC_UID']); + //Get the OUT_DOC_ID column + $dataSet = BasePeer::doSelect($criteria, $con); + $dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); + if ($dataSet->next()) { + $outputInfo = $dataSet->getRow(); + $row['OUT_DOC_ID'] = $outputInfo['OUT_DOC_ID']; + } else { + $row['OUT_DOC_ID'] = null; + } + BasePeer::doDelete($criteria, $con); + //Prepare the insert + $criteria = new Criteria(OutputDocumentPeer::DATABASE_NAME); + $criteria->add(OutputDocumentPeer::OUT_DOC_ID, $row['OUT_DOC_ID']); + $criteria->add(OutputDocumentPeer::OUT_DOC_UID, $row['OUT_DOC_UID']); + $criteria->add(OutputDocumentPeer::OUT_DOC_TITLE, $row['OUT_DOC_TITLE']); + $criteria->add(OutputDocumentPeer::OUT_DOC_DESCRIPTION, $row['OUT_DOC_DESCRIPTION']); + $criteria->add(OutputDocumentPeer::OUT_DOC_FILENAME, $row['OUT_DOC_FILENAME']); + $criteria->add(OutputDocumentPeer::OUT_DOC_TEMPLATE, $row['OUT_DOC_TEMPLATE']); + $criteria->add(OutputDocumentPeer::PRO_UID, $row['PRO_UID']); + $criteria->add(OutputDocumentPeer::OUT_DOC_REPORT_GENERATOR, $row['OUT_DOC_REPORT_GENERATOR']); + $criteria->add(OutputDocumentPeer::OUT_DOC_LANDSCAPE, $row['OUT_DOC_LANDSCAPE']); + $criteria->add(OutputDocumentPeer::OUT_DOC_MEDIA, $row['OUT_DOC_MEDIA']); + $criteria->add(OutputDocumentPeer::OUT_DOC_LEFT_MARGIN, $row['OUT_DOC_LEFT_MARGIN']); + $criteria->add(OutputDocumentPeer::OUT_DOC_RIGHT_MARGIN, $row['OUT_DOC_RIGHT_MARGIN']); + $criteria->add(OutputDocumentPeer::OUT_DOC_TOP_MARGIN, $row['OUT_DOC_TOP_MARGIN']); + $criteria->add(OutputDocumentPeer::OUT_DOC_BOTTOM_MARGIN, $row['OUT_DOC_BOTTOM_MARGIN']); + $criteria->add(OutputDocumentPeer::OUT_DOC_GENERATE, $row['OUT_DOC_GENERATE']); + $criteria->add(OutputDocumentPeer::OUT_DOC_CURRENT_REVISION, $row['OUT_DOC_CURRENT_REVISION']); + $criteria->add(OutputDocumentPeer::OUT_DOC_FIELD_MAPPING, $row['OUT_DOC_FIELD_MAPPING']); + $criteria->add(OutputDocumentPeer::OUT_DOC_VERSIONING, $row['OUT_DOC_VERSIONING']); + $criteria->add(OutputDocumentPeer::OUT_DOC_DESTINATION_PATH, $row['OUT_DOC_DESTINATION_PATH']); + $criteria->add(OutputDocumentPeer::OUT_DOC_TAGS, $row['OUT_DOC_TAGS']); + $criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_ENABLED, $row['OUT_DOC_PDF_SECURITY_ENABLED']); + $criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OPEN_PASSWORD, $row['OUT_DOC_PDF_SECURITY_OPEN_PASSWORD']); + $criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_OWNER_PASSWORD, $row['OUT_DOC_PDF_SECURITY_OWNER_PASSWORD']); + $criteria->add(OutputDocumentPeer::OUT_DOC_PDF_SECURITY_PERMISSIONS, $row['OUT_DOC_PDF_SECURITY_PERMISSIONS']); + $criteria->add(OutputDocumentPeer::OUT_DOC_OPEN_TYPE, $row['OUT_DOC_OPEN_TYPE']); + BasePeer::doInsert($criteria, $con); + + //Insert in CONTENT + $labels = ['OUT_DOC_TITLE' => $row['OUT_DOC_TITLE'], + 'OUT_DOC_DESCRIPTION' => !empty($row['OUT_DOC_DESCRIPTION']) ? $row['OUT_DOC_DESCRIPTION'] : '', + 'OUT_DOC_FILENAME' => $row['OUT_DOC_FILENAME'], + 'OUT_DOC_TEMPLATE' => !empty($row['OUT_DOC_TEMPLATE']) ? $row['OUT_DOC_TEMPLATE'] : '']; + $this->insertToContentTable($con, $labels, $row['OUT_DOC_UID'], SYS_LANG); + } + $con->commit(); + } catch (Exception $e) { + $con->rollback(); + throw $e; } - return; } /** @@ -2665,37 +2793,75 @@ public function getStepRowsByElement($sProUid, $element) /** * Create Step Rows from a Process * - * @param $aStep array. + * @param array $step + * * @return void. + * @throws Exception */ - public function createStepRows($aStep) + public function createStepRows($step) { - foreach ($aStep as $key => $row) { - $oStep = new Step(); - if (isset($row['STEP_UID'])) { - if ($oStep->StepExists($row['STEP_UID'])) { - $oStep->remove($row['STEP_UID']); + try { + $con = Propel::getConnection(StepPeer::DATABASE_NAME); + $con->begin(); + foreach ($step as $key => $row) { + if (isset($row['STEP_UID'])) { + //Prepare the delete + $criteria = new Criteria(StepPeer::DATABASE_NAME); + $criteria->addSelectColumn('*'); + $criteria->add(StepPeer::STEP_UID, $row['STEP_UID']); + BasePeer::doDelete($criteria, $con); + //Prepare the insert + $criteria = new Criteria(StepPeer::DATABASE_NAME); + $criteria->add(StepPeer::STEP_UID, $row['STEP_UID']); + $criteria->add(StepPeer::PRO_UID, $row['PRO_UID']); + $criteria->add(StepPeer::TAS_UID, $row['TAS_UID']); + $criteria->add(StepPeer::STEP_TYPE_OBJ, $row['STEP_TYPE_OBJ']); + $criteria->add(StepPeer::STEP_UID_OBJ, $row['STEP_UID_OBJ']); + $criteria->add(StepPeer::STEP_CONDITION, $row['STEP_CONDITION']); + $criteria->add(StepPeer::STEP_POSITION, $row['STEP_POSITION']); + $criteria->add(StepPeer::STEP_MODE, $row['STEP_MODE']); + BasePeer::doInsert($criteria, $con); } - $res = $oStep->create($row); } + $con->commit(); + } catch (Exception $e) { + $con->rollback(); + throw $e; } - return; } /** * Create Step Supervisor Rows for a Process from an array of data * - * @param $aStepSupervisor array. + * @param array $stepSupervisor + * * @return void. + * @throws Exception */ - public function createStepSupervisorRows($aStepSupervisor) + public function createStepSupervisorRows($stepSupervisor) { - foreach ($aStepSupervisor as $key => $row) { - $oStepSupervisor = new StepSupervisor(); - if ($oStepSupervisor->Exists($row['STEP_UID'])) { - $oStepSupervisor->remove($row['STEP_UID']); - } - $oStepSupervisor->create($row); + try { + $con = Propel::getConnection(StepSupervisorPeer::DATABASE_NAME); + $con->begin(); + foreach ($stepSupervisor as $key => $row) { + //Prepare the delete + $criteria = new Criteria(StepSupervisorPeer::DATABASE_NAME); + $criteria->addSelectColumn('*'); + $criteria->add(StepSupervisorPeer::STEP_UID, $row['STEP_UID']); + BasePeer::doDelete($criteria, $con); + //Prepare the insert + $criteria = new Criteria(StepSupervisorPeer::DATABASE_NAME); + $criteria->add(StepSupervisorPeer::STEP_UID, $row['STEP_UID']); + $criteria->add(StepSupervisorPeer::PRO_UID, $row['PRO_UID']); + $criteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, $row['STEP_TYPE_OBJ']); + $criteria->add(StepSupervisorPeer::STEP_UID_OBJ, $row['STEP_UID_OBJ']); + $criteria->add(StepSupervisorPeer::STEP_POSITION, $row['STEP_POSITION']); + BasePeer::doInsert($criteria, $con); + } + $con->commit(); + } catch (Exception $e) { + $con->rollback(); + throw $e; } } @@ -2764,26 +2930,31 @@ public function renewAllStepGuid(&$oData) /** * Get Dynaform Rows from a Process * - * @param string $sProUid - * @return $aDynaform array + * @param string $proUid + * + * @return array + * @throws Exception */ - public function getDynaformRows($sProUid) + public function getDynaformRows($proUid) { try { - $aDynaform = array(); - $oCriteria = new Criteria('workflow'); - $oCriteria->add(DynaformPeer::PRO_UID, $sProUid); - $oDataset = DynaformPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - while ($aRow = $oDataset->getRow()) { - $oDynaform = new Dynaform(); - $aDynaform[] = $oDynaform->Load($aRow['DYN_UID']); - $oDataset->next(); + $dynaformList = []; + $criteria = new Criteria('workflow'); + $criteria->add(DynaformPeer::PRO_UID, $proUid); + $dataset = DynaformPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + while ($row = $dataset->getRow()) { + $dynaform = new Dynaform(); + $infoDyn = $dynaform->Load($row['DYN_UID']); + unset($infoDyn['DYN_ID']); + $dynaformList[] = $infoDyn; + $dataset->next(); } - return $aDynaform; - } catch (Exception $oError) { - throw ($oError); + + return $dynaformList; + } catch (Exception $error) { + throw ($error); } } @@ -2906,22 +3077,60 @@ public function getGroupwfSupervisor($sProUid, &$oData) } /** - * Create Dynaform Rows for a Process form an array + * Create dynaforms for a process + * + * @param array $dynaforms * - * @param array $aDynaform * @return void + * @throws Exception */ - public function createDynaformRows($aDynaform) + public function createDynaformRows($dynaforms) { - foreach ($aDynaform as $key => $row) { - $oDynaform = new Dynaform(); - //unset ($row['TAS_UID']); - if ($oDynaform->exists($row['DYN_UID'])) { - $oDynaform->remove($row['DYN_UID']); - } - $res = $oDynaform->create($row); + try { + $con = Propel::getConnection(DynaformPeer::DATABASE_NAME); + $con->begin(); + foreach ($dynaforms as $key => $row) { + //Prepare the delete + $criteria = new Criteria(DynaformPeer::DATABASE_NAME); + $criteria->addSelectColumn('*'); + $criteria->add(DynaformPeer::DYN_UID, $row['DYN_UID']); + //Get the DYN_ID column + $dataSet = BasePeer::doSelect($criteria, $con); + $dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); + if ($dataSet->next()) { + $dynInfo = $dataSet->getRow(); + $row['DYN_ID'] = $dynInfo['DYN_ID']; + } else { + $row['DYN_ID'] = null; + } + BasePeer::doDelete($criteria, $con); + //Prepare the insert + $criteria = new Criteria(DynaformPeer::DATABASE_NAME); + $criteria->add(DynaformPeer::DYN_ID, $row['DYN_ID']); + $criteria->add(DynaformPeer::DYN_UID, $row['DYN_UID']); + $criteria->add(DynaformPeer::DYN_TITLE, $row['DYN_TITLE']); + $criteria->add(DynaformPeer::DYN_DESCRIPTION, $row['DYN_DESCRIPTION']); + $criteria->add(DynaformPeer::PRO_UID, $row['PRO_UID']); + $criteria->add(DynaformPeer::DYN_TYPE, $row['DYN_TYPE']); + $criteria->add(DynaformPeer::DYN_FILENAME, $row['DYN_FILENAME']); + $criteria->add(DynaformPeer::DYN_CONTENT, $row['DYN_CONTENT']); + $criteria->add(DynaformPeer::DYN_LABEL, $row['DYN_LABEL']); + $criteria->add(DynaformPeer::DYN_VERSION, $row['DYN_VERSION']); + $criteria->add(DynaformPeer::DYN_UPDATE_DATE, $row['DYN_UPDATE_DATE']); + BasePeer::doInsert($criteria, $con); + + //Insert in CONTENT + $labels = [ + 'DYN_TITLE' => $row['DYN_TITLE'], + 'DYN_DESCRIPTION' => !empty($row['DYN_DESCRIPTION']) ? $row['DYN_DESCRIPTION'] : '' + ]; + $this->insertToContentTable($con, $labels, $row['DYN_UID'], SYS_LANG); + } + $con->commit(); + } catch (Exception $e) { + $con->rollback(); + throw $e; } - return; } /** @@ -3035,20 +3244,45 @@ public function getTriggerRows($sProUid) /** * Create Step Trigger Rows for a Process form an array * - * @param array $aTrigger + * @param array $trigger + * * @return void + * @throws Exception */ - public function createTriggerRows($aTrigger) + public function createTriggerRows($trigger) { - foreach ($aTrigger as $key => $row) { - $oTrigger = new Triggers(); - //unset ($row['TAS_UID']); - if ($oTrigger->TriggerExists($row['TRI_UID'])) { - $oTrigger->remove($row['TRI_UID']); - } - $res = $oTrigger->create($row); + try { + $con = Propel::getConnection(TriggersPeer::DATABASE_NAME); + $con->begin(); + foreach ($trigger as $key => $row) { + //Prepare the delete + $criteria = new Criteria(TriggersPeer::DATABASE_NAME); + $criteria->addSelectColumn('*'); + $criteria->add(TriggersPeer::TRI_UID, $row['TRI_UID']); + BasePeer::doDelete($criteria, $con); + //Prepare the insert + $criteria = new Criteria(TriggersPeer::DATABASE_NAME); + $criteria->add(TriggersPeer::TRI_UID, $row['TRI_UID']); + $criteria->add(TriggersPeer::TRI_TITLE, $row['TRI_TITLE']); + $criteria->add(TriggersPeer::TRI_DESCRIPTION, $row['TRI_DESCRIPTION']); + $criteria->add(TriggersPeer::PRO_UID, $row['PRO_UID']); + $criteria->add(TriggersPeer::TRI_TYPE, $row['TRI_TYPE']); + $criteria->add(TriggersPeer::TRI_WEBBOT, $row['TRI_WEBBOT']); + $criteria->add(TriggersPeer::TRI_PARAM, $row['TRI_PARAM']); + BasePeer::doInsert($criteria, $con); + + //Insert in CONTENT + $labels = [ + 'TRI_TITLE' => $row['TRI_TITLE'], + 'TRI_DESCRIPTION' => !empty($row['TRI_DESCRIPTION']) ? $row['TRI_DESCRIPTION'] : '' + ]; + $this->insertToContentTable($con, $labels, $row['TRI_UID'], SYS_LANG); + } + $con->commit(); + } catch (Exception $e) { + $con->rollback(); + throw $e; } - return; } /** @@ -3736,21 +3970,40 @@ public function getFilesManager($processUid, $template = 'all') /** * Get Task User Rows from an array of data * - * @param array $aTaskUser - * @return array $aStepTrigger + * @param array $taskUser + * + * @return void + * @throws Exception */ - public function createTaskUserRows($aTaskUser) + public function createTaskUserRows($taskUser) { - if (is_array($aTaskUser)) { - foreach ($aTaskUser as $key => $row) { - $oTaskUser = new TaskUser(); - if ($oTaskUser->TaskUserExists($row['TAS_UID'], $row['USR_UID'], $row['TU_TYPE'], $row['TU_RELATION'])) { - $oTaskUser->remove($row['TAS_UID'], $row['USR_UID'], $row['TU_TYPE'], $row['TU_RELATION']); + try { + if (is_array($taskUser)) { + $con = Propel::getConnection(TaskUserPeer::DATABASE_NAME); + $con->begin(); + foreach ($taskUser as $key => $row) { + //Prepare the delete + $criteria = new Criteria(TaskUserPeer::DATABASE_NAME); + $criteria->addSelectColumn('*'); + $criteria->add(TaskUserPeer::TAS_UID, $row['TAS_UID']); + $criteria->add(TaskUserPeer::USR_UID, $row['USR_UID']); + $criteria->add(TaskUserPeer::TU_TYPE, $row['TU_TYPE']); + $criteria->add(TaskUserPeer::TU_RELATION, $row['TU_RELATION']); + $dataSet = BasePeer::doSelect($criteria, $con); + if (!$dataSet->next()) { + /** The validation added in method TaskUser->create is not required, + * because in the current method only assigned GROUPS are present. + * if (RBAC::isGuestUserUid($row['USR_UID']) && !$bmWebEntry->isTaskAWebEntry($row['TAS_UID'])) {... + */ + BasePeer::doInsert($criteria, $con, false); + } } - $res = $oTaskUser->create($row); + $con->commit(); } + } catch (Exception $e) { + $con->rollback(); + throw $e; } - return; } /** @@ -3794,21 +4047,46 @@ public function addNewTaskUserRows($aTaskUser) * @param array $group * * @return void + * @throws Exception */ public function createGroupRow($group) { - foreach ($group as $key => $row) { - $groupInfo = []; - $groupWf = new Groupwf(); - if ($groupWf->GroupwfExists($row['GRP_UID'])) { - $groupInfo = $groupWf->Load($row['GRP_UID']); - $groupWf->remove($row['GRP_UID']); - } - //We will to keep the GRP_ID - if (!empty($groupInfo['GRP_ID'])) { - $row['GRP_ID'] = $groupInfo['GRP_ID']; - } - $res = $groupWf->create($row); + try { + $con = Propel::getConnection(GroupwfPeer::DATABASE_NAME); + $con->begin(); + foreach ($group as $key => $row) { + //Prepare the delete + $criteria = new Criteria(GroupwfPeer::DATABASE_NAME); + $criteria->addSelectColumn('*'); + $criteria->add(GroupwfPeer::GRP_UID, $row['GRP_UID']); + //Get the GRP_ID column + $dataSet = BasePeer::doSelect($criteria, $con); + $dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); + if ($dataSet->next()) { + $groupInfo = $dataSet->getRow(); + $row['GRP_ID'] = $groupInfo['GRP_ID']; + } else { + $row['GRP_ID'] = null; + } + BasePeer::doDelete($criteria, $con); + //Prepare the insert + $criteria = new Criteria(GroupwfPeer::DATABASE_NAME); + $criteria->add(GroupwfPeer::GRP_ID, $row['GRP_ID']); + $criteria->add(GroupwfPeer::GRP_UID, $row['GRP_UID']); + $criteria->add(GroupwfPeer::GRP_TITLE, $row['GRP_TITLE']); + $criteria->add(GroupwfPeer::GRP_STATUS, $row['GRP_STATUS']); + $criteria->add(GroupwfPeer::GRP_LDAP_DN, $row['GRP_LDAP_DN']); + $criteria->add(GroupwfPeer::GRP_UX, $row['GRP_UX']); + BasePeer::doInsert($criteria, $con); + + //Insert in CONTENT + $labels = ['GRP_TITLE' => $row['GRP_TITLE']]; + $this->insertToContentTable($con, $labels, $row['GRP_UID'], SYS_LANG); + } + $con->commit(); + } catch (Exception $e) { + $con->rollback(); + throw $e; } } @@ -4212,7 +4490,8 @@ public function createEmailEvent($processUid, array $arrayData) * @param string $processUid Unique id of Process * @param array $arrayData Data * - * return void + * @return void + * @throws Exception */ public function createActionsByEmail($processUid, array $arrayData) { @@ -4784,45 +5063,35 @@ public function getProcessData($pmFilename) /** * function checkExistingGroups * checkExistingGroups check if any of the groups listed in the parameter - * array exist and wich are those, that is the result $sFilteredGroups array. - * - * @author gustavo cruz gustavo-at-colosa.com - * @param $sGroupList array of a group list - * @return $existingGroupList array of existing groups or null - */ - public function checkExistingGroups($sGroupList) - { - $aGroupwf = array(); - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(GroupwfPeer::GRP_UID); - $oCriteria->addSelectColumn(GroupwfPeer::GRP_TITLE); - $oDataset = GroupwfPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $oDataset->next(); - while ($aRow = $oDataset->getRow()) { - $aGroupwf[] = $aRow; - $oDataset->next(); - } - //check if any group name exists in the dbase - if (is_array($sGroupList)) { - foreach ($aGroupwf as $groupBase) { - foreach ($sGroupList as $group) { - if ($groupBase['GRP_TITLE'] == $group['GRP_TITLE'] && $groupBase['GRP_UID'] != $group['GRP_UID']) { - $oPro = GroupwfPeer::retrieveByPk( $group['GRP_UID'] ); - if(is_object( $oPro ) && get_class( $oPro ) == 'Groupwf') { - $group['GRP_UID'] = G::generateUniqueID(); - } - $existingGroupList[] = $group; + * array exist and which are those, that is the result $sFilteredGroups array. + * + * @param array $groupList, array of a group list + * @return array|null, array of existing groups or null + */ + public function checkExistingGroups($groupList) + { + $existingGroupList = []; + $criteria = new Criteria('workflow'); + $criteria->addSelectColumn(GroupwfPeer::GRP_UID); + $criteria->addSelectColumn(GroupwfPeer::GRP_TITLE); + $dataset = GroupwfPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); + while ($row = $dataset->getRow()) { + foreach ($groupList as $group) { + //Check if any group name exists in the database + if ($row['GRP_TITLE'] === $group['GRP_TITLE'] && $row['GRP_UID'] !== $group['GRP_UID']) { + $groupWf = GroupwfPeer::retrieveByPk($group['GRP_UID']); + if (is_object($groupWf) && get_class($groupWf) == 'Groupwf') { + $group['GRP_UID'] = G::generateUniqueID(); } + $existingGroupList[] = $group; } } + $dataset->next(); } - //return $sGroupList; - if (isset($existingGroupList)) { - return $existingGroupList; - } else { - return null; - } + + return !empty($existingGroupList) ? $existingGroupList : null; } /** @@ -5499,54 +5768,21 @@ public function createProcessFromData($oData, $pmFilename) $this->createProcessPropertiesFromData($oData); -// $this->createLaneRows( $oData->lanes ); -// -// -// if (isset( $oData->gateways )) { -// $this->createGatewayRows( $oData->gateways ); -// } -// $this->createDynaformRows( $oData->dynaforms ); -// $this->createInputRows( $oData->inputs ); -// $this->createOutputRows( $oData->outputs ); -// $this->createStepRows( $oData->steps ); -// $this->createStepSupervisorRows( isset( $oData->stepSupervisor ) ? $oData->stepSupervisor : array () ); -// $this->createTriggerRows( $oData->triggers ); -// $this->createStepTriggerRows( $oData->steptriggers ); -// $this->createTaskUserRows( $oData->taskusers ); -// $this->createGroupRow( $oData->groupwfs ); -// $this->createDBConnectionsRows( isset( $oData->dbconnections ) ? $oData->dbconnections : array () ); -// $this->createReportTables( isset( $oData->reportTables ) ? $oData->reportTables : array (), isset( $oData->reportTablesVars ) ? $oData->reportTablesVars : array () ); -// $this->createSubProcessRows( isset( $oData->subProcess ) ? $oData->subProcess : array () ); -// $this->createCaseTrackerRows( isset( $oData->caseTracker ) ? $oData->caseTracker : array () ); -// $this->createCaseTrackerObjectRows( isset( $oData->caseTrackerObject ) ? $oData->caseTrackerObject : array () ); -// $this->createObjectPermissionsRows( isset( $oData->objectPermissions ) ? $oData->objectPermissions : array () ); -// $this->createStageRows( isset( $oData->stage ) ? $oData->stage : array () ); -// -// $this->createFieldCondition( isset( $oData->fieldCondition ) ? $oData->fieldCondition : array (), $oData->dynaforms ); -// -// // Create before to createRouteRows for avoid duplicates -// $this->createEventRows( isset( $oData->event ) ? $oData->event : array () ); -// -// $this->createCaseSchedulerRows( isset( $oData->caseScheduler ) ? $oData->caseScheduler : array () ); -// -// //Create data related to Configuration table -// $this->createTaskExtraPropertiesRows( isset( $oData->taskExtraProperties ) ? $oData->taskExtraProperties : array () ); - - // and finally create the files, dynaforms (xml and html), emailTemplates and Public files $this->createFiles($oData, $pmFilename); } + /** + * This function creates a new Process, defined in the object $oData + * + * @param object $oData + * + * @return void + */ public function createProcessPropertiesFromData($oData) { $arrayProcessData = $oData->process; - - // (*) Creating process dependencies - // creating the process category $this->createProcessCategoryRow(isset($oData->processCategory) ? $oData->processCategory : null); - $this->createLaneRows($oData->lanes); - - if (isset($oData->gateways)) { $this->createGatewayRows($oData->gateways); } @@ -5557,8 +5793,8 @@ public function createProcessPropertiesFromData($oData) $this->createStepSupervisorRows(isset($oData->stepSupervisor) ? $oData->stepSupervisor : array()); $this->createTriggerRows($oData->triggers); $this->createStepTriggerRows($oData->steptriggers); - $this->createTaskUserRows($oData->taskusers); $this->createGroupRow($oData->groupwfs); + $this->createTaskUserRows($oData->taskusers); $this->createDBConnectionsRows(isset($oData->dbconnections) ? $oData->dbconnections : array()); $this->createReportTables(isset($oData->reportTables) ? $oData->reportTables : array(), isset($oData->reportTablesVars) ? $oData->reportTablesVars : array()); $this->createSubProcessRows(isset($oData->subProcess) ? $oData->subProcess : array()); @@ -5566,17 +5802,14 @@ public function createProcessPropertiesFromData($oData) $this->createCaseTrackerObjectRows(isset($oData->caseTrackerObject) ? $oData->caseTrackerObject : array()); $this->createObjectPermissionsRows(isset($oData->objectPermissions) ? $oData->objectPermissions : array()); $this->createStageRows(isset($oData->stage) ? $oData->stage : array()); - $this->createFieldCondition(isset($oData->fieldCondition) ? $oData->fieldCondition : array(), $oData->dynaforms); // Create before to createRouteRows for avoid duplicates $this->createEventRows(isset($oData->event) ? $oData->event : array()); - $this->createCaseSchedulerRows(isset($oData->caseScheduler) ? $oData->caseScheduler : array()); //Create data related to Configuration table $this->createTaskExtraPropertiesRows(isset($oData->taskExtraProperties) ? $oData->taskExtraProperties : array()); - $this->createProcessUser((isset($oData->processUser)) ? $oData->processUser : array()); $this->createProcessVariables((isset($oData->processVariables)) ? $oData->processVariables : array()); $this->createWebEntry($arrayProcessData["PRO_UID"], $arrayProcessData["PRO_CREATE_USER"], (isset($oData->webEntry)) ? $oData->webEntry : array()); @@ -5715,10 +5948,12 @@ private function loadIdsFor($modelClass, $uidTableField, $idTableField, } /** - * this function creates a new Process, defined in the object $oData + * This function creates a new Process, defined in the object $oData * - * @param string $sProUid - * @return boolean + * @param object $oData + * @param string $pmFilename + * + * @return void */ public function updateProcessFromData($oData, $pmFilename) { @@ -5736,8 +5971,8 @@ public function updateProcessFromData($oData, $pmFilename) $this->createStepSupervisorRows($oData->stepSupervisor); $this->createTriggerRows($oData->triggers); $this->createStepTriggerRows($oData->steptriggers); - $this->createTaskUserRows($oData->taskusers); $this->createGroupRow($oData->groupwfs); + $this->createTaskUserRows($oData->taskusers); $this->createDBConnectionsRows($oData->dbconnections); $this->updateReportTables($oData->reportTables, $oData->reportTablesVars); $this->createFiles($oData, $pmFilename); @@ -6104,4 +6339,38 @@ public function truncateName($proTitle) $proTitle = substr($proTitle, 0, strlen($proTitle) - $excess); return $proTitle; } + + /** + * Delete, insert and update labels in CONTENT related to a process element + * + * @param object $connection + * @param array $conCategories + * @param string $conId + * @param string $conLang + * @param string $conParent + */ + private function insertToContentTable($connection, array $conCategories, $conId, $conLang, $conParent = '') { + //Prepare to delete labels related in CONTENT + $criteria = new Criteria(ContentPeer::DATABASE_NAME); + $criteria->addSelectColumn('*'); + $criteria->add(ContentPeer::CON_CATEGORY, array_keys($conCategories), Criteria::IN); + $criteria->add(ContentPeer::CON_ID, $conId); + $criteria->add(ContentPeer::CON_LANG, $conLang); + $criteria->add(ContentPeer::CON_PARENT, $conParent); + BasePeer::doDelete($criteria, $connection); + + foreach ($conCategories as $conCategory => $conValue) { + //Prepare the insert label in CONTENT + $criteria = new Criteria(ContentPeer::DATABASE_NAME); + $criteria->add(ContentPeer::CON_CATEGORY, $conCategory); + $criteria->add(ContentPeer::CON_ID, $conId); + $criteria->add(ContentPeer::CON_LANG, $conLang); + $criteria->add(ContentPeer::CON_VALUE, $conValue); + $criteria->add(ContentPeer::CON_PARENT, $conParent); + BasePeer::doInsert($criteria, $connection); + + //Updating all related labels in CONTENT + Content::updateEqualValue($conCategory, $conParent, $conId, $conValue); + } + } } diff --git a/workflow/engine/classes/SpoolRun.php b/workflow/engine/classes/SpoolRun.php index 255aeda04..7ef0547a5 100644 --- a/workflow/engine/classes/SpoolRun.php +++ b/workflow/engine/classes/SpoolRun.php @@ -15,18 +15,19 @@ */ class SpoolRun { - public $config; + private $appUid; + private $appMsgUid; + private $warnings = []; //Array to store the warning that were throws by the class + private $exceptionCode = []; //Array to define the Exception codes private $fileData; - private $spool_id; - public $status; - public $error; - - private $ExceptionCode = Array(); //Array to define the Expetion codes - private $aWarnings = Array(); //Array to store the warning that were throws by the class - - private $longMailEreg; private $mailEreg; + private $spoolId; + + public $config; + public $error; + public $status; + /** * Class constructor - iniatilize default values @@ -38,18 +39,58 @@ public function __construct() { $this->config = array(); $this->fileData = array(); - $this->spool_id = ''; + $this->spoolId = ''; $this->status = 'pending'; $this->error = ''; - $this->ExceptionCode['FATAL'] = 1; - $this->ExceptionCode['WARNING'] = 2; - $this->ExceptionCode['NOTICE'] = 3; + $this->exceptionCode['FATAL'] = 1; + $this->exceptionCode['WARNING'] = 2; + $this->exceptionCode['NOTICE'] = 3; $this->longMailEreg = "/(.*)(<([\w\-\+\.']+@[\w\-_\.]+\.\w{2,5})+>)/"; $this->mailEreg = "/^([\w\-_\+\.']+@[\w\-_\.]+\.\w{2,5}+)$/"; } + /** + * Get the appUid + * + * @return string + */ + public function getAppUid() + { + return $this->appUid; + } + + /** + * Set the appUid + * + * @param string $v + */ + public function setAppUid($v) + { + $this->appUid = $v; + } + + /** + * Get the appMsgUid + * + * @return string + */ + public function getAppMsgUid() + { + return $this->appMsgUid; + } + + /** + * Set the appMsgUid + * + * @param string $v + */ + public function setAppMsgUid($v) + { + $this->appMsgUid = $v; + } + /** * get all files into spool in a list * @@ -65,7 +106,7 @@ public function getSpoolFilesList() $rs = $stmt->executeQuery(); while ($rs->next()) { - $this->spool_id = $rs->getString('APP_MSG_UID'); + $this->spoolId = $rs->getString('APP_MSG_UID'); $this->fileData['subject'] = $rs->getString('APP_MSG_SUBJECT'); $this->fileData['from'] = $rs->getString('APP_MSG_FROM'); $this->fileData['to'] = $rs->getString('APP_MSG_TO'); @@ -110,7 +151,7 @@ public function create($aData) $aData['app_msg_attach'] = serialize($attachment); $aData['app_msg_show_message'] = (isset($aData['app_msg_show_message'])) ? $aData['app_msg_show_message'] : 1; $aData["app_msg_error"] = (isset($aData["app_msg_error"])) ? $aData["app_msg_error"] : ''; - $sUID = $this->db_insert($aData); + $sUID = $this->dbInsert($aData); $aData['app_msg_date'] = isset($aData['app_msg_date']) ? $aData['app_msg_date'] : ''; @@ -178,7 +219,7 @@ public function setConfig($aConfig) */ public function setData($sAppMsgUid, $sSubject, $sFrom, $sTo, $sBody, $sDate = "", $sCC = "", $sBCC = "", $sTemplate = "", $aAttachment = array(), $bContentTypeIsHtml = true, $sError = "") { - $this->spool_id = $sAppMsgUid; + $this->spoolId = $sAppMsgUid; $this->fileData['subject'] = $sSubject; $this->fileData['from'] = $sFrom; $this->fileData['to'] = $sTo; @@ -234,17 +275,40 @@ public function sendMail() */ private function updateSpoolStatus() { - $oAppMessage = AppMessagePeer::retrieveByPK($this->spool_id); + $oAppMessage = AppMessagePeer::retrieveByPK($this->spoolId); if (is_array($this->fileData['attachments'])) { $attachment = implode(",", $this->fileData['attachments']); $oAppMessage->setappMsgAttach($attachment); } $oAppMessage->setAppMsgStatus($this->status); $oAppMessage->setAppMsgStatusId(isset(AppMessage::$app_msg_status_values[$this->status]) ? AppMessage::$app_msg_status_values[$this->status] : 0); - $oAppMessage->setappMsgsenddate(date('Y-m-d H:i:s')); + $oAppMessage->setAppMsgSendDate(date('Y-m-d H:i:s')); $oAppMessage->save(); } + /** + * Update the error + * + * @param string $msgError + * + * @return void + * + * @see SpoolRun::handleMail() + */ + private function updateSpoolError($msgError) + { + $appMessage = AppMessagePeer::retrieveByPK($this->spoolId); + $appMessage->setAppMsgError($msgError); + $appMessage->setAppMsgSendDate(date('Y-m-d H:i:s')); + $appMessage->save(); + + $context = Bootstrap::getDefaultContextLog(); + $context["action"] = "Send email"; + $context["appMsgUid"] = $this->getAppMsgUid(); + $context["appUid"] = $this->getAppUid(); + Bootstrap::registerMonolog("SendEmail", 400, $msgError, $context); + } + /** * handle the email that was set in "TO" parameter * @@ -269,7 +333,7 @@ private function handleFrom() } if (!isset($matches[3])) { - throw new Exception('Invalid email address in FROM parameter (' . $this->fileData['from'] . ')', $this->ExceptionCode['WARNING']); + throw new Exception('Invalid email address in FROM parameter (' . $this->fileData['from'] . ')', $this->exceptionCode['WARNING']); } $this->fileData['from_email'] = trim($matches[3]); @@ -279,7 +343,7 @@ private function handleFrom() preg_match($ereg, $this->fileData["from"], $matches); if (!isset($matches[0])) { - throw new Exception('Invalid email address in FROM parameter (' . $this->fileData['from'] . ')', $this->ExceptionCode['WARNING']); + throw new Exception('Invalid email address in FROM parameter (' . $this->fileData['from'] . ')', $this->exceptionCode['WARNING']); } $this->fileData['from_name'] = ''; @@ -305,16 +369,17 @@ private function handleFrom() } /** - * handle all recipients to compose the mail + * Handle all recipients to compose the mail * - * @param none - * @return boolean true or exception + * @return void + * + * @see SpoolRun::sendMail() */ private function handleEnvelopeTo() { - $hold = array(); - $holdcc = array(); - $holdbcc = array(); + $hold = []; + $holdcc = []; + $holdbcc = []; $text = trim($this->fileData['to']); $textcc = ''; @@ -335,10 +400,15 @@ private function handleEnvelopeTo() $this->fileData['envelope_to'][] = "$val"; } } + } elseif ($text != '') { $this->fileData['envelope_to'][] = "$text"; } else { - $this->fileData['envelope_to'] = Array(); + $this->fileData['envelope_to'] = []; + } + + if (empty($this->fileData['envelope_to'])){ + $this->updateSpoolError('Invalid address: ' . $text); } //CC @@ -353,7 +423,7 @@ private function handleEnvelopeTo() } elseif ($textcc != '') { $this->fileData['envelope_cc'][] = "$textcc"; } else { - $this->fileData['envelope_cc'] = Array(); + $this->fileData['envelope_cc'] = []; } //BCC @@ -368,16 +438,19 @@ private function handleEnvelopeTo() } elseif ($textbcc != '') { $this->fileData['envelope_bcc'][] = "$textbcc"; } else { - $this->fileData['envelope_bcc'] = Array(); + $this->fileData['envelope_bcc'] = []; } } /** - * handle and compose the email content and parameters + * Handle and compose the email content and parameters * - * @param none - * @return none + * @return void + * + * @throws Exception + * + * @see SpoolRun::sendMail() */ private function handleMail() { @@ -386,20 +459,18 @@ private function handleMail() switch ($this->config['MESS_ENGINE']) { case 'MAIL': case 'PHPMAILER': - - switch ($this->config['MESS_ENGINE']) { case 'MAIL': - $oPHPMailer = new PHPMailer(); - $oPHPMailer->Mailer = 'mail'; + $phpMailer = new PHPMailer(); + $phpMailer->Mailer = 'mail'; break; case 'PHPMAILER': - $oPHPMailer = new PHPMailer(true); - $oPHPMailer->Mailer = 'smtp'; + $phpMailer = new PHPMailer(true); + $phpMailer->Mailer = 'smtp'; break; } - $oPHPMailer->SMTPAuth = (isset($this->config['SMTPAuth']) ? $this->config['SMTPAuth'] : ''); + $phpMailer->SMTPAuth = (isset($this->config['SMTPAuth']) ? $this->config['SMTPAuth'] : ''); switch ($this->config['MESS_ENGINE']) { case 'MAIL': @@ -407,101 +478,133 @@ private function handleMail() case 'PHPMAILER': //Posible Options for SMTPSecure are: "", "ssl" or "tls" if (isset($this->config['SMTPSecure']) && preg_match('/^(ssl|tls)$/', $this->config['SMTPSecure'])) { - $oPHPMailer->SMTPSecure = $this->config['SMTPSecure']; + $phpMailer->SMTPSecure = $this->config['SMTPSecure']; } break; } - $systemConfiguration = System::getSystemConfiguration(); - $oPHPMailer->Timeout = is_numeric($systemConfiguration['smtp_timeout']) ? $systemConfiguration['smtp_timeout'] : 20; - $oPHPMailer->CharSet = "UTF-8"; - $oPHPMailer->Encoding = "8bit"; - $oPHPMailer->Host = $this->config['MESS_SERVER']; - $oPHPMailer->Port = $this->config['MESS_PORT']; - $oPHPMailer->Username = $this->config['MESS_ACCOUNT']; - $oPHPMailer->Password = $this->config['MESS_PASSWORD']; - $oPHPMailer->SetFrom($this->fileData['from_email'], utf8_decode($this->fileData['from_name'])); - - if (isset($this->fileData['reply_to'])) { - if ($this->fileData['reply_to'] != '') { - $oPHPMailer->AddReplyTo($this->fileData['reply_to'], $this->fileData['reply_to_name']); - } - } - - $msSubject = $this->fileData['subject']; - if (!(mb_detect_encoding($msSubject, "UTF-8") == "UTF-8")) { - $msSubject = utf8_encode($msSubject); - } - - $oPHPMailer->Subject = $msSubject; - - $msBody = $this->fileData['body']; - - if (!(mb_detect_encoding($msBody, "UTF-8") == "UTF-8")) { - $msBody = utf8_encode($msBody); - } - - $oPHPMailer->Body = $msBody; - - $attachment = @unserialize($this->fileData['attachments']); - if ($attachment === false) { - $attachment = $this->fileData['attachments']; - } - if (is_array($attachment)) { - foreach ($attachment as $key => $fileAttach) { - if (file_exists($fileAttach)) { - $oPHPMailer->AddAttachment($fileAttach, is_int($key) ? '' : $key); + try { + $systemConfiguration = System::getSystemConfiguration(); + $phpMailer->Timeout = is_numeric($systemConfiguration['smtp_timeout']) ? $systemConfiguration['smtp_timeout'] : 20; + $phpMailer->CharSet = "UTF-8"; + $phpMailer->Encoding = "8bit"; + $phpMailer->Host = $this->config['MESS_SERVER']; + $phpMailer->Port = $this->config['MESS_PORT']; + $phpMailer->Username = $this->config['MESS_ACCOUNT']; + $phpMailer->Password = $this->config['MESS_PASSWORD']; + + //From + $phpMailer->SetFrom($this->fileData['from_email'], utf8_decode($this->fileData['from_name'])); + //Reply to + if (isset($this->fileData['reply_to'])) { + if ($this->fileData['reply_to'] != '') { + $phpMailer->AddReplyTo($this->fileData['reply_to'], $this->fileData['reply_to_name']); } } - } - - foreach ($this->fileData['envelope_to'] as $sEmail) { - if (strpos($sEmail, '<') !== false) { - preg_match($this->longMailEreg, $sEmail, $matches); - $sTo = trim($matches[3]); - $sToName = trim($matches[1]); - $oPHPMailer->AddAddress($sTo, $sToName); - } else { - $oPHPMailer->AddAddress($sEmail); + //Subject + $msSubject = $this->fileData['subject']; + if (!(mb_detect_encoding($msSubject, "UTF-8") == "UTF-8")) { + $msSubject = utf8_encode($msSubject); } - } + $phpMailer->Subject = $msSubject; + //Body + $msBody = $this->fileData['body']; + if (!(mb_detect_encoding($msBody, "UTF-8") == "UTF-8")) { + $msBody = utf8_encode($msBody); + } + $phpMailer->Body = $msBody; + //Attachments + $attachment = @unserialize($this->fileData['attachments']); + if ($attachment === false) { + $attachment = $this->fileData['attachments']; + } + if (is_array($attachment)) { + foreach ($attachment as $key => $fileAttach) { + if (file_exists($fileAttach)) { + $phpMailer->AddAttachment($fileAttach, is_int($key) ? '' : $key); + } + } + } + //To + foreach ($this->fileData['envelope_to'] as $email) { + if (strpos($email, '<') !== false) { + preg_match($this->longMailEreg, $email, $matches); + $toAddress = ''; + if (!empty($matches[3])) { + $toAddress = trim($matches[3]); + } + $toName = ''; + if (!empty($matches[1])) { + $toName = trim($matches[1]); + } + if (!empty($toAddress)) { + $phpMailer->AddAddress($toAddress, $toName); + } else { + throw new Exception('Invalid address: ' . $email); + } + } else { + $phpMailer->AddAddress($email); + } + } + //CC + foreach ($this->fileData['envelope_cc'] as $email) { + if (strpos($email, '<') !== false) { + preg_match($this->longMailEreg, $email, $matches); + $ccAddress = ''; + if (!empty($matches[3])) { + $ccAddress = trim($matches[3]); + } + $ccName = ''; + if (!empty($matches[1])) { + $ccName = trim($matches[1]); + } + if (!empty($ccAddress)) { + $phpMailer->AddCC($ccAddress, $ccName); + } else { + throw new Exception('Invalid address: ' . $email); + } + } else { + $phpMailer->AddCC($email); + } + } + //BCC + foreach ($this->fileData['envelope_bcc'] as $email) { + if (strpos($email, '<') !== false) { + preg_match($this->longMailEreg, $email, $matches); + $bccAddress = ''; + if (!empty($matches[3])) { + $bccAddress = trim($matches[3]); + } + $bccName = ''; + if (!empty($matches[1])) { + $bccName = trim($matches[1]); + } + if (!empty($bccAddress)) { + $phpMailer->AddBCC($bccAddress, $bccName); + } else { + throw new Exception('Invalid address: ' . $email); + } + } else { + $phpMailer->AddBCC($email); + } + } + //IsHtml + $phpMailer->IsHTML($this->fileData["contentTypeIsHtml"]); - //CC - foreach ($this->fileData['envelope_cc'] as $sEmail) { - if (strpos($sEmail, '<') !== false) { - preg_match($this->longMailEreg, $sEmail, $matches); - $sTo = trim($matches[3]); - $sToName = trim($matches[1]); - $oPHPMailer->AddCC($sTo, $sToName); - } else { - $oPHPMailer->AddCC($sEmail); + if ($this->config['MESS_ENGINE'] == 'MAIL') { + $phpMailer->WordWrap = 300; } - } - //BCC - foreach ($this->fileData['envelope_bcc'] as $sEmail) { - if (strpos($sEmail, '<') !== false) { - preg_match($this->longMailEreg, $sEmail, $matches); - $sTo = trim($matches[3]); - $sToName = trim($matches[1]); - $oPHPMailer->AddBCC($sTo, $sToName); + if ($phpMailer->Send()) { + $this->error = ''; + $this->status = 'sent'; } else { - $oPHPMailer->AddBCC($sEmail); + $this->error = $phpMailer->ErrorInfo; + $this->status = 'failed'; + $this->updateSpoolError($this->error); } - } - - $oPHPMailer->IsHTML($this->fileData["contentTypeIsHtml"]); - - if ($this->config['MESS_ENGINE'] == 'MAIL') { - $oPHPMailer->WordWrap = 300; - } - - if ($oPHPMailer->Send()) { - $this->error = ''; - $this->status = 'sent'; - } else { - $this->error = $oPHPMailer->ErrorInfo; - $this->status = 'failed'; + } catch (Exception $error) { + $this->updateSpoolError($error->getMessage()); } break; case 'OPENMAIL': @@ -605,8 +708,8 @@ public function resendEmails($dateResend = null, $cron = 0) } catch (Exception $e) { $strAux = "Spool::resendEmails(): Using " . $configuration["MESS_ENGINE"] . " for APP_MGS_UID=" . $row["APP_MSG_UID"] . " -> With message: " . $e->getMessage(); - if ($e->getCode() == $this->ExceptionCode["WARNING"]) { - array_push($this->aWarnings, $strAux); + if ($e->getCode() == $this->exceptionCode["WARNING"]) { + array_push($this->warnings, $strAux); continue; } else { error_log('<400> ' . $strAux); @@ -625,47 +728,54 @@ public function resendEmails($dateResend = null, $cron = 0) */ public function getWarnings() { - if (sizeof($this->aWarnings) != 0) { - return $this->aWarnings; + if (sizeof($this->warnings) != 0) { + return $this->warnings; } return false; } /** - * db_insert + * Insert the record in the AppMessage + * + * @param array $dbSpool + * + * @return string * - * @param array $db_spool - * @return string $sUID; + * @see SpoolRun::create() */ - public function db_insert($db_spool) + public function dbInsert($dbSpool) { - $sUID = G::generateUniqueID(); + $appMsgUid = G::generateUniqueID(); + //Set some values for generate the log + $this->setAppMsgUid($appMsgUid); + $this->setAppUid($dbSpool['app_uid']); + //Set values for register the record $spool = new AppMessage(); - $spool->setAppMsgUid($sUID); - $spool->setMsgUid($db_spool['msg_uid']); - $spool->setAppUid($db_spool['app_uid']); - $spool->setDelIndex($db_spool['del_index']); - $spool->setAppMsgType($db_spool['app_msg_type']); - $spool->setAppMsgTypeId(isset(AppMessage::$app_msg_type_values[$db_spool['app_msg_type']]) ? AppMessage::$app_msg_type_values[$db_spool['app_msg_type']] : 0); - $spool->setAppMsgSubject($db_spool['app_msg_subject']); - $spool->setAppMsgFrom($db_spool['app_msg_from']); - $spool->setAppMsgTo($db_spool['app_msg_to']); - $spool->setAppMsgBody($db_spool['app_msg_body']); + $spool->setAppMsgUid($appMsgUid); + $spool->setMsgUid($dbSpool['msg_uid']); + $spool->setAppUid($dbSpool['app_uid']); + $spool->setDelIndex($dbSpool['del_index']); + $spool->setAppMsgType($dbSpool['app_msg_type']); + $spool->setAppMsgTypeId(isset(AppMessage::$app_msg_type_values[$dbSpool['app_msg_type']]) ? AppMessage::$app_msg_type_values[$dbSpool['app_msg_type']] : 0); + $spool->setAppMsgSubject($dbSpool['app_msg_subject']); + $spool->setAppMsgFrom($dbSpool['app_msg_from']); + $spool->setAppMsgTo($dbSpool['app_msg_to']); + $spool->setAppMsgBody($dbSpool['app_msg_body']); $spool->setAppMsgDate(date('Y-m-d H:i:s')); - $spool->setAppMsgCc($db_spool['app_msg_cc']); - $spool->setAppMsgBcc($db_spool['app_msg_bcc']); - $spool->setappMsgAttach($db_spool['app_msg_attach']); - $spool->setAppMsgTemplate($db_spool['app_msg_template']); - $spool->setAppMsgStatus($db_spool['app_msg_status']); - $spool->setAppMsgStatusId(isset(AppMessage::$app_msg_status_values[$db_spool['app_msg_status']]) ? AppMessage::$app_msg_status_values[$db_spool['app_msg_status']] : 0); + $spool->setAppMsgCc($dbSpool['app_msg_cc']); + $spool->setAppMsgBcc($dbSpool['app_msg_bcc']); + $spool->setappMsgAttach($dbSpool['app_msg_attach']); + $spool->setAppMsgTemplate($dbSpool['app_msg_template']); + $spool->setAppMsgStatus($dbSpool['app_msg_status']); + $spool->setAppMsgStatusId(isset(AppMessage::$app_msg_status_values[$dbSpool['app_msg_status']]) ? AppMessage::$app_msg_status_values[$dbSpool['app_msg_status']] : 0); $spool->setAppMsgSendDate(date('Y-m-d H:i:s')); - $spool->setAppMsgShowMessage($db_spool['app_msg_show_message']); - $spool->setAppMsgError($db_spool['app_msg_error']); + $spool->setAppMsgShowMessage($dbSpool['app_msg_show_message']); + $spool->setAppMsgError($dbSpool['app_msg_error']); $appDelegation = new AppDelegation(); - if (empty($db_spool['app_number'])) { - $delegationIds = $appDelegation->getColumnIds($db_spool['app_uid'], $db_spool['del_index']); + if (empty($dbSpool['app_number'])) { + $delegationIds = $appDelegation->getColumnIds($dbSpool['app_uid'], $dbSpool['del_index']); if (is_array($delegationIds) && count($delegationIds) > 0) { $delegationIds = array_change_key_case($delegationIds); $appNumber = $delegationIds['app_number']; @@ -674,19 +784,19 @@ public function db_insert($db_spool) $appNumber = 0; } } else { - $appNumber = $db_spool['app_number']; + $appNumber = $dbSpool['app_number']; } - if (empty($db_spool['tas_id'])) { + if (empty($dbSpool['tas_id'])) { $tasId = isset($delegationIds['tas_id']) ? $delegationIds['tas_id'] : 0; } else { - $tasId = $db_spool['tas_id']; + $tasId = $dbSpool['tas_id']; } - if (empty($db_spool['pro_id'])) { + if (empty($dbSpool['pro_id'])) { $proId = isset($delegationIds['pro_id']) ? $delegationIds['pro_id'] : $appDelegation->getProcessId($appNumber); } else { - $proId = $db_spool['pro_id']; + $proId = $dbSpool['pro_id']; } $spool->setAppNumber($appNumber); @@ -706,6 +816,6 @@ public function db_insert($db_spool) $spool->save(); } - return $sUID; + return $appMsgUid; } } diff --git a/workflow/engine/classes/WorkspaceTools.php b/workflow/engine/classes/WorkspaceTools.php index 32dad8c9d..ca887ade7 100644 --- a/workflow/engine/classes/WorkspaceTools.php +++ b/workflow/engine/classes/WorkspaceTools.php @@ -2,10 +2,12 @@ use Illuminate\Database\QueryException; use Illuminate\Support\Facades\DB; +use ProcessMaker\BusinessModel\Process as BmProcess; /*----------------------------------********---------------------------------*/ use ProcessMaker\Core\Installer; use ProcessMaker\Core\System; use ProcessMaker\Plugins\Adapters\PluginAdapter; +use ProcessMaker\Project\Adapter\BpmnWorkflow; use ProcessMaker\Util\FixReferencePath; /** @@ -231,6 +233,12 @@ public function upgrade($buildCacheView = false, $workSpace = null, $onedb = fal $arrayOptTranslation = ['updateXml' => true, 'updateMafe' => true]; } + $start = microtime(true); + CLI::logging("> Remove deprecated files...\n"); + $this->removeDeprecatedFiles(); + $stop = microtime(true); + CLI::logging("<*> Remove deprecated files took " . ($stop - $start) . " seconds.\n"); + $start = microtime(true); CLI::logging("> Updating database...\n"); $this->upgradeDatabase($onedb); @@ -1977,6 +1985,12 @@ public static function restore($filename, $srcWorkspace, $dstWorkspace = null, $ } } + $start = microtime(true); + CLI::logging("> Remove deprecated files...\n"); + $workspace->removeDeprecatedFiles(); + $stop = microtime(true); + CLI::logging("<*> Remove deprecated files took " . ($stop - $start) . " seconds.\n"); + if (($pmVersionWorkspaceToRestore != '') && (version_compare( $pmVersionWorkspaceToRestore . "", $pmVersion . "", @@ -2343,7 +2357,7 @@ public function migrateList($workSpace, $flagReinsert = false, $lang = 'en') return; } - $arrayTable1 = ['ListInbox', 'ListMyInbox', 'ListCanceled', 'ListParticipatedLast', 'ListParticipatedHistory', 'ListPaused', 'ListCompleted']; + $arrayTable1 = ['ListInbox', 'ListMyInbox', 'ListCanceled', 'ListParticipatedLast', 'ListParticipatedHistory', 'ListPaused']; $arrayTable2 = ['ListUnassigned', 'ListUnassignedGroup']; $arrayTable = array_merge($arrayTable1, $arrayTable2); @@ -2369,7 +2383,6 @@ public function migrateList($workSpace, $flagReinsert = false, $lang = 'en') } if ($flagReinsert || !$flagListAll) { - $this->regenerateListCompleted($lang); $this->regenerateListCanceled($lang); $this->regenerateListMyInbox(); //This list require no translation $this->regenerateListInbox(); //This list require no translation @@ -2454,69 +2467,6 @@ public function regenerateListCanceled($lang = 'en') CLI::logging("> Completed table LIST_CANCELED\n"); } - public function regenerateListCompleted($lang = 'en') - { - $this->initPropel(true); - $query = 'INSERT INTO ' . $this->dbName . '.LIST_COMPLETED - (APP_UID, - USR_UID, - TAS_UID, - PRO_UID, - APP_NUMBER, - APP_TITLE, - APP_PRO_TITLE, - APP_TAS_TITLE, - APP_CREATE_DATE, - APP_FINISH_DATE, - DEL_INDEX, - DEL_PREVIOUS_USR_UID, - DEL_CURRENT_USR_USERNAME, - DEL_CURRENT_USR_FIRSTNAME, - DEL_CURRENT_USR_LASTNAME) - - SELECT - ACV.APP_UID, - ACV.USR_UID, - ACV.TAS_UID, - ACV.PRO_UID, - ACV.APP_NUMBER, - C_APP.CON_VALUE AS APP_TITLE, - C_PRO.CON_VALUE AS APP_PRO_TITLE, - C_TAS.CON_VALUE AS APP_TAS_TITLE, - ACV.APP_CREATE_DATE, - ACV.APP_FINISH_DATE, - ACV.DEL_INDEX, - PREV_AD.USR_UID AS DEL_PREVIOUS_USR_UID, - USR.USR_USERNAME AS DEL_CURRENT_USR_USERNAME, - USR.USR_FIRSTNAME AS DEL_CURRENT_USR_FIRSTNAME, - USR.USR_LASTNAME AS DEL_CURRENT_USR_LASTNAME - FROM - (' . $this->dbName . '.APP_CACHE_VIEW ACV - LEFT JOIN ' . $this->dbName . '.CONTENT C_APP ON ACV.APP_UID = C_APP.CON_ID - AND C_APP.CON_CATEGORY = \'APP_TITLE\' - AND C_APP.CON_LANG = \'' . $lang . '\' - LEFT JOIN ' . $this->dbName . '.CONTENT C_PRO ON ACV.PRO_UID = C_PRO.CON_ID - AND C_PRO.CON_CATEGORY = \'PRO_TITLE\' - AND C_PRO.CON_LANG = \'' . $lang . '\' - LEFT JOIN ' . $this->dbName . '.CONTENT C_TAS ON ACV.TAS_UID = C_TAS.CON_ID - AND C_TAS.CON_CATEGORY = \'TAS_TITLE\' - AND C_TAS.CON_LANG = \'' . $lang . '\') - LEFT JOIN - (' . $this->dbName . '.APP_DELEGATION AD - INNER JOIN ' . $this->dbName . '.APP_DELEGATION PREV_AD ON AD.APP_UID = PREV_AD.APP_UID - AND AD.DEL_PREVIOUS = PREV_AD.DEL_INDEX) ON ACV.APP_UID = AD.APP_UID - AND ACV.DEL_INDEX = AD.DEL_INDEX - LEFT JOIN - ' . $this->dbName . '.USERS USR ON ACV.USR_UID = USR.USR_UID - WHERE - ACV.APP_STATUS = \'COMPLETED\' - AND ACV.DEL_LAST_INDEX = 1'; - $con = Propel::getConnection("workflow"); - $stmt = $con->createStatement(); - $stmt->executeQuery($query); - CLI::logging("> Completed table LIST_COMPLETED\n"); - } - public function regenerateListMyInbox() { $this->initPropel(true); @@ -3631,53 +3581,62 @@ public function cleanTokens($workspace, $lang = SYS_LANG) CLI::logging("|--> Clean data in table " . OauthRefreshTokensPeer::TABLE_NAME . " rows " . $refreshToken . "\n"); } + /** + * Migrate the Intermediate throw Email Event to Dummy task, specify the workspaces. + * The processes in this workspace will be updated. + * + * @param string $workspaceName + * @see workflow/engine/bin/tasks/cliWorkspaces.php::run_migrate_itee_to_dummytask() + * @see workflow/engine/classes/WorkspaceTools.php->upgradeDatabase() + * @link https://wiki.processmaker.com/3.3/processmaker_command#migrate-itee-to-dummytask + */ public function migrateIteeToDummytask($workspaceName) { $this->initPropel(true); - $arraySystemConfiguration = System::getSystemConfiguration('', '', $workspaceName); - $conf = new Configurations(); - \G::$sysSys = $workspaceName; - \G::$pathDataSite = PATH_DATA . "sites" . PATH_SEP . \G::$sysSys . PATH_SEP; - \G::$pathDocument = PATH_DATA . 'sites' . DIRECTORY_SEPARATOR . $workspaceName . DIRECTORY_SEPARATOR . 'files'; - \G::$memcachedEnabled = $arraySystemConfiguration['memcached']; - \G::$pathDataPublic = \G::$pathDataSite . "public" . PATH_SEP; - \G::$sysSkin = $conf->getConfiguration('SKIN_CRON', ''); - if (is_file(\G::$pathDataSite . PATH_SEP . ".server_info")) { - $serverInfo = file_get_contents(\G::$pathDataSite . PATH_SEP . ".server_info"); + $config = System::getSystemConfiguration('', '', $workspaceName); + G::$sysSys = $workspaceName; + G::$pathDataSite = PATH_DATA . "sites" . PATH_SEP . G::$sysSys . PATH_SEP; + G::$pathDocument = PATH_DATA . 'sites' . DIRECTORY_SEPARATOR . $workspaceName . DIRECTORY_SEPARATOR . 'files'; + G::$memcachedEnabled = $config['memcached']; + G::$pathDataPublic = G::$pathDataSite . "public" . PATH_SEP; + G::$sysSkin = $config['default_skin']; + if (is_file(G::$pathDataSite . PATH_SEP . ".server_info")) { + $serverInfo = file_get_contents(G::$pathDataSite . PATH_SEP . ".server_info"); $serverInfo = unserialize($serverInfo); $envHost = $serverInfo["SERVER_NAME"]; $envPort = ($serverInfo["SERVER_PORT"] . "" != "80") ? ":" . $serverInfo["SERVER_PORT"] : ""; if (!empty($envPort) && strpos($envHost, $envPort) === false) { $envHost = $envHost . $envPort; } - \G::$httpHost = $envHost; + G::$httpHost = $envHost; } //Search All process - $oCriteria = new Criteria("workflow"); - $oCriteria->addSelectColumn(ProcessPeer::PRO_UID); - $oCriteria->addSelectColumn(ProcessPeer::PRO_ITEE); - $oCriteria->add(ProcessPeer::PRO_ITEE, '0', Criteria::EQUAL); - $rsCriteria = ProcessPeer::doSelectRS($oCriteria); - $rsCriteria->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $criteria = new Criteria("workflow"); + $criteria->addSelectColumn(ProcessPeer::PRO_UID); + $criteria->addSelectColumn(ProcessPeer::PRO_ITEE); + $criteria->add(ProcessPeer::PRO_ITEE, '0', Criteria::EQUAL); + $resultSet = ProcessPeer::doSelectRS($criteria); + $resultSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); $message = "-> Migrating the Intermediate Email Event \n"; CLI::logging($message); - while ($rsCriteria->next()) { - $row = $rsCriteria->getRow(); - $prj_uid = $row['PRO_UID']; - $bpmnProcess = new Process(); - if ($bpmnProcess->isBpmnProcess($prj_uid)) { - $project = new \ProcessMaker\Project\Adapter\BpmnWorkflow(); - $diagram = $project->getStruct($prj_uid); - $res = $project->updateFromStruct($prj_uid, $diagram); - $bpmnProcess->setProUid($prj_uid); - $oProcess = new Process(); - $aProcess['PRO_UID'] = $prj_uid; - $aProcess['PRO_ITEE'] = '1'; - if ($oProcess->processExists($prj_uid)) { - $oProcess->update($aProcess); + while ($resultSet->next()) { + $row = $resultSet->getRow(); + $prjUid = $row['PRO_UID']; + $process = new Process(); + if ($process->isBpmnProcess($prjUid)) { + $project = new BpmnWorkflow(); + $diagram = $project->getStruct($prjUid); + $project->updateFromStruct($prjUid, $diagram); + $process->setProUid($prjUid); + $updateProcess = new Process(); + $updateProcessData = []; + $updateProcessData['PRO_UID'] = $prjUid; + $updateProcessData['PRO_ITEE'] = '1'; + if ($updateProcess->processExists($prjUid)) { + $updateProcess->update($updateProcessData); } - $message = " Process updated " . $bpmnProcess->getProTitle() . "\n"; + $message = " Process updated " . $process->getProTitle() . "\n"; CLI::logging($message); } } @@ -4319,4 +4278,50 @@ public function upgradeSelfServiceData($con = null) . "WHERE ASSIGNEE_ID = 0"); $con->commit(); } + + /** + * Remove deprecated files and directory. + */ + public function removeDeprecatedFiles() + { + $deprecatedFiles = PATH_TRUNK . PATH_SEP . 'config' . PATH_SEP . 'deprecatedFiles.lst'; + if (file_exists($deprecatedFiles)) { + $handle = fopen($deprecatedFiles, 'r'); + if ($handle) { + while (($line = fgets($handle)) !== false) { + $line = trim($line, "\n"); + CLI::logging("> Remove file/folder " . $line . " "); + if (file_exists($line)) { + G::rm_dir($line); + CLI::logging("[OK]\n"); + } else { + CLI::logging("[Already removed]\n"); + } + } + fclose($handle); + } + } + } + + /** + * Sync JSON definition of the Forms with Input Documents information + */ + public function syncFormsWithInputDocumentInfo() { + // Initialize Propel and instance the required classes + $this->initPropel(true); + $processInstance = new Process(); + $bmProcessInstance = new BmProcess(); + $pmDynaform = new PmDynaform(); + + // Get all active processes + $processes = $processInstance->getAllProcesses(0, ''); + foreach ($processes as $process) { + // Get all Input Documents from a process + $inputDocuments = $bmProcessInstance->getInputDocuments($process['PRO_UID']); + foreach ($inputDocuments as $inputDocument) { + // Sync JSON definition of the Forms + $pmDynaform->synchronizeInputDocument($process['PRO_UID'], $inputDocument); + } + } + } } diff --git a/workflow/engine/classes/WsBase.php b/workflow/engine/classes/WsBase.php index d99329fbc..f9dc24bbf 100644 --- a/workflow/engine/classes/WsBase.php +++ b/workflow/engine/classes/WsBase.php @@ -6,8 +6,19 @@ class WsBase { + const MESSAGE_TYPE_ACTIONS_BY_EMAIL = 'ACTIONS_BY_EMAIL'; + const MESSAGE_TYPE_CASE_NOTE = 'CASE_NOTE'; + const MESSAGE_TYPE_EMAIL_EVENT = 'EVENT'; + const MESSAGE_TYPE_EXTERNAL_REGISTRATION = 'EXTERNAL_REGISTRATION'; + const MESSAGE_TYPE_PM_FUNCTION = 'PM_FUNCTION'; + const MESSAGE_TYPE_RETRIEVE_PASSWORD = 'RETRIEVE_PASSWORD'; + const MESSAGE_TYPE_SOAP = 'SOAP'; + const MESSAGE_TYPE_TASK_NOTIFICATION = 'ROUTING'; + const MESSAGE_TYPE_TEST_EMAIL = 'TEST'; public $stored_system_variables; //boolean public $wsSessionId; //web service session id, if the wsbase function is used from a WS request + private $taskId; + private $flagSameCase = true; public function __construct($params = null) { @@ -20,6 +31,50 @@ public function __construct($params = null) } } + /** + * Get the flagSameCase + * + * @return boolean + */ + public function getFlagSameCase() + { + return $this->flagSameCase; + } + + /** + * Set the flagSameCase + * + * @param boolean $var + * + * @return void + */ + public function setFlagSameCase($var) + { + $this->flagSameCase = $var; + } + + /** + * Get the taskId + * + * @return int + */ + public function getTaskId() + { + return $this->taskId; + } + + /** + * Set the taskId + * + * @param int $taskId + * + * @return void + */ + public function setTaskId($taskId) + { + $this->taskId = $taskId; + } + /** * function to start a web services session in ProcessMaker * @@ -829,6 +884,13 @@ public function taskList($userId) * @param array $config * * @return $result will return an object + * + * @see ActionsByEmailCoreClass->sendActionsByEmail() + * @see workflow\engine\classes\class.pmFunctions::PMFSendMessage() + * @see workflow\engine\methods\services\soap2::sendMessage() + * @see \ProcessMaker\BusinessModel\EmailEvent->sendEmail() + * @see \ProcessMaker\BusinessModel\Pmgmail->sendEmailWithApplicationData() + * */ public function sendMessage( $appUid, @@ -843,7 +905,8 @@ public function sendMessage( $showMessage = true, $delIndex = 0, $config = [], - $gmail = 0 + $gmail = 0, + $appMsgType = WsBase::MESSAGE_TYPE_PM_FUNCTION ) { try { @@ -861,7 +924,7 @@ public function sendMessage( $spool->setConfig($setup); $case = new Cases(); - $oldFields = $case->loadCase($appUid); + $oldFields = $case->loadCase($appUid, $delIndex); if ($gmail == 1) { $pathEmail = PATH_DATA_SITE . 'mailTemplates' . PATH_SEP; } else { @@ -887,7 +950,7 @@ public function sendMessage( '', $appUid, $delIndex, - 'TRIGGER', + $appMsgType, $subject, G::buildFrom($setup, $from), $to, @@ -902,7 +965,7 @@ public function sendMessage( (preg_match("/^.+\.html?$/i", $fileTemplate)) ? true : false, isset($fieldsCase['APP_NUMBER']) ? $fieldsCase['APP_NUMBER'] : 0, isset($fieldsCase['PRO_ID']) ? $fieldsCase['PRO_ID'] : 0, - isset($fieldsCase['TAS_ID']) ? $fieldsCase['TAS_ID'] : 0 + $this->getTaskId() ?$this->getTaskId():(isset($oldFields['TAS_ID'])? $oldFields['TAS_ID'] : 0) ); $spool->create($messageArray); @@ -1297,6 +1360,8 @@ public function updateUser( $result = new WsResponse(-1, G::LoadTranslation("ID_INVALID_DATA") . " $status"); return $result; + } else { + $status == 'INACTIVE' ? $RBAC->destroySessionUser($userUid) : null; } } @@ -1683,34 +1748,35 @@ public function assignUserToDepartment($userId, $depId, $manager) * * @param string $caseId * @param string $variables + * @param bool $forceToSave * * @return $result will return an object */ - public function sendVariables($caseId, $variables) + public function sendVariables($caseId, $variables, $forceToSave = false) { - //delegation where app uid (caseId) y usruid(session) ordenar delindes descendente y agaarr el primero - //delfinishdate != null error try { - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); - $oCriteria->add(AppDelegationPeer::APP_UID, $caseId); - $oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); + if (!$forceToSave) { + $criteria = new Criteria('workflow'); + $criteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); + $criteria->add(AppDelegationPeer::APP_UID, $caseId); + $criteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); - $oCriteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX); - $oDataset = AppDelegationPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $criteria->addDescendingOrderByColumn(AppDelegationPeer::DEL_INDEX); + $dataset = AppDelegationPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - $cnt = 0; + $cnt = 0; - while ($oDataset->next()) { - $aRow = $oDataset->getRow(); - $cnt++; - } + while ($dataset->next()) { + $row = $dataset->getRow(); + $cnt++; + } - if ($cnt == 0) { - $result = new WsResponse(18, G::loadTranslation('ID_CASE_DELEGATION_ALREADY_CLOSED')); + if ($cnt == 0) { + $result = new WsResponse(18, G::loadTranslation('ID_CASE_DELEGATION_ALREADY_CLOSED')); - return $result; + return $result; + } } if (is_array($variables)) { @@ -2030,57 +2096,72 @@ public function newCase($processId, $userId, $taskId, $variables, $executeTrigge } /** - * creates a new case impersonating a user who has the proper privileges to create new cases + * Creates a new case impersonating a user who has the proper privileges to create new cases * * @param string $processId * @param string $userId - * @param string $variables - * @param string $taskId , must be in the starting group. + * @param array $variables, that are set in the new case + * @param string $taskId, must be in the starting group. * - * @return $result will return an object + * @return object + * + * @see PMFNewCaseImpersonate/class.pmFunctions.php on + * @link https://wiki.processmaker.com/3.1/ProcessMaker_Functions#PMFNewCaseImpersonate.28.29 + * + * @see doPostCaseImpersonate/Api/Cases on + * @link https://wiki.processmaker.com/3.2/REST_API_Cases/Cases#New_Case_Impersonate_User:_POST_.2Fcases.2Fimpersonate + * + * @see NewCaseImpersonate/soap2.php on + * @link https://wiki.processmaker.com/3.0/ProcessMaker_WSDL_Web_Services#newCaseImpersonate.28.29 */ public function newCaseImpersonate($processId, $userId, $variables, $taskId = '') { try { + $g = new G(); + $g->sessionVarSave(); + + $c = count($variables); if (is_array($variables)) { - if (count($variables) > 0) { - $c = count($variables); - $Fields = $variables; - } else { - if ($c == 0) { - $result = new WsResponse(10, G::loadTranslation('ID_ARRAY_VARIABLES_EMPTY')); + if ($c > 0) { + $fieldsVariables = $variables; + } elseif ($c === 0) { + $result = new WsResponse(10, G::loadTranslation('ID_ARRAY_VARIABLES_EMPTY')); + $g->sessionVarRestore(); - return $result; - } + return $result; } } else { $result = new WsResponse(10, G::loadTranslation('ID_VARIABLES_PARAM_NOT_ARRAY')); + $g->sessionVarRestore(); return $result; } $processes = new Processes(); - if (!$processes->processExists($processId)) { $result = new WsResponse(11, G::loadTranslation('ID_INVALID_PROCESS') . " " . $processId . "!!"); + $g->sessionVarRestore(); return $result; } $user = new Users(); - if (!$user->userExists($userId)) { $result = new WsResponse(11, G::loadTranslation('ID_USER_NOT_REGISTERED') . " " . $userId . "!!"); + $g->sessionVarRestore(); return $result; + } else { + $user->load($userId); + $userName = $user->getUsrUsername(); } - $oCase = new Cases(); + $caseInstance = new Cases(); $numTasks = 0; - if ($taskId != '') { - $aTasks = $processes->getStartingTaskForUser($processId, null); - foreach ($aTasks as $task) { + if (!empty($taskId)) { + $startTasks = $processes->getStartingTaskForUser($processId, null); + foreach ($startTasks as $task) { if ($task['TAS_UID'] == $taskId) { $arrayTask[0]['TAS_UID'] = $taskId; $numTasks = 1; @@ -2091,38 +2172,47 @@ public function newCaseImpersonate($processId, $userId, $variables, $taskId = '' $numTasks = count($arrayTask); } - if ($numTasks == 1) { - $case = $oCase->startCase($arrayTask[0]['TAS_UID'], $userId); - $caseId = $case['APPLICATION']; - $caseNumber = $case['CASE_NUMBER']; + if ($numTasks === 1) { + //@todo Find a better way to define session variables + $_SESSION["PROCESS"] = $processId; + $_SESSION["TASK"] = $arrayTask[0]['TAS_UID']; + $_SESSION["USER_LOGGED"] = $userId; + $_SESSION["INDEX"] = 1; + $_SESSION["USR_USERNAME"] = $userName; - $oldFields = $oCase->loadCase($caseId); - - $oldFields['APP_DATA'] = array_merge($oldFields['APP_DATA'], $Fields); - - $up_case = $oCase->updateCase($caseId, $oldFields); + //Create a newCase + $infoCase = $caseInstance->startCase($arrayTask[0]['TAS_UID'], $userId); + $_SESSION["APPLICATION"] = $caseId = $infoCase['APPLICATION']; + $oldFields = $caseInstance->loadCase($caseId); + //Merge the data with the $fieldsVariables that are set in the new case + $oldFields['APP_DATA'] = array_merge($oldFields['APP_DATA'], $fieldsVariables); + //Update the case + $res = $caseInstance->updateCase($caseId, $oldFields); $result = new WsResponse(0, G::loadTranslation('ID_COMMAND_EXECUTED_SUCCESSFULLY')); - $result->caseId = $caseId; - $result->caseNumber = $caseNumber; + $result->caseNumber = $infoCase['CASE_NUMBER']; + $g->sessionVarRestore(); return $result; } else { - if ($numTasks == 0) { + if ($numTasks === 0) { $result = new WsResponse(12, G::loadTranslation('ID_NO_STARTING_TASK')); + $g->sessionVarRestore(); return $result; } if ($numTasks > 1) { $result = new WsResponse(13, G::loadTranslation('ID_MULTIPLE_STARTING_TASKS')); + $g->sessionVarRestore(); return $result; } } } catch (Exception $e) { $result = new WsResponse(100, $e->getMessage()); + $g->sessionVarRestore(); return $result; } @@ -2132,7 +2222,7 @@ public function newCaseImpersonate($processId, $userId, $variables, $taskId = '' * Execute the trigger defined in the steps * This function is used when the case is derived from abe, Soap, PMFDerivateCase * - * @param string $caseId , Uid related to the case + * @param string $appUid , Uid related to the case * @param array $appData , contain all the information about the case related to the index [APP_DATA] * @param string $tasUid , Uid related to the task * @param string $stepType , before or after step @@ -2141,9 +2231,11 @@ public function newCaseImpersonate($processId, $userId, $variables, $taskId = '' * @param string $labelAssignment , label related to the triggerType * * @return string $varTriggers updated + * + * @see WsBase::derivateCase() */ public function executeTriggerFromDerivate( - $caseId, + $appUid, &$appData, $tasUid, $stepType, @@ -2152,62 +2244,38 @@ public function executeTriggerFromDerivate( $labelAssignment = '' ) { - $varTriggers = ""; - $oCase = new Cases(); - - //Load the triggers assigned in the $triggerType - $aTriggers = $oCase->loadTriggers($tasUid, $stepType, $stepUidObj, $triggerType); - - if (count($aTriggers) > 0) { - $varTriggers = $varTriggers . "
" . $labelAssignment . "
"; - - $oPMScript = new PMScript(); + $caseInstance = new Cases(); + + //Set new variables in the APP_DATA + $params = new stdClass(); + $params->appData = $appData; + if ($this->stored_system_variables) { + $params->option = "STORED SESSION"; + $params->SID = $this->wsSessionId; + } + $appFields["APP_DATA"] = array_merge($appData, G::getSystemConstants($params)); - foreach ($aTriggers as $aTrigger) { - //Set variables - $params = new stdClass(); - $params->appData = $appData; + //Load the triggers assigned in the step + $triggersList = $caseInstance->loadTriggers($tasUid, $stepType, $stepUidObj, $triggerType); - if ($this->stored_system_variables) { - $params->option = "STORED SESSION"; - $params->SID = $this->wsSessionId; - } + //Execute the trigger defined in the step + $lastFields = $caseInstance->executeTriggerFromList($triggersList, $appFields["APP_DATA"], $stepType, $stepUidObj, $triggerType, $labelAssignment); - //We can set the index APP_DATA - $appFields["APP_DATA"] = array_merge($appData, G::getSystemConstants($params)); + //Get message of the execution + $varTriggers = $caseInstance->getTriggerMessageExecution(); - //PMScript - $oPMScript->setFields($appFields['APP_DATA']); - $bExecute = true; + //Define the new APP_DATA + $appFields['APP_DATA'] = $lastFields; + unset($appFields['APP_STATUS']); + unset($appFields['APP_PROC_STATUS']); + unset($appFields['APP_PROC_CODE']); + unset($appFields['APP_PIN']); - if ($aTrigger['ST_CONDITION'] !== '') { - $oPMScript->setScript($aTrigger['ST_CONDITION']); - $bExecute = $oPMScript->evaluate(); - } + //Update the APP_DATA + $caseInstance->updateCase($appUid, $appFields); - if ($bExecute) { - $oPMScript->setDataTrigger($aTrigger); - $oPMScript->setScript($aTrigger['TRI_WEBBOT']); - $oPMScript->execute(); - - $trigger = TriggersPeer::retrieveByPk($aTrigger["TRI_UID"]); - $varTriggers = $varTriggers . " - " . nl2br(htmlentities( - $trigger->getTriTitle(), - ENT_QUOTES - )) . "
"; - - $appFields['APP_DATA'] = $oPMScript->aFields; - unset($appFields['APP_STATUS']); - unset($appFields['APP_PROC_STATUS']); - unset($appFields['APP_PROC_CODE']); - unset($appFields['APP_PIN']); - $oCase->updateCase($caseId, $appFields); - - //We need to update the variable $appData for use the new variables in the next trigger - $appData = array_merge($appData, $appFields['APP_DATA']); - } - } - } + //We need to update the variable $appData for use the new variables in the next trigger + $appData = array_merge($appData, $appFields['APP_DATA']); /*----------------------------------********---------------------------------*/ @@ -2220,10 +2288,14 @@ public function executeTriggerFromDerivate( * * @param string $userId * @param string $caseId - * @param string $delIndex - * @param array $tasks + * @param integer $delIndex * @param bool $bExecuteTriggersBeforeAssignment + * @param array $tasks + * * @return $result will return an object + * + * @see PMFDerivateCase()/class.pmFunctions.php on + * @link https://wiki.processmaker.com/3.2/ProcessMaker_Functions/Case_Routing_Functions#PMFDerivateCase.28.29 */ public function derivateCase($userId, $caseId, $delIndex, $bExecuteTriggersBeforeAssignment = false, $tasks = []) { @@ -2441,7 +2513,7 @@ public function derivateCase($userId, $caseId, $delIndex, $bExecuteTriggersBefor $arrayUserData = $user->load($userId); if (trim($arrayUserData["USR_EMAIL"]) == "") { - $arrayUserData["USR_EMAIL"] = "info@" . $_SERVER["HTTP_HOST"]; + $arrayUserData["USR_EMAIL"] = "info@" . System::getDefaultMailDomain(); } $sFromName = "\"" . $arrayUserData["USR_FIRSTNAME"] . " " . $arrayUserData["USR_LASTNAME"] . "\" <" . $arrayUserData["USR_EMAIL"] . ">"; @@ -2641,6 +2713,7 @@ public function executeTrigger($userId, $caseId, $triggerIndex, $delIndex) $oPMScript->setDataTrigger($row); $oPMScript->setFields($appFields['APP_DATA']); $oPMScript->setScript($row['TRI_WEBBOT']); + $oPMScript->setExecutedOn(PMScript::ISOLATED_TRIGGER); $oPMScript->execute(); if (isset($oPMScript->aFields["__ERROR__"]) && trim($oPMScript->aFields["__ERROR__"]) != "" && $oPMScript->aFields["__ERROR__"] != "none") { @@ -3037,6 +3110,10 @@ public function deleteCase($caseUid) public function cancelCase($caseUid, $delIndex, $userUid) { $g = new G(); + //We will to review if the current case in execution will be execute the same + if (isset($_SESSION["APPLICATION"]) && $_SESSION["APPLICATION"] !== $caseUid){ + $this->setFlagSameCase(false); + } try { $g->sessionVarSave(); @@ -3093,7 +3170,7 @@ public function cancelCase($caseUid, $delIndex, $userUid) /** Cancel case */ - $case->cancelCase($caseUid, (int)$delIndex, $userUid); + $case->cancelCase($caseUid, (int)$delIndex, $userUid, $this->getFlagSameCase()); //Define the result of the cancelCase $result = self::messageExecuteSuccessfully(); @@ -3116,7 +3193,12 @@ public function cancelCase($caseUid, $delIndex, $userUid) * @param string userUid : The unique ID of the user who will pause the case. * @param string unpauseDate : Optional parameter. The date in the format "yyyy-mm-dd" indicating when to unpause * the case. - * + * + * @see workflow/engine/classes/class.pmFunctions.php::PMFPauseCase() + * @see workflow/engine/methods/services/soap2.php::pauseCase() + * + * @link https://wiki.processmaker.com/3.3/ProcessMaker_Functions/Case_Functions#PMFPauseCase.28.29 + * * @return $result will return an object */ public function pauseCase($caseUid, $delIndex, $userUid, $unpauseDate = null) @@ -3152,6 +3234,22 @@ public function pauseCase($caseUid, $delIndex, $userUid, $unpauseDate = null) return $result; } + //Validate if status is closed + $appDelegation = new AppDelegation(); + $rows = $appDelegation->LoadParallel($caseUid, $delIndex); + if (empty($rows)) { + $result = new WsResponse(100, G::LoadTranslation('ID_CASE_DELEGATION_ALREADY_CLOSED')); + $g->sessionVarRestore(); + return $result; + } + //Validate if the case is paused + $appDelay = new AppDelay(); + $sw = $appDelay->isPaused($caseUid, $delIndex); + if ($sw === true) { + $result = new WsResponse(19, G::LoadTranslation('ID_CASE_IN_STATUS') . " " . AppDelay::APP_TYPE_PAUSE); + $g->sessionVarRestore(); + return $result; + } if (strlen($unpauseDate) >= 10) { if (!preg_match("/^\d{4}-\d{2}-\d{2}| \d{2}:\d{2}:\d{2}$/", $unpauseDate)) { $result = new WsResponse(100, G::LoadTranslation("ID_INVALID_DATA") . " $unpauseDate"); diff --git a/workflow/engine/classes/class.pmFunctions.php b/workflow/engine/classes/class.pmFunctions.php index 0f06b5c6e..31cf411a4 100644 --- a/workflow/engine/classes/class.pmFunctions.php +++ b/workflow/engine/classes/class.pmFunctions.php @@ -28,11 +28,11 @@ // // License: LGPL, see LICENSE //////////////////////////////////////////////////// +use ProcessMaker\BusinessModel\Cases as BusinessModelCases; use ProcessMaker\Core\System; use ProcessMaker\Plugins\PluginRegistry; use ProcessMaker\Util\ElementTranslation; - /** * ProcessMaker has made a number of its PHP functions available be used in triggers and conditions. * Most of these functions are wrappers for internal functions used in Gulliver, which is the development framework @@ -418,18 +418,19 @@ function orderGrid ($dataM, $field, $ord = 'ASC') * @return array | $aGrid | Grid | Grid with executed operation * */ -function evaluateFunction ($aGrid, $sExpresion) +function evaluateFunction($aGrid, $sExpresion) { - $sExpresion = str_replace( 'Array', '$this->aFields', $sExpresion ); + $sExpresion = str_replace('Array', '$this->aFields', $sExpresion); $sExpresion .= ';'; $pmScript = new PMScript(); - $pmScript->setScript( $sExpresion ); + $pmScript->setScript($sExpresion); + $pmScript->setExecutedOn(PMScript::EVALUATE_FUNCTION); - for ($i = 1; $i <= count( $aGrid ); $i ++) { + for ($i = 1; $i <= count($aGrid); $i ++) { $aFields = $aGrid[$i]; - $pmScript->setFields( $aFields ); + $pmScript->setFields($aFields); $pmScript->execute(); @@ -919,34 +920,34 @@ function getEmailConfiguration () * @link http://wiki.processmaker.com/index.php/ProcessMaker_Functions#PMFSendMessage.28.29 * * @param string(32) | $caseId | UID for case | The UID (unique identification) for a case, which is a string of 32 hexadecimal characters to identify the case. - * @param string(32) | $sFrom | Sender | The email address of the person who sends out the email. - * @param string(100) | $sTo | Recipient | The email address(es) to whom the email is sent. If multiple recipients, separate each email address with a comma. - * @param string(100) | $sCc = '' | Carbon copy recipient | The email address(es) of people who will receive carbon copies of the email. - * @param string(100) | $sBcc = ''| Carbon copy recipient | The email address(es) of people who will receive blind carbon copies of the email. - * @param string(50) | $sSubject | Subject of the email | The subject (title) of the email. - * @param string(50) | $sTemplate | Name of the template | The name of the template file in plain text or HTML format which will produce the body of the email. - * @param array | $aFields = array() | Variables for email template | Optional parameter. An associative array where the keys are the variable names and the values are the variables' values. - * @param array | $aAttachment = array() | Attachment | An Optional arrray. An array of files (full paths) to be attached to the email. + * @param string(32) | $from | Sender | The email address of the person who sends out the email. + * @param string(100) | $to | Recipient | The email address(es) to whom the email is sent. If multiple recipients, separate each email address with a comma. + * @param string(100) | $cc = '' | Carbon copy recipient | The email address(es) of people who will receive carbon copies of the email. + * @param string(100) | $bcc = ''| Carbon copy recipient | The email address(es) of people who will receive blind carbon copies of the email. + * @param string(50) | $subject | Subject of the email | The subject (title) of the email. + * @param string(50) | $template | Name of the template | The name of the template file in plain text or HTML format which will produce the body of the email. + * @param array | $emailTemplateVariables = [] | Variables for email template | Optional parameter. An associative array where the keys are the variable names and the values are the variables' values. + * @param array | $attachments = [] | Attachment | An Optional arrray. An array of files (full paths) to be attached to the email. * @param boolean | $showMessage = true | Show message | Optional parameter. Set to TRUE to show the message in the case's message history. * @param int | $delIndex = 0 | Delegation index of the case | Optional parameter. The delegation index of the current task in the case. - * @param string(100) | $config = '' | Email server configuration | An optional array: An array of parameters to be used in the Email sent (MESS_ENGINE, MESS_SERVER, MESS_PORT, MESS_FROM_MAIL, MESS_RAUTH, MESS_ACCOUNT, MESS_PASSWORD, and SMTPSecure) Or String: UID of Email server . + * @param array | $config = [] | Email server configuration | An optional array: An array of parameters to be used in the Email sent (MESS_ENGINE, MESS_SERVER, MESS_PORT, MESS_FROM_MAIL, MESS_RAUTH, MESS_ACCOUNT, MESS_PASSWORD, and SMTPSecure) Or String: UID of Email server . * @return int | | result | Result of sending email * + * @see class.pmFunctions::PMFSendMessageToGroup() */ -//@param array | $aFields=array() | An associative array optional | Optional parameter. An associative array where the keys are the variable name and the values are the variable's value. function PMFSendMessage( $caseId, - $sFrom, - $sTo, - $sCc, - $sBcc, - $sSubject, - $sTemplate, - $aFields = array(), - $aAttachment = array(), + $from, + $to, + $cc, + $bcc, + $subject, + $template, + $emailTemplateVariables = [], + $attachments = [], $showMessage = true, $delIndex = 0, - $config = array() + $config = [] ) { ini_set ( "pcre.backtrack_limit", 1000000 ); ini_set ( 'memory_limit', '-1' ); @@ -954,28 +955,30 @@ function PMFSendMessage( global $oPMScript; - if (isset( $oPMScript->aFields ) && is_array( $oPMScript->aFields )) { - if (is_array( $aFields )) { - $aFields = array_merge( $oPMScript->aFields, $aFields ); + if (isset($oPMScript->aFields) && is_array($oPMScript->aFields)) { + if (is_array($emailTemplateVariables)) { + $emailTemplateVariables = array_merge($oPMScript->aFields, $emailTemplateVariables); } else { - $aFields = $oPMScript->aFields; + $emailTemplateVariables = $oPMScript->aFields; } } $ws = new WsBase(); $result = $ws->sendMessage( $caseId, - $sFrom, - $sTo, - $sCc, - $sBcc, - $sSubject, - $sTemplate, - $aFields, - $aAttachment, + $from, + $to, + $cc, + $bcc, + $subject, + $template, + $emailTemplateVariables, + $attachments, $showMessage, $delIndex, - $config + $config, + 0, + WsBase::MESSAGE_TYPE_PM_FUNCTION ); if ($result->status_code == 0) { @@ -2030,13 +2033,19 @@ function PMFProcessList () //its test was successfull */ function PMFSendVariables ($caseId, $variables) { + global $oPMScript; + + if (!isset($oPMScript)) { + $oPMScript = new PMScript(); + } + $ws = new WsBase(); + $result = $ws->sendVariables($caseId, $variables, + $oPMScript->executedOn() === PMScript::AFTER_ROUTING); - $result = $ws->sendVariables( $caseId, $variables ); if ($result->status_code == 0) { if (isset($_SESSION['APPLICATION'])) { if ($caseId == $_SESSION['APPLICATION']) { - global $oPMScript; if (isset($oPMScript->aFields) && is_array($oPMScript->aFields)) { if (is_array($variables)) { $oPMScript->aFields = array_merge($oPMScript->aFields, $variables); @@ -2432,7 +2441,7 @@ function PMFgetLabelOption ($PROCESS, $DYNAFORM_UID, $FIELD_NAME, $FIELD_SELECTE * @return none | $none | None | None * */ -function PMFRedirectToStep ($sApplicationUID, $iDelegation, $sStepType, $sStepUid) +function PMFRedirectToStep($sApplicationUID, $iDelegation, $sStepType, $sStepUid) { $g = new G(); @@ -2444,26 +2453,27 @@ function PMFRedirectToStep ($sApplicationUID, $iDelegation, $sStepType, $sStepUi $_SESSION["INDEX"] = $iDelegation; require_once 'classes/model/AppDelegation.php'; - $oCriteria = new Criteria( 'workflow' ); - $oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID ); - $oCriteria->add( AppDelegationPeer::APP_UID, $sApplicationUID ); - $oCriteria->add( AppDelegationPeer::DEL_INDEX, $iDelegation ); - $oDataset = AppDelegationPeer::doSelectRS( $oCriteria ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oCriteria = new Criteria('workflow'); + $oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID); + $oCriteria->add(AppDelegationPeer::APP_UID, $sApplicationUID); + $oCriteria->add(AppDelegationPeer::DEL_INDEX, $iDelegation); + $oDataset = AppDelegationPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->next(); global $oPMScript; $aRow = $oDataset->getRow(); if ($aRow) { require_once 'classes/model/Step.php'; $oStep = new Step(); - $oTheStep = $oStep->loadByType( $aRow['TAS_UID'], $sStepType, $sStepUid ); + $oTheStep = $oStep->loadByType($aRow['TAS_UID'], $sStepType, $sStepUid); $bContinue = true; $oCase = new Cases(); - $aFields = $oCase->loadCase( $sApplicationUID ); + $aFields = $oCase->loadCase($sApplicationUID); if ($oTheStep->getStepCondition() != '') { $pmScript = new PMScript(); - $pmScript->setFields( $aFields['APP_DATA'] ); - $pmScript->setScript( $oTheStep->getStepCondition() ); + $pmScript->setFields($aFields['APP_DATA']); + $pmScript->setScript($oTheStep->getStepCondition()); + $pmScript->setExecutedOn(PMScript::CONDITION); $bContinue = $pmScript->evaluate(); } if ($bContinue) { @@ -2485,18 +2495,18 @@ function PMFRedirectToStep ($sApplicationUID, $iDelegation, $sStepType, $sStepUi break; } // save data - if (! is_null( $oPMScript )) { + if (!is_null($oPMScript)) { $aFields['APP_DATA'] = $oPMScript->aFields; unset($aFields['APP_STATUS']); unset($aFields['APP_PROC_STATUS']); unset($aFields['APP_PROC_CODE']); unset($aFields['APP_PIN']); - $oCase->updateCase( $sApplicationUID, $aFields ); + $oCase->updateCase($sApplicationUID, $aFields); } $g->sessionVarRestore(); - G::header( 'Location: ' . 'cases_Step?TYPE=' . $sStepType . '&UID=' . $sStepUid . '&POSITION=' . $oTheStep->getStepPosition() . '&ACTION=' . $sAction ); + G::header('Location: ' . 'cases_Step?TYPE=' . $sStepType . '&UID=' . $sStepUid . '&POSITION=' . $oTheStep->getStepPosition() . '&ACTION=' . $sAction); die(); } } @@ -2817,7 +2827,7 @@ function PMFPauseCase ($caseUid, $delIndex, $userUid, $unpauseDate = null) { $ws = new WsBase(); $result = $ws->pauseCase($caseUid, $delIndex, $userUid, $unpauseDate); - + $result = (object) $result; if ($result->status_code == 0) { if (isset($_SESSION['APPLICATION']) && isset($_SESSION['INDEX'])) { if ($_SESSION['APPLICATION'] == $caseUid && $_SESSION['INDEX'] == $delIndex) { @@ -2980,11 +2990,17 @@ function PMFRemoveMask ($field, $separator = '.', $currency = '') function PMFSaveCurrentData () { global $oPMScript; + + if (!isset($oPMScript)) { + $oPMScript = new PMScript(); + } + $response = 0; if (isset($_SESSION['APPLICATION']) && isset($oPMScript->aFields)) { $ws = new WsBase(); - $result = $ws->sendVariables($_SESSION['APPLICATION'], $oPMScript->aFields); + $result = $ws->sendVariables($_SESSION['APPLICATION'], $oPMScript->aFields, + $oPMScript->executedOn() === PMScript::AFTER_ROUTING); $response = $result->status_code == 0 ? 1 : 0; } return $response; @@ -3215,7 +3231,7 @@ function PMFGetGroupName($grpUid, $lang = SYS_LANG) { * @param string | $text | Text * @param string | $category | Category * @param string | $proUid | ProcessUid - * @param string | $lang | Languaje + * @param string | $lang | Language * @return array */ function PMFGetUidFromText($text, $category, $proUid = null, $lang = SYS_LANG) @@ -3456,25 +3472,27 @@ function PMFGetNextDerivationInfo($caseUid, $delIndex) * @param string | $skin = null | Skin | The skin * * @return string | $url | Direct case link | Returns the direct case link, FALSE otherwise + * @link https://wiki.processmaker.com/3.2/Direct_Case_Link */ function PMFCaseLink($caseUid, $workspace = null, $language = null, $skin = null) { try { - $case = new \ProcessMaker\BusinessModel\Cases(); - + $case = new BusinessModelCases(); $arrayApplicationData = $case->getApplicationRecordByPk($caseUid, [], false); - if ($arrayApplicationData === false) { return false; } - $workspace = (!empty($workspace)) ? $workspace : config("system.workspace"); - $language = (!empty($language)) ? $language : SYS_LANG; - $skin = (!empty($skin)) ? $skin : SYS_SKIN; - $uri = '/sys' . $workspace . '/' . $language . '/' . $skin . '/cases/opencase/' . $caseUid; + $workspace = !empty($workspace) ? $workspace : config("system.workspace"); + $language = !empty($language) ? $language : SYS_LANG; + if (empty($skin)) { + $config = System::getSystemConfiguration(); + $skin = defined("SYS_SKIN") ? SYS_SKIN : $config['default_skin']; + } - //Return - return ((G::is_https()) ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . $uri; + $uri = '/sys' . $workspace . '/' . $language . '/' . $skin . '/cases/opencase/' . $caseUid; + $link = System::getServerProtocolHost() . $uri; + return $link; } catch (Exception $e) { throw $e; } diff --git a/workflow/engine/classes/class.pmScript.php b/workflow/engine/classes/class.pmScript.php index 8b4feef84..cd4cf8631 100644 --- a/workflow/engine/classes/class.pmScript.php +++ b/workflow/engine/classes/class.pmScript.php @@ -35,11 +35,51 @@ function __autoload($sClassName) /** * PMScript - PMScript class * - * @copyright 2007 COLOSA * @package workflow.engine.ProcessMaker */ class PMScript { + /** + * Constants to identify the execution origin + */ + const UNDEFINED_ORIGIN = 'executed.undefined.origin'; + + const BEFORE_DYNAFORM = 'executed.before.dynaform'; + + const AFTER_DYNAFORM = 'executed.after.dynaform'; + + const BEFORE_INPUT_DOCUMENT = 'executed.before.input'; + + const AFTER_INPUT_DOCUMENT = 'executed.after.input'; + + const BEFORE_OUTPUT_DOCUMENT = 'executed.before.output'; + + const AFTER_OUTPUT_DOCUMENT = 'executed.after.output'; + + const BEFORE_EXTERNAL_STEP = 'executed.before.external'; + + const AFTER_EXTERNAL_STEP = 'executed.after.external'; + + const BEFORE_ASSIGNMENT = 'executed.before.assignment'; + + const BEFORE_ROUTING = 'executed.before.routing'; + + const AFTER_ROUTING = 'executed.after.routing'; + + const CONDITION = 'executed.condition'; + + const SCRIPT_TASK = 'executed.script.task'; + + const CLASSIC_PROCESS_EVENTS = 'executed.classic.process.events'; + + const SELF_SERVICE_TIMEOUT = 'executed.selfservice.timeout'; + + const ISOLATED_TRIGGER = 'executed.isolated.trigger'; + + const PROCESS_ACTION = 'executed.process.action'; + + const EVALUATE_FUNCTION = 'executed.evaluate.function'; + /** * @var array $dataTrigger */ @@ -72,16 +112,48 @@ class PMScript public $scriptExecutionTime = 0; public $sRegexp = '/\@(?:([\@\%\#\?\$\=\&])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+|\-\>([a-zA-Z\_]\w*))?/'; + /** + * Execution origin, by default is undefined + */ + protected $executedOn = self::UNDEFINED_ORIGIN; + + /** + * Variables changed in the trigger execution + */ + private $varsChanged = []; + /** * Constructor of the class PMScript * * @return void */ - public function PMScript() + public function __construct() { $this->aFields['__ERROR__'] = 'none'; } + /** + * Set the fields changed in the trigger execution + * + * @param array $v + * + * @return void + */ + public function setVarsChanged(array $v) + { + $this->varsChanged = $v; + } + + /** + * Get the fields changed in the trigger execution + * + * @return array + */ + public function getVarsChanged() + { + return $this->varsChanged; + } + /** * Set the fields to use * @@ -161,6 +233,77 @@ public function setDataTrigger($dataTrigger) $this->dataTrigger = is_array($dataTrigger) ? $dataTrigger : []; } + /** + * Set the execution origin + * + * @param string $executedOn + */ + public function setExecutedOn($executedOn) + { + $this->executedOn = $executedOn; + } + + /** + * Get the execution origin + * + * @return string + */ + public function executedOn() { + return $this->executedOn; + } + + /** + * Helper to get the execution origin from an step + * + * @param string $stepType + * @param mixed $stepUidObj + * @param string $triggerType + * + * @return string + */ + public function getExecutionOriginForAStep($stepType, $stepUidObj, $triggerType) + { + switch ($stepType) { + case 'DYNAFORM': + $executedOn = $triggerType === 'BEFORE' ? self::BEFORE_DYNAFORM : $triggerType === 'AFTER' ? + self::AFTER_DYNAFORM : self::UNDEFINED_ORIGIN; + break; + case 'INPUT_DOCUMENT': + $executedOn = $triggerType === 'BEFORE' ? self::BEFORE_INPUT_DOCUMENT : $triggerType === 'AFTER' ? + self::AFTER_INPUT_DOCUMENT : self::UNDEFINED_ORIGIN; + break; + case 'OUTPUT_DOCUMENT': + $executedOn = $triggerType === 'BEFORE' ? self::BEFORE_OUTPUT_DOCUMENT : $triggerType === 'AFTER' ? + self::AFTER_OUTPUT_DOCUMENT : self::UNDEFINED_ORIGIN; + break; + case 'EXTERNAL': + $executedOn = $triggerType === 'BEFORE' ? self::BEFORE_EXTERNAL_STEP : $triggerType === 'AFTER' ? + self::AFTER_EXTERNAL_STEP : self::UNDEFINED_ORIGIN; + break; + case 'ASSIGN_TASK': + $stepUidObj = (int)$stepUidObj; + if ($stepUidObj === -1) { + $executedOn = $triggerType === 'BEFORE' ? self::BEFORE_ASSIGNMENT : self::UNDEFINED_ORIGIN; + } elseif ($stepUidObj === -2) { + $executedOn = $triggerType === 'BEFORE' ? self::BEFORE_ROUTING : ($triggerType === 'AFTER' ? + self::AFTER_ROUTING : self::UNDEFINED_ORIGIN); + } else { + $executedOn = self::UNDEFINED_ORIGIN; + } + break; + case 'PROCESS_ACTION': + $executedOn = self::PROCESS_ACTION; + break; + case 'SCRIPT_TASK': + $executedOn = self::SCRIPT_TASK; + break; + default: + $executedOn = self::UNDEFINED_ORIGIN; + break; + } + return $executedOn; + } + /** * @param $sScript * @param $sCode @@ -168,7 +311,7 @@ public function setDataTrigger($dataTrigger) public function executeAndCatchErrors($sScript, $sCode) { ob_start('handleFatalErrors'); - set_error_handler('handleErrors'); + set_error_handler('handleErrors', ini_get('error_reporting')); $_SESSION['_CODE_'] = $sCode; $_SESSION['_DATA_TRIGGER_'] = $this->dataTrigger; $_SESSION['_DATA_TRIGGER_']['_EXECUTION_TIME_'] = microtime(true); @@ -328,7 +471,9 @@ public function execute() $sScript = "try {\n" . $sScript . "\n} catch (Exception \$oException) {\n " . " \$this->aFields['__ERROR__'] = utf8_encode(\$oException->getMessage());\n}"; $this->executeAndCatchErrors($sScript, $this->sScript); - + //We get the affected_fields only if has the prefix + //@see https://wiki.processmaker.com/3.2/Triggers#Typing_rules_for_Case_Variables + $this->setVarsChanged($this->affected_fields); $this->aFields["__VAR_CHANGED__"] = implode(",", $this->affected_fields); for ($i = 0; $i < count($this->affected_fields); $i ++) { $_SESSION['TRIGGER_DEBUG']['DATA'][] = Array('key' => $this->affected_fields[$i], 'value' => isset($this->aFields[$this->affected_fields[$i]]) ? $this->aFields[$this->affected_fields[$i]] : '' diff --git a/workflow/engine/classes/class.webdav.php b/workflow/engine/classes/class.webdav.php index 4fd290379..d4d9503d6 100644 --- a/workflow/engine/classes/class.webdav.php +++ b/workflow/engine/classes/class.webdav.php @@ -944,6 +944,8 @@ public function UNLOCK(&$options) * * @param string resource path to check for locks * @return bool true on success + * @link https://wiki.processmaker.com/index.php/WebDAV + * @deprecated */ public function checkLock($path) { @@ -959,7 +961,9 @@ public function checkLock($path) if ($res) { $row = mysqli_fetch_array($res); - mysqli_free_result($res); + if (is_resource($res)) { + mysqli_free_result($res); + } if ($row) { $result = array("type" => "write", "scope" => $row["exclusivelock"] ? "exclusive" : "shared", "depth" => 0, "owner" => $row['owner'], "token" => $row['token'], "expires" => $row['expires'] diff --git a/workflow/engine/classes/model/AbeConfiguration.php b/workflow/engine/classes/model/AbeConfiguration.php index 6b740d85a..66b6cf0d0 100644 --- a/workflow/engine/classes/model/AbeConfiguration.php +++ b/workflow/engine/classes/model/AbeConfiguration.php @@ -48,6 +48,17 @@ public function load($abeUid) } } + /** + * Create or update. + * + * @param array $data + * @throws Exception + * + * @see Processes->createActionsByEmail() + * @see ProcessMaker\BusinessModel\ActionsByEmail->saveConfiguration() + * @see ProcessMaker\BusinessModel\ActionsByEmail->saveConfiguration2() + * @link https://wiki.processmaker.com/3.3/Actions_by_Email#Configuration + */ public function createOrUpdate($data) { foreach ($data as $field => $value) { @@ -70,6 +81,11 @@ public function createOrUpdate($data) } else { $abeConfigurationInstance = AbeConfigurationPeer::retrieveByPK($data['ABE_UID']); } + //Only the 'FIELD' and 'LINK' types have a DYN_UID, + //the DYN_UID field is empty when the type is 'CUSTOM'. + if ($data['ABE_TYPE'] === 'CUSTOM') { + $data['DYN_UID'] = ''; + } if (isset($data['ABE_CUSTOM_GRID'])) { $data['ABE_CUSTOM_GRID'] = serialize($data['ABE_CUSTOM_GRID']); diff --git a/workflow/engine/classes/model/AdditionalTables.php b/workflow/engine/classes/model/AdditionalTables.php index a80578e2a..1eefa6356 100644 --- a/workflow/engine/classes/model/AdditionalTables.php +++ b/workflow/engine/classes/model/AdditionalTables.php @@ -56,8 +56,41 @@ function validateType($value, $type) class AdditionalTables extends BaseAdditionalTables { - public $fields = array(); - public $primaryKeys = array(); + const FLD_TYPE_VALUES = [ + 'BIGINT', + 'BOOLEAN', + 'CHAR', + 'DATE', + 'DATETIME', + 'DECIMAL', + 'DOUBLE', + 'FLOAT', + 'INTEGER', + 'LONGVARCHAR', + 'REAL', + 'SMALLINT', + 'TIME', + 'TIMESTAMP', + 'TINYINT', + 'VARCHAR' + ]; + const FLD_TYPE_WITH_AUTOINCREMENT = [ + 'BIGINT', + 'INTEGER', + 'SMALLINT', + 'TINYINT' + ]; + const FLD_TYPE_WITH_SIZE = [ + 'BIGINT', + 'CHAR', + 'DECIMAL', + 'FLOAT', + 'INTEGER', + 'LONGVARCHAR', + 'VARCHAR' + ]; + public $fields = []; + public $primaryKeys = []; /** * Function load @@ -707,85 +740,84 @@ public function deleteDataInTable($sUID, $aKeys) */ public function populateReportTable($tableName, $sConnection = 'rp', $type = 'NORMAL', $processUid = '', $gridKey = '', $addTabUid = '') { - require_once "classes/model/Application.php"; - $this->className = $this->getPHPName($tableName); $this->classPeerName = $this->className . 'Peer'; if (!file_exists(PATH_WORKSPACE . 'classes/' . $this->className . '.php')) { - throw new Exception("ERROR: " . PATH_WORKSPACE . 'classes/' . $this->className . '.php' - . " class file doesn't exit!"); + throw new Exception("ERROR: " . PATH_WORKSPACE . 'classes/' . $this->className . '.php' . " class file doesn't exit!"); } require_once PATH_WORKSPACE . 'classes/' . $this->className . '.php'; + //get fields + $fieldTypes = []; + if ($addTabUid != '') { + $criteria = new Criteria('workflow'); + $criteria->add(FieldsPeer::ADD_TAB_UID, $addTabUid); + $dataset = FieldsPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + while ($dataset->next()) { + $row = $dataset->getRow(); + switch ($row['FLD_TYPE']) { + case 'FLOAT': + case 'DOUBLE': + case 'INTEGER': + $fieldTypes[] = array($row['FLD_NAME'] => $row['FLD_TYPE']); + break; + default: + break; + } + } + } + + //remove old applications references + $connection = Propel::getConnection($sConnection); + $statement = $connection->createStatement(); + $sql = "TRUNCATE " . $tableName; + $statement->executeQuery($sql); + + $case = new Cases(); + $context = Bootstrap::getDefaultContextLog(); + //select cases for this Process, ordered by APP_NUMBER - $con = Propel::getConnection($sConnection); - $stmt = $con->createStatement(); $criteria = new Criteria('workflow'); $criteria->add(ApplicationPeer::PRO_UID, $processUid); $criteria->addAscendingOrderByColumn(ApplicationPeer::APP_NUMBER); $dataset = ApplicationPeer::doSelectRS($criteria); $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - while ($dataset->next()) { $row = $dataset->getRow(); - //remove old applications references - $deleteSql = "DELETE FROM $tableName WHERE APP_UID = '" . $row['APP_UID'] . "'"; - $rs = $stmt->executeQuery($deleteSql); - // getting the case data - $caseData = unserialize($row['APP_DATA']); - $fieldTypes = array(); - - if ($addTabUid != '') { - require_once 'classes/model/Fields.php'; - $criteriaField = new Criteria('workflow'); - $criteriaField->add(FieldsPeer::ADD_TAB_UID, $addTabUid); - $datasetField = FieldsPeer::doSelectRS($criteriaField); - $datasetField->setFetchmode(ResultSet::FETCHMODE_ASSOC); - while ($datasetField->next()) { - $rowfield = $datasetField->getRow(); - switch ($rowfield['FLD_TYPE']) { - case 'FLOAT': - case 'DOUBLE': - case 'INTEGER': - $fieldTypes[] = array($rowfield['FLD_NAME'] => $rowfield['FLD_TYPE']); - break; - default: - break; - } - } - } + //getting the case data + $appData = $case->unserializeData($row['APP_DATA']); - // quick fix - // map all empty values as NULL for Database - foreach ($caseData as $dKey => $dValue) { - if (is_array($dValue) && count($dValue)) { - $j = key($dValue); - $dValue = (is_array($dValue[$j])) ? $dValue : $dValue[$j]; + //quick fix, map all empty values as NULL for Database + foreach ($appData as $appDataKey => $appDataValue) { + if (is_array($appDataValue) && count($appDataValue)) { + $j = key($appDataValue); + $appDataValue = is_array($appDataValue[$j]) ? $appDataValue : $appDataValue[$j]; } - if (is_string($dValue)) { + if (is_string($appDataValue)) { foreach ($fieldTypes as $key => $fieldType) { - foreach ($fieldType as $name => $theType) { - if (strtoupper($dKey) == $name) { - $caseData[$dKey] = validateType($dValue, $theType); - unset($name); + foreach ($fieldType as $fieldTypeKey => $fieldTypeValue) { + if (strtoupper($appDataKey) == $fieldTypeKey) { + $appData[$appDataKey] = validateType($appDataValue, $fieldTypeValue); + unset($fieldTypeKey); } } } // normal fields - if (trim($dValue) === '') { - $caseData[$dKey] = null; + if (trim($appDataValue) === '') { + $appData[$appDataKey] = null; } } else { // grids - if (is_array($caseData[$dKey])) { - foreach ($caseData[$dKey] as $dIndex => $dRow) { + if (is_array($appData[$appDataKey])) { + foreach ($appData[$appDataKey] as $dIndex => $dRow) { if (is_array($dRow)) { foreach ($dRow as $k => $v) { if (is_string($v) && trim($v) === '') { - $caseData[$dKey][$dIndex][$k] = null; + $appData[$appDataKey][$dIndex][$k] = null; } } } @@ -794,33 +826,48 @@ public function populateReportTable($tableName, $sConnection = 'rp', $type = 'NO } } + //populate data + $className = $this->className; if ($type === 'GRID') { list($gridName, $gridUid) = explode('-', $gridKey); - $gridData = isset($caseData[$gridName]) ? $caseData[$gridName] : array(); - + $gridData = isset($appData[$gridName]) ? $appData[$gridName] : []; foreach ($gridData as $i => $gridRow) { - eval('$obj = new ' . $this->className . '();'); - $obj->fromArray($caseData, BasePeer::TYPE_FIELDNAME); + try { + $obj = new $className(); + $obj->fromArray($appData, BasePeer::TYPE_FIELDNAME); + $obj->setAppUid($row['APP_UID']); + $obj->setAppNumber($row['APP_NUMBER']); + if (method_exists($obj, 'setAppStatus')) { + $obj->setAppStatus($row['APP_STATUS']); + } + $obj->fromArray(array_change_key_case($gridRow, CASE_UPPER), BasePeer::TYPE_FIELDNAME); + $obj->setRow($i); + $obj->save(); + } catch (Exception $e) { + $context["message"] = $e->getMessage(); + $context["tableName"] = $tableName; + $context["appUid"] = $row['APP_UID']; + Bootstrap::registerMonolog("sqlExecution", 500, "Sql Execution", $context, $context["workspace"], "processmaker.log"); + } + unset($obj); + } + } else { + try { + $obj = new $className(); + $obj->fromArray(array_change_key_case($appData, CASE_UPPER), BasePeer::TYPE_FIELDNAME); $obj->setAppUid($row['APP_UID']); $obj->setAppNumber($row['APP_NUMBER']); if (method_exists($obj, 'setAppStatus')) { $obj->setAppStatus($row['APP_STATUS']); } - $obj->fromArray(array_change_key_case($gridRow, CASE_UPPER), BasePeer::TYPE_FIELDNAME); - $obj->setRow($i); $obj->save(); - eval('$obj = new ' . $this->className . '();'); + } catch (Exception $e) { + $context["message"] = $e->getMessage(); + $context["tableName"] = $tableName; + $context["appUid"] = $row['APP_UID']; + Bootstrap::registerMonolog("sqlExecution", 500, "Sql Execution", $context, $context["workspace"], "processmaker.log"); } - } else { - eval('$obj = new ' . $this->className . '();'); - $obj->fromArray(array_change_key_case($caseData, CASE_UPPER), BasePeer::TYPE_FIELDNAME); - $obj->setAppUid($row['APP_UID']); - $obj->setAppNumber($row['APP_NUMBER']); - if (method_exists($obj, 'setAppStatus')) { - $obj->setAppStatus($row['APP_STATUS']); - } - $obj->save(); - $obj = null; + unset($obj); } } } @@ -1022,94 +1069,181 @@ public function getReportTables($proUid) return $reportTables; } + /** + * Get all data of AdditionalTables. + * + * @param int $start + * @param int $limit + * @param string $filter + * @param array $process + * @return array + */ public function getAll($start = 0, $limit = 20, $filter = '', $process = null) { - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID); - $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME); - $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION); - $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TYPE); - $oCriteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG); - $oCriteria->addSelectColumn(AdditionalTablesPeer::PRO_UID); - $oCriteria->addSelectColumn(AdditionalTablesPeer::DBS_UID); + $criteria = new Criteria('workflow'); + $criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_UID); + $criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME); + $criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_DESCRIPTION); + $criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TYPE); + $criteria->addSelectColumn(AdditionalTablesPeer::ADD_TAB_TAG); + $criteria->addSelectColumn(AdditionalTablesPeer::PRO_UID); + $criteria->addSelectColumn(AdditionalTablesPeer::DBS_UID); if (isset($process)) { foreach ($process as $key => $pro_uid) { if ($key == 'equal') { - $oCriteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::EQUAL); + $criteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::EQUAL); } else { - $oCriteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::NOT_EQUAL); + $criteria->add(AdditionalTablesPeer::PRO_UID, $pro_uid, Criteria::NOT_EQUAL); } } } if ($filter != '' && is_string($filter)) { - $oCriteria->add( - $oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_NAME, '%' . $filter . '%', Criteria::LIKE)->addOr( - $oCriteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_DESCRIPTION, '%' . $filter . '%', Criteria::LIKE) - ) - ); + $subCriteria2 = $criteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_DESCRIPTION, '%' + . $filter + . '%', Criteria::LIKE); + $subCriteria1 = $criteria->getNewCriterion(AdditionalTablesPeer::ADD_TAB_NAME, '%' + . $filter + . '%', Criteria::LIKE) + ->addOr($subCriteria2); + $criteria->add($subCriteria1); } - if (isset($_POST['sort'])) { + $criteria->addAsColumn("PRO_TITLE", ProcessPeer::PRO_TITLE); + $criteria->addAsColumn("PRO_DESCRIPTION", ProcessPeer::PRO_DESCRIPTION); + $criteria->addJoin(AdditionalTablesPeer::PRO_UID, ProcessPeer::PRO_UID, Criteria::LEFT_JOIN); + + $stringBuild = ''; + $stringSql = "ADDITIONAL_TABLES.ADD_TAB_NAME IN (" + . "SELECT TABLE_NAME " + . "FROM information_schema.tables " + . "WHERE table_schema = DATABASE()" + . ")"; + $buildNumberRows = clone $criteria; + $buildNumberRows->clear(); + $buildNumberRows->addSelectColumn(AdditionalTablesPeer::ADD_TAB_NAME); + $buildNumberRows->addAsColumn("EXISTS_TABLE", $stringSql); + $dataset1 = AdditionalTablesPeer::doSelectRS($buildNumberRows); + $dataset1->setFetchmode(ResultSet::FETCHMODE_ASSOC); + while ($dataset1->next()) { + $row = $dataset1->getRow(); + $stringCount = "'" . G::LoadTranslation('ID_TABLE_NOT_FOUND') . "'"; + if ($row["EXISTS_TABLE"] === "1") { + $stringCount = "(SELECT COUNT(*) FROM " . $row["ADD_TAB_NAME"] . ")"; + } + $stringBuild = $stringBuild + . "WHEN '" . $row["ADD_TAB_NAME"] + . "' THEN " . $stringCount + . " \n"; + } + $clauseRows = empty($stringBuild) ? "''" : "(CASE " + . AdditionalTablesPeer::ADD_TAB_NAME + . " " + . $stringBuild + . " END)"; + $criteria->addAsColumn("NUM_ROWS", $clauseRows); + + if (empty($_POST['sort'])) { + $criteria->addAscendingOrderByColumn(AdditionalTablesPeer::ADD_TAB_NAME); + } else { + $column = $_POST["sort"]; + if (defined('AdditionalTablesPeer::' . $column)) { + $column = constant('AdditionalTablesPeer::' . $column); + } + if ($column === "NUM_ROWS") { + $column = "IF(" . $column . "='" . G::LoadTranslation('ID_TABLE_NOT_FOUND') . "',-1," . $column . ")"; + } if ($_POST['dir'] == 'ASC') { - eval('$oCriteria->addAscendingOrderByColumn(AdditionalTablesPeer::' . $_POST['sort'] . ');'); + $criteria->addAscendingOrderByColumn($column); } else { - eval('$oCriteria->addDescendingOrderByColumn(AdditionalTablesPeer::' . $_POST['sort'] . ');'); + $criteria->addDescendingOrderByColumn($column); } - } else { - $oCriteria->addAscendingOrderByColumn(AdditionalTablesPeer::ADD_TAB_NAME); } - $criteriaCount = clone $oCriteria; + $criteriaCount = clone $criteria; $count = AdditionalTablesPeer::doCount($criteriaCount); - $oCriteria->setLimit($limit); - $oCriteria->setOffset($start); - - $oDataset = AdditionalTablesPeer::doSelectRS($oCriteria); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $criteria->setLimit($limit); + $criteria->setOffset($start); - $addTables = array(); - $proUids = array(); + $dataset = AdditionalTablesPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); - while ($oDataset->next()) { - $row = $oDataset->getRow(); - $row['PRO_TITLE'] = $row['PRO_DESCRIPTION'] = ''; + $addTables = []; + while ($dataset->next()) { + $row = $dataset->getRow(); $addTables[] = $row; - if ($row['PRO_UID'] != '') { - $proUids[] = $row['PRO_UID']; - } } - //process details will have the info about the processes - $procDetails = array(); + return [ + 'rows' => $addTables, + 'count' => $count + ]; + } + + /** + * Get the table properties + * + * @param string $tabUid + * @param array $tabData + * @param boolean $isReportTable + * + * @return array + * @throws Exception + */ + public static function getTableProperties($tabUid, $tabData = [], $isReportTable = false) + { + $criteria = new Criteria('workflow'); + $criteria->add(AdditionalTablesPeer::ADD_TAB_UID, $tabUid, Criteria::EQUAL); + $dataset = AdditionalTablesPeer::doSelectOne($criteria); - if (count($proUids) > 0) { - //now get the labels for all process, using an array of Uids, - $c = new Criteria('workflow'); - $c->add(ProcessPeer::PRO_UID, $proUids, Criteria::IN); - $dt = ProcessPeer::doSelectRS($c); - $dt->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataValidate = []; + if (!is_null($dataset)) { + $dataValidate['rep_tab_uid'] = $tabUid; - while ($dt->next()) { - $row = $dt->getRow(); - $procDetails[$row['PRO_UID']]['PRO_TITLE'] = $row['PRO_TITLE']; - $procDetails[$row['PRO_UID']]['PRO_DESCRIPTION'] = $row['PRO_DESCRIPTION']; + $tableName = $dataset->getAddTabName(); + if (substr($tableName, 0, 4) === 'PMT_') { + $tableNameWithoutPrefixPmt = substr($tableName, 4); + } else { + $tableNameWithoutPrefixPmt = $tableName; } - foreach ($addTables as $i => $addTable) { - if (isset($procDetails[$addTable['PRO_UID']]['PRO_TITLE'])) { - $addTables[$i]['PRO_TITLE'] = $procDetails[$addTable['PRO_UID']]['PRO_TITLE']; + $dataValidate['rep_tab_name'] = $tableNameWithoutPrefixPmt; + $dataValidate['rep_tab_name_old_name'] = $tableName; + $dataValidate['pro_uid'] = $dataset->getProUid(); + $dataValidate['rep_tab_dsc'] = $dataset->getAddTabDescription(); + $dataValidate['rep_tab_connection'] = $dataset->getDbsUid(); + $dataValidate['rep_tab_type'] = $dataset->getAddTabType(); + $dataValidate['rep_tab_grid'] = ''; + + if ($isReportTable) { + if (!empty($tabData['pro_uid']) && $dataValidate['pro_uid'] !== $tabData['pro_uid']) { + throw (new Exception("The property pro_uid: '". $tabData['pro_uid'] . "' is incorrect.")); } - - if (isset($procDetails[$addTable['PRO_UID']]['PRO_DESCRIPTION'])) { - $addTables[$i]['PRO_DESCRIPTION'] = $procDetails[$addTable['PRO_UID']]['PRO_DESCRIPTION']; + if (!empty($tabData['rep_tab_name']) && $tableName !== $tabData['rep_tab_name']) { + throw (new Exception("The property rep_tab_name: '". $tabData['rep_tab_name'] . "' is incorrect.")); + } + if (!empty($dataValidate['rep_tab_dsc'])) { + $dataValidate['rep_tab_dsc'] = $tabData['rep_tab_dsc']; + } + $tabGrid = $dataset->getAddTabGrid(); + if (strpos($tabGrid, '-')) { + list($gridName, $gridId) = explode('-', $tabGrid); + $dataValidate['rep_tab_grid'] = $gridId; + } + } else { + if (!empty($tabData['rep_tab_name']) && $tableName !== $tabData['pmt_tab_name']) { + throw (new Exception("The property pmt_tab_name: '". $tabData['pmt_tab_name'] . "' is incorrect.")); + } + if (!empty($dataValidate['pmt_tab_dsc'])) { + $dataValidate['rep_tab_dsc'] = $tabData['pmt_tab_dsc']; } } + $dataValidate['fields'] = $tabData['fields']; } - return array('rows' => $addTables, 'count' => $count); + return $dataValidate; } /** diff --git a/workflow/engine/classes/model/AppAssignSelfServiceValue.php b/workflow/engine/classes/model/AppAssignSelfServiceValue.php index b2fea9d9b..07a68e6ab 100644 --- a/workflow/engine/classes/model/AppAssignSelfServiceValue.php +++ b/workflow/engine/classes/model/AppAssignSelfServiceValue.php @@ -64,6 +64,12 @@ public function create($applicationUid, $delIndex, array $arrayData, $dataVariab * * @return void * @throws Exception + * + * @see \Cases->removeCase() + * @see \Cases->setCatchUser() + * @see \Cases->updateCase() + * + * @link https://wiki.processmaker.com/3.2/Tasks#Self_Service_Value_Based_Assignment */ public function remove($applicationUid, $delIndex = 0) { @@ -76,18 +82,7 @@ public function remove($applicationUid, $delIndex = 0) $criteria->add(AppAssignSelfServiceValuePeer::DEL_INDEX, $delIndex, Criteria::EQUAL); } - $result = AppAssignSelfServiceValuePeer::doDelete($criteria); - - // Delete related rows and missing relations, criteria don't execute delete with joins - $cnn = Propel::getConnection(AppAssignSelfServiceValueGroupPeer::DATABASE_NAME); - $cnn->begin(); - $stmt = $cnn->createStatement(); - $rs = $stmt->executeQuery("DELETE " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . " - FROM " . AppAssignSelfServiceValueGroupPeer::TABLE_NAME . " - LEFT JOIN " . AppAssignSelfServiceValuePeer::TABLE_NAME . " - ON (" . AppAssignSelfServiceValueGroupPeer::ID . " = " . AppAssignSelfServiceValuePeer::ID . ") - WHERE " . AppAssignSelfServiceValuePeer::ID . " IS NULL"); - $cnn->commit(); + AppAssignSelfServiceValuePeer::doDelete($criteria); } catch (Exception $e) { throw $e; } diff --git a/workflow/engine/classes/model/AppDelegation.php b/workflow/engine/classes/model/AppDelegation.php index 46515e324..0c42d79cf 100644 --- a/workflow/engine/classes/model/AppDelegation.php +++ b/workflow/engine/classes/model/AppDelegation.php @@ -223,7 +223,6 @@ public function createAppDelegation($sProUid, $sAppUid, $sTasUid, $sUsrUid, $sAp try { $res = $this->save(); } catch (PropelException $e) { - error_log($e->getMessage()); return; } } else { @@ -1012,4 +1011,45 @@ public static function getLastIndexByUserAndStatus($appNumber, $usrId, $status = return $delIndex; } + + /** + * Update the priority in AppDelegation table, using the defined variable in task + * + * @param integer $delIndex + * @param string $tasUid + * @param string $appUid + * @param array $fieldAppData + * + * @return void + * + * @see Cases->update() + * + */ + public function updatePriority($delIndex, $tasUid, $appUid, $fieldAppData) + { + if (!empty($delIndex) && !empty($tasUid)) { + //Optimized code to avoid load task content row. + $criteria = new Criteria(); + $criteria->clearSelectColumns(); + $criteria->addSelectColumn(TaskPeer::TAS_PRIORITY_VARIABLE); + $criteria->add(TaskPeer::TAS_UID, $tasUid); + $rs = TaskPeer::doSelectRS($criteria); + $rs->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $rs->next(); + $row = $rs->getRow(); + $tasPriority = substr($row['TAS_PRIORITY_VARIABLE'], 2); + //End optimized code. + + $x = $fieldAppData; + if (!empty($x[$tasPriority])) { + $array = []; + $array['APP_UID'] = $appUid; + $array['DEL_INDEX'] = $delIndex; + $array['TAS_UID'] = $tasUid; + $array['DEL_PRIORITY'] = (isset($x[$tasPriority]) ? + ($x[$tasPriority] >= 1 && $x[$tasPriority] <= 5 ? $x[$tasPriority] : '3') : '3'); + $this->update($array); + } + } + } } diff --git a/workflow/engine/classes/model/AppDocument.php b/workflow/engine/classes/model/AppDocument.php index 93c404084..1916c1de8 100644 --- a/workflow/engine/classes/model/AppDocument.php +++ b/workflow/engine/classes/model/AppDocument.php @@ -636,5 +636,84 @@ public function canDownloadOutput($userGenerateDocument, $userCanDownload, $proU } return false; } + + /** + * This function will upload a file related to the AppDocument + * + * @param string $appUid + * @param string $userUid + * @param integer $delIndex + * @param mixed $docUid + * @param array $file + * @param string $varName + * @param string $appDocUid + * + * @return object + * @throws Exception + */ + public function uploadAppDocument( + $appUid, + $userUid, + $delIndex = 1, + $docUid = -1, + $file = [], + $varName = null, + $appDocUid = null + ) { + $appDocType = 'ATTACHED'; + $folderId = ''; + // Create the folder + if ($docUid != -1) { + $appDocType = 'INPUT'; + $folder = new AppFolder(); + $folderId = $folder->createFolderFromInputDoc($docUid, $appUid); + } + $fieldsInput = [ + "DOC_VERSION" => 1, + "APP_UID" => $appUid, + "DEL_INDEX" => $delIndex, + "USR_UID" => $userUid, + "DOC_UID" => $docUid, + "APP_DOC_TYPE" => $appDocType, + "APP_DOC_CREATE_DATE" => date("Y-m-d H:i:s"), + "APP_DOC_COMMENT" => "", + "APP_DOC_TITLE" => "", + "APP_DOC_FILENAME" => $file["name"], + "APP_DOC_FIELDNAME" => !empty($varName) ? $varName : null, + "FOLDER_UID" => $folderId + ]; + + // If the APP_DOC_UID exist will create a new version + if (!empty($appDocUid)) { + $fieldsInput["APP_DOC_UID"] = $appDocUid; + } + + // Create the register in the database + $newInstance = new AppDocument(); + $appDocUid = $newInstance->create($fieldsInput); + $docVersion = $newInstance->getDocVersion(); + + // Move the uploaded file to the documents folder + try { + $info = pathinfo($file["name"]); + $extension = ((isset($info["extension"])) ? $info["extension"] : ""); + $pathCase = G::getPathFromUID($appUid); + $fileName = $appDocUid . "_" . $docVersion . "." . $extension; + + G::uploadFile( + $file["tmp_name"], + PATH_DOCUMENT . $pathCase . PATH_SEP, + $fileName + ); + } catch (Exception $e) { + // Delete the register from Database + $this->remove($appDocUid, $docVersion); + + throw $e; + } + + return $newInstance; + } } + diff --git a/workflow/engine/classes/model/AppEvent.php b/workflow/engine/classes/model/AppEvent.php index bbde16350..7a4c91b3c 100644 --- a/workflow/engine/classes/model/AppEvent.php +++ b/workflow/engine/classes/model/AppEvent.php @@ -178,99 +178,96 @@ public function getAppEventsCriteria ($sProcessUid = '', $sStatus = '', $EVN_ACT } } - public function executeEvents ($sNow, $debug = false, &$log = array(), $cron = 0) + public function executeEvents($sNow, $debug = false, &$log = array(), $cron = 0) { $debug = 1; $oCase = new Cases(); try { - $oCriteria = new Criteria( 'workflow' ); + $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn( AppEventPeer::APP_UID ); - $oCriteria->addSelectColumn( AppEventPeer::DEL_INDEX ); - $oCriteria->addSelectColumn( AppEventPeer::EVN_UID ); - $oCriteria->addSelectColumn( AppEventPeer::APP_EVN_ACTION_DATE ); - $oCriteria->addSelectColumn( AppEventPeer::APP_EVN_ATTEMPTS ); - $oCriteria->addSelectColumn( AppEventPeer::APP_EVN_LAST_EXECUTION_DATE ); - $oCriteria->addSelectColumn( AppEventPeer::APP_EVN_STATUS ); - $oCriteria->addSelectColumn( EventPeer::PRO_UID ); - $oCriteria->addSelectColumn( EventPeer::EVN_ACTION ); - $oCriteria->addSelectColumn( EventPeer::TRI_UID ); - $oCriteria->addSelectColumn( EventPeer::EVN_ACTION_PARAMETERS ); - $oCriteria->addSelectColumn( EventPeer::EVN_RELATED_TO ); - $oCriteria->addSelectColumn( AppDelegationPeer::TAS_UID ); - $oCriteria->addSelectColumn( AppDelegationPeer::USR_UID ); - $oCriteria->addSelectColumn( AppDelegationPeer::DEL_TASK_DUE_DATE ); - $oCriteria->addSelectColumn( AppDelegationPeer::DEL_FINISH_DATE ); + $oCriteria->addSelectColumn(AppEventPeer::APP_UID); + $oCriteria->addSelectColumn(AppEventPeer::DEL_INDEX); + $oCriteria->addSelectColumn(AppEventPeer::EVN_UID); + $oCriteria->addSelectColumn(AppEventPeer::APP_EVN_ACTION_DATE); + $oCriteria->addSelectColumn(AppEventPeer::APP_EVN_ATTEMPTS); + $oCriteria->addSelectColumn(AppEventPeer::APP_EVN_LAST_EXECUTION_DATE); + $oCriteria->addSelectColumn(AppEventPeer::APP_EVN_STATUS); + $oCriteria->addSelectColumn(EventPeer::PRO_UID); + $oCriteria->addSelectColumn(EventPeer::EVN_ACTION); + $oCriteria->addSelectColumn(EventPeer::TRI_UID); + $oCriteria->addSelectColumn(EventPeer::EVN_ACTION_PARAMETERS); + $oCriteria->addSelectColumn(EventPeer::EVN_RELATED_TO); + $oCriteria->addSelectColumn(AppDelegationPeer::TAS_UID); + $oCriteria->addSelectColumn(AppDelegationPeer::USR_UID); + $oCriteria->addSelectColumn(AppDelegationPeer::DEL_TASK_DUE_DATE); + $oCriteria->addSelectColumn(AppDelegationPeer::DEL_FINISH_DATE); - $oCriteria->addJoin( AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::JOIN ); + $oCriteria->addJoin(AppEventPeer::EVN_UID, EventPeer::EVN_UID, Criteria::JOIN); $aConditions = array (); - array_push( $aConditions, Array (AppEventPeer::APP_UID,AppDelegationPeer::APP_UID - ) ); - array_push( $aConditions, Array (AppEventPeer::DEL_INDEX,AppDelegationPeer::DEL_INDEX - ) ); - $oCriteria->addJoinMC( $aConditions, Criteria::LEFT_JOIN ); + array_push($aConditions, Array (AppEventPeer::APP_UID,AppDelegationPeer::APP_UID + )); + array_push($aConditions, Array (AppEventPeer::DEL_INDEX,AppDelegationPeer::DEL_INDEX + )); + $oCriteria->addJoinMC($aConditions, Criteria::LEFT_JOIN); - $oCriteria->addJoin( ApplicationPeer::APP_UID, AppEventPeer::APP_UID ); + $oCriteria->addJoin(ApplicationPeer::APP_UID, AppEventPeer::APP_UID); - $oCriteria->add( AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL ); //by me - $oCriteria->add( AppEventPeer::APP_EVN_STATUS, 'OPEN' ); - $oCriteria->add( AppEventPeer::APP_EVN_ACTION_DATE, $sNow, Criteria::LESS_EQUAL ); + $oCriteria->add(AppDelegationPeer::DEL_FINISH_DATE, null, Criteria::ISNULL); + $oCriteria->add(AppEventPeer::APP_EVN_STATUS, 'OPEN'); + $oCriteria->add(AppEventPeer::APP_EVN_ACTION_DATE, $sNow, Criteria::LESS_EQUAL); - $oDataset = AppEventPeer::doSelectRS( $oCriteria ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); + $oDataset = AppEventPeer::doSelectRS($oCriteria); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $c = 0; while ($oDataset->next()) { if ($cron == 1) { - $arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) ); + $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron"))); $arrayCron["processcTimeStart"] = time(); - @file_put_contents( PATH_DATA . "cron", serialize( $arrayCron ) ); + @file_put_contents(PATH_DATA . "cron", serialize($arrayCron)); } $c ++; $aRow = $oDataset->getRow(); $oTrigger = new Triggers(); - $aFields = $oCase->loadCase( $aRow['APP_UID'] ); - $oAppEvent = AppEventPeer::retrieveByPK( $aRow['APP_UID'], $aRow['DEL_INDEX'], $aRow['EVN_UID'] ); - - //g::pr($aRow); //die; - + $aFields = $oCase->loadCase($aRow['APP_UID']); + $oAppEvent = AppEventPeer::retrieveByPK($aRow['APP_UID'], $aRow['DEL_INDEX'], $aRow['EVN_UID']); if ($debug) { require_once 'classes/model/Application.php'; - $oApp = ApplicationPeer::retrieveByPk( $aRow['APP_UID'] ); - $oEv = EventPeer::retrieveByPk( $aRow['EVN_UID'] ); + $oApp = ApplicationPeer::retrieveByPk($aRow['APP_UID']); + $oEv = EventPeer::retrieveByPk($aRow['EVN_UID']); $log[] = 'Event ' . $oEv->getEvnDescription() . ' with ID ' . $aRow['EVN_UID']; - println( "\nOK+ event \"" . $oEv->getEvnDescription() . "\" with ID {} was found" ); - println( " - PROCESS................" . $aRow['PRO_UID'] ); - println( " - APPLICATION............" . $aRow['APP_UID'] . " CASE #" . $oApp->getAppNumber() ); - println( " - ACTION DATE............" . $aRow['APP_EVN_ACTION_DATE'] ); - println( " - ATTEMPTS..............." . $aRow['APP_EVN_ATTEMPTS'] ); - println( " - INTERVAL WITH TASKS...." . $aRow['EVN_RELATED_TO'] ); + println("\nOK+ event \"" . $oEv->getEvnDescription() . "\" with ID {} was found"); + println(" - PROCESS................" . $aRow['PRO_UID']); + println(" - APPLICATION............" . $aRow['APP_UID'] . " CASE #" . $oApp->getAppNumber()); + println(" - ACTION DATE............" . $aRow['APP_EVN_ACTION_DATE']); + println(" - ATTEMPTS..............." . $aRow['APP_EVN_ATTEMPTS']); + println(" - INTERVAL WITH TASKS...." . $aRow['EVN_RELATED_TO']); } if ($aRow['TRI_UID'] == '') { //a rare case when the tri_uid is not set. $log[] = " (!) Any trigger was set................................SKIPPED and will be CLOSED"; if ($debug) { - println( " (!) Any trigger was set................................SKIPPED and will be CLOSED" ); + println(" (!) Any trigger was set................................SKIPPED and will be CLOSED"); } - $oAppEvent->setAppEvnStatus( 'CLOSE' ); + $oAppEvent->setAppEvnStatus('CLOSE'); $oAppEvent->save(); continue; } - $oTrigger = TriggersPeer::retrieveByPk( $aRow['TRI_UID'] ); - if (! is_object( $oTrigger )) { + $oTrigger = TriggersPeer::retrieveByPk($aRow['TRI_UID']); + if (! is_object($oTrigger)) { //the trigger record doesn't exist.. $log[] = ' (!) The trigger ' . $aRow['TRI_UID'] . ' ' . $oTrigger->getTriTitle() . " doesn't exist.......SKIPPED and will be CLOSED"; if ($debug) { - println( " (!) The trigger {$aRow['TRI_UID']} {$oTrigger->getTriTitle()} doesn't exist.......SKIPPED and will be CLOSED" ); + println(" (!) The trigger {$aRow['TRI_UID']} {$oTrigger->getTriTitle()} doesn't exist.......SKIPPED and will be CLOSED"); } - $oAppEvent->setAppEvnStatus( 'CLOSE' ); + $oAppEvent->setAppEvnStatus('CLOSE'); $oAppEvent->save(); continue; } @@ -279,38 +276,37 @@ public function executeEvents ($sNow, $debug = false, &$log = array(), $cron = 0 $oPMScript = new PMScript(); $task = new Task(); - $taskFields = $task->load( $aRow['TAS_UID'] ); + $taskFields = $task->load($aRow['TAS_UID']); $aFields['APP_DATA']['APP_NUMBER'] = $aFields['APP_NUMBER']; $aFields['APP_DATA']['TAS_TITLE'] = $taskFields['TAS_TITLE']; $aFields['APP_DATA']['DEL_TASK_DUE_DATE'] = $aRow['DEL_TASK_DUE_DATE']; $oPMScript->setDataTrigger($oTrigger->toArray(\BasePeer::TYPE_FIELDNAME)); - $oPMScript->setFields( $aFields['APP_DATA'] ); - $oPMScript->setScript( $oTrigger->getTriWebbot() ); - + $oPMScript->setFields($aFields['APP_DATA']); + $oPMScript->setScript($oTrigger->getTriWebbot()); + $oPMScript->setExecutedOn(PMScript::CLASSIC_PROCESS_EVENTS); $oPMScript->execute(); - $oAppEvent->setAppEvnLastExecutionDate( date( 'Y-m-d H:i:s' ) ); + $oAppEvent->setAppEvnLastExecutionDate(date('Y-m-d H:i:s')); - if (sizeof( $_SESSION['TRIGGER_DEBUG']['ERRORS'] ) == 0) { + if (sizeof($_SESSION['TRIGGER_DEBUG']['ERRORS']) == 0) { $log[] = ' - The trigger ' . $oTrigger->getTriTitle() . ' was executed successfully!'; if ($debug) { - println( " - The trigger '{$oTrigger->getTriTitle()}' was executed successfully!" ); - //g::pr($aFields); + println(" - The trigger '{$oTrigger->getTriTitle()}' was executed successfully!"); } $aFields['APP_DATA'] = $oPMScript->aFields; - $oCase->updateCase( $aRow['APP_UID'], $aFields ); - $oAppEvent->setAppEvnStatus( 'CLOSE' ); + $oCase->updateCase($aRow['APP_UID'], $aFields); + $oAppEvent->setAppEvnStatus('CLOSE'); } else { if ($debug) { $log[] = ' - The trigger ' . $aRow['TRI_UID'] . ' throw some errors!'; - println( " - The trigger {$aRow['TRI_UID']} throw some errors!" ); - print_r( $_SESSION['TRIGGER_DEBUG']['ERRORS'] ); + println(" - The trigger {$aRow['TRI_UID']} throw some errors!"); + print_r($_SESSION['TRIGGER_DEBUG']['ERRORS']); $_SESSION['TRIGGER_DEBUG']['ERRORS'] = array(); } if ($oAppEvent->getAppEvnAttempts() > 0) { - $oAppEvent->setAppEvnAttempts( $oAppEvent->getAppEvnAttempts() - 1 ); + $oAppEvent->setAppEvnAttempts($oAppEvent->getAppEvnAttempts() - 1); } else { - $oAppEvent->setAppEvnStatus( 'CLOSE' ); + $oAppEvent->setAppEvnStatus('CLOSE'); } } $oAppEvent->save(); @@ -320,7 +316,7 @@ public function executeEvents ($sNow, $debug = false, &$log = array(), $cron = 0 $log[] = ' Error execute event : ' . $oError->getMessage(); $token = strtotime("now"); PMException::registerErrorLog($oError, $token); - G::outRes( G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token)) ); + G::outRes(G::LoadTranslation("ID_EXCEPTION_LOG_INTERFAZ", array($token))); die; return $oError->getMessage(); } diff --git a/workflow/engine/classes/model/AppFolder.php b/workflow/engine/classes/model/AppFolder.php index 48df924ec..2fdba2748 100644 --- a/workflow/engine/classes/model/AppFolder.php +++ b/workflow/engine/classes/model/AppFolder.php @@ -870,5 +870,23 @@ public function remove ($FolderUid, $rootfolder) $oCriteria->add( AppFolderPeer::FOLDER_UID, $FolderUid ); AppFolderPeer::doDelete( $oCriteria ); } + + /** + * This function will create a folder related to the input document + * + * @param string $docUid + * @param string $appUid + * + * @return string + */ + public function createFolderFromInputDoc($docUid, $appUid) + { + $inputDocument = new InputDocument(); + $inputDocumentData = $inputDocument->load($docUid); + $folder = $this->createFromPath($inputDocumentData["INP_DOC_DESTINATION_PATH"], $appUid); + + return $folder; + } + } diff --git a/workflow/engine/classes/model/AppMessage.php b/workflow/engine/classes/model/AppMessage.php index 90f1fc9a4..8758937b3 100644 --- a/workflow/engine/classes/model/AppMessage.php +++ b/workflow/engine/classes/model/AppMessage.php @@ -160,7 +160,7 @@ public static function getAllStatus() * @param string $appMsgTemplate, * @param string $appMsgAttach, * @param string $appMsgStatus, - * @param string $appMsgShowMsg, + * @param integer $appMsgShowMsg, * @param string $appMsgError, * @param boolean $contentTypeIsHtml * @param integer $appNumber, @@ -183,7 +183,7 @@ public static function buildMessageRow( $appMsgTemplate = '', $appMsgAttach = '', $appMsgStatus = 'pending', - $appMsgShowMsg = '', + $appMsgShowMsg = 1, $appMsgError = '', $contentTypeIsHtml = true, $appNumber = 0, diff --git a/workflow/engine/classes/model/AppNotes.php b/workflow/engine/classes/model/AppNotes.php index 57db63a23..a36b13681 100644 --- a/workflow/engine/classes/model/AppNotes.php +++ b/workflow/engine/classes/model/AppNotes.php @@ -1,7 +1,7 @@ getCaseNotes() + * @see \AppProxy->getNotesList() + * @see \Home->getAppsData() + * @see workflow/engine/methods/cases/caseNotesAjax.php->getNotesList() + * @see \ProcessMaker\BusinessModel\Cases->getCaseNotes() + * @see \ProcessMaker\Services\Api\Light->doGetCaseNotes() + * + * @link https://wiki.processmaker.com/3.2/Case_Notes#Viewing_Existing_Case_Notes + */ + public function getNotesList( $appUid, $usrUid = '', $start = '', @@ -25,70 +50,71 @@ public function getNotesList ( $dir = 'DESC', $dateFrom = '', $dateTo = '', - $search = '') - { - $Criteria = new Criteria( 'workflow' ); - $Criteria->clearSelectColumns(); - - $Criteria->addSelectColumn( AppNotesPeer::APP_UID ); - $Criteria->addSelectColumn( AppNotesPeer::USR_UID ); - $Criteria->addSelectColumn( AppNotesPeer::NOTE_DATE ); - $Criteria->addSelectColumn( AppNotesPeer::NOTE_CONTENT ); - $Criteria->addSelectColumn( AppNotesPeer::NOTE_TYPE ); - $Criteria->addSelectColumn( AppNotesPeer::NOTE_AVAILABILITY ); - $Criteria->addSelectColumn( AppNotesPeer::NOTE_ORIGIN_OBJ ); - $Criteria->addSelectColumn( AppNotesPeer::NOTE_AFFECTED_OBJ1 ); - $Criteria->addSelectColumn( AppNotesPeer::NOTE_AFFECTED_OBJ2 ); - $Criteria->addSelectColumn( AppNotesPeer::NOTE_RECIPIENTS ); - $Criteria->addSelectColumn( UsersPeer::USR_USERNAME ); - $Criteria->addSelectColumn( UsersPeer::USR_FIRSTNAME ); - $Criteria->addSelectColumn( UsersPeer::USR_LASTNAME ); - $Criteria->addSelectColumn( UsersPeer::USR_EMAIL ); - - $Criteria->addJoin( AppNotesPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN ); - - $Criteria->add( AppNotesPeer::APP_UID, $appUid, Criteria::EQUAL ); + $search = '' + ) { + $criteria = new Criteria('workflow'); + $criteria->clearSelectColumns(); + + $criteria->addSelectColumn(AppNotesPeer::APP_UID); + $criteria->addSelectColumn(AppNotesPeer::USR_UID); + $criteria->addSelectColumn(AppNotesPeer::NOTE_DATE); + $criteria->addSelectColumn(AppNotesPeer::NOTE_CONTENT); + $criteria->addSelectColumn(AppNotesPeer::NOTE_TYPE); + $criteria->addSelectColumn(AppNotesPeer::NOTE_AVAILABILITY); + $criteria->addSelectColumn(AppNotesPeer::NOTE_ORIGIN_OBJ); + $criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ1); + $criteria->addSelectColumn(AppNotesPeer::NOTE_AFFECTED_OBJ2); + $criteria->addSelectColumn(AppNotesPeer::NOTE_RECIPIENTS); + $criteria->addSelectColumn(UsersPeer::USR_USERNAME); + $criteria->addSelectColumn(UsersPeer::USR_FIRSTNAME); + $criteria->addSelectColumn(UsersPeer::USR_LASTNAME); + $criteria->addSelectColumn(UsersPeer::USR_EMAIL); + + $criteria->addJoin(AppNotesPeer::USR_UID, UsersPeer::USR_UID, Criteria::LEFT_JOIN); + + $criteria->add(AppNotesPeer::APP_UID, $appUid, Criteria::EQUAL); if ($usrUid != '') { - $Criteria->add( AppNotesPeer::USR_UID, $usrUid, Criteria::EQUAL ); + $criteria->add(AppNotesPeer::USR_UID, $usrUid, Criteria::EQUAL); } if ($dateFrom != '') { - $Criteria->add( AppNotesPeer::NOTE_DATE, $dateFrom, Criteria::GREATER_EQUAL ); + $criteria->add(AppNotesPeer::NOTE_DATE, $dateFrom, Criteria::GREATER_EQUAL); } if ($dateTo != '') { - $Criteria->add( AppNotesPeer::NOTE_DATE, $dateTo, Criteria::LESS_EQUAL ); + $criteria->add(AppNotesPeer::NOTE_DATE, $dateTo, Criteria::LESS_EQUAL); } if ($search != '') { - $Criteria->add( AppNotesPeer::NOTE_CONTENT, '%'.$search.'%', Criteria::LIKE ); + $criteria->add(AppNotesPeer::NOTE_CONTENT, '%' . $search . '%', Criteria::LIKE); } if ($dir == 'DESC') { - $Criteria->addDescendingOrderByColumn($sort); + $criteria->addDescendingOrderByColumn($sort); } else { - $Criteria->addAscendingOrderByColumn($sort); + $criteria->addAscendingOrderByColumn($sort); } - $response = array (); - $totalCount = AppNotesPeer::doCount( $Criteria ); + $response = []; + $totalCount = AppNotesPeer::doCount($criteria); $response['totalCount'] = $totalCount; - $response['notes'] = array (); + $response['notes'] = []; if ($start != '') { - $Criteria->setLimit( $limit ); - $Criteria->setOffset( $start ); + $criteria->setLimit($limit); + $criteria->setOffset($start); } - $oDataset = appNotesPeer::doSelectRS( $Criteria ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $oDataset->next(); + $dataset = AppNotesPeer::doSelectRS($criteria); + $dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $dataset->next(); - while ($aRow = $oDataset->getRow()) { - $aRow['NOTE_CONTENT'] = stripslashes($aRow['NOTE_CONTENT']); - $response['notes'][] = $aRow; - $oDataset->next(); + while ($row = $dataset->getRow()) { + $row['NOTE_CONTENT'] = stripslashes($row['NOTE_CONTENT']); + $response['notes'][] = $row; + $dataset->next(); } - $result['criteria'] = $Criteria; + $result = []; + $result['criteria'] = $criteria; $result['array'] = $response; return $result; @@ -154,8 +180,12 @@ public function postNewNote ($appUid, $usrUid, $noteContent, $notify = true, $no * @param string $noteRecipients * @param string $from * @param integer $delIndex - * + * @return void * @throws Exception + * + * @see AppNotes->addCaseNote() + * @see AppNotes->postNewNote() + * @see workflow/engine/src/ProcessMaker/Util/helpers.php::postNote() */ public function sendNoteNotification ($appUid, $usrUid, $noteContent, $noteRecipients, $from = '', $delIndex = 0) { @@ -169,9 +199,14 @@ public function sendNoteNotification ($appUid, $usrUid, $noteContent, $noteRecip $configuration['MESS_ENGINE'] = ''; } - $users = new Users(); - $userInfo = $users->load($usrUid); - $authorName = ((($userInfo['USR_FIRSTNAME'] != '') || ($userInfo['USR_LASTNAME'] != '')) ? $userInfo['USR_FIRSTNAME'] . ' ' . $userInfo['USR_LASTNAME'] . ' ' : '') . '<' . $userInfo['USR_EMAIL'] . '>'; + //This value can be empty when the previous task is: 'Script Task', 'Timer Event' or other without user. + if (!empty($usrUid)) { + $users = new Users(); + $userInfo = $users->load($usrUid); + $authorName = ((($userInfo['USR_FIRSTNAME'] != '') || ($userInfo['USR_LASTNAME'] != '')) ? $userInfo['USR_FIRSTNAME'] . ' ' . $userInfo['USR_LASTNAME'] . ' ' : '') . '<' . $userInfo['USR_EMAIL'] . '>'; + } else { + $authorName = G::LoadTranslation('UID_UNDEFINED_USER'); + } $cases = new Cases(); $fieldCase = $cases->loadCase($appUid, $delIndex); @@ -193,7 +228,7 @@ public function sendNoteNotification ($appUid, $usrUid, $noteContent, $noteRecip '', $appUid, $delIndex, - 'DERIVATION', + WsBase::MESSAGE_TYPE_CASE_NOTE, G::replaceDataField($configNoteNotification['subject'], $fieldCase), G::buildFrom($configuration, $from), $to, @@ -203,7 +238,7 @@ public function sendNoteNotification ($appUid, $usrUid, $noteContent, $noteRecip '', '', 'pending', - '', + 1, $msgError, true, (isset($fieldCase['APP_NUMBER'])) ? $fieldCase['APP_NUMBER'] : 0, diff --git a/workflow/engine/classes/model/Dynaform.php b/workflow/engine/classes/model/Dynaform.php index f1053c0ac..89979a570 100644 --- a/workflow/engine/classes/model/Dynaform.php +++ b/workflow/engine/classes/model/Dynaform.php @@ -223,14 +223,8 @@ public function create($aData, $pmTableUid = '') $description = "Create from a PM Table: " . $addTabName . ", "; } G::auditLog("CreateDynaform", $description . "Dynaform Title: " . $aData['DYN_TITLE'] . ", Type: " . $aData['DYN_TYPE'] . ", Description: " . $aData['DYN_DESCRIPTION'] . ", Mode: " . $mode); - - $sXml = '' . "\n"; - $sXml .= '' . "\n"; - $sXml .= ''; - G::verifyPath(PATH_DYNAFORM . $this->getProUid(), true); - $oFile = fopen(PATH_DYNAFORM . $this->getProUid() . '/' . $this->getDynUid() . '.xml', 'w'); - fwrite($oFile, $sXml); - fclose($oFile); + + Form::createXMLFile($this->getProUid(), $this->getDynUid(), $this->getDynType(), PATH_DYNAFORM); return $this->getDynUid(); } else { $msg = ''; diff --git a/workflow/engine/classes/model/Groupwf.php b/workflow/engine/classes/model/Groupwf.php index 989c0fca2..d14583f10 100644 --- a/workflow/engine/classes/model/Groupwf.php +++ b/workflow/engine/classes/model/Groupwf.php @@ -98,13 +98,13 @@ public function create($data) $this->setGrpTitle('Default Group Title'); } - if (!empty($aData['GRP_STATUS'])) { + if (!empty($data['GRP_STATUS'])) { $this->setGrpStatus($data['GRP_STATUS']); } else { $this->setGrpStatus('ACTIVE'); } - if (!empty($aData['GRP_LDAP_DN'])) { + if (!empty($data['GRP_LDAP_DN'])) { $this->setGrpLdapDn($data['GRP_LDAP_DN']); } else { $this->setGrpLdapDn(''); diff --git a/workflow/engine/classes/model/ListCompleted.php b/workflow/engine/classes/model/ListCompleted.php index d7c145657..d8c88ef5f 100644 --- a/workflow/engine/classes/model/ListCompleted.php +++ b/workflow/engine/classes/model/ListCompleted.php @@ -13,8 +13,8 @@ * long as it does not already exist in the output directory. * * @package classes.model + * @deprecated Method deprecated in Release 3.3.9 */ -// @codingStandardsIgnoreStart class ListCompleted extends BaseListCompleted implements ListInterface { use ListBaseTrait; diff --git a/workflow/engine/classes/model/ListParticipatedLast.php b/workflow/engine/classes/model/ListParticipatedLast.php index 587d4a21a..1df4db269 100644 --- a/workflow/engine/classes/model/ListParticipatedLast.php +++ b/workflow/engine/classes/model/ListParticipatedLast.php @@ -1,6 +1,7 @@ add(ListParticipatedLastPeer::APP_UID, $appUid, Criteria::EQUAL); + //Update - SET + $criteriaSet = new Criteria("workflow"); + $criteriaSet->add(ListParticipatedLastPeer::APP_STATUS, $status); + BasePeer::doUpdate($criteriaWhere, $criteriaSet, Propel::getConnection("workflow")); + } } diff --git a/workflow/engine/classes/model/ListUnassigned.php b/workflow/engine/classes/model/ListUnassigned.php index 7306ad7fe..a073a8c7b 100644 --- a/workflow/engine/classes/model/ListUnassigned.php +++ b/workflow/engine/classes/model/ListUnassigned.php @@ -333,18 +333,16 @@ public function getSelfServiceCasesByEvaluate($userUid) { try { $arrayAppAssignSelfServiceValueData = []; - $criteria = new Criteria("workflow"); + $group = new Groups(); + //Get the GRP_ID related to the $userUid + $arrayId = $group->getActiveGroupsForAnUserById($userUid); + $sql = "(" - . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID . " IN (" - . " SELECT " . GroupUserPeer::GRP_ID . " " - . " FROM " . GroupUserPeer::TABLE_NAME . " " - . " LEFT JOIN " . GroupwfPeer::TABLE_NAME . " ON (" . GroupUserPeer::GRP_ID . "=" . GroupwfPeer::GRP_ID . ") " - . " WHERE " . GroupUserPeer::USR_UID . "='" . $userUid . "' AND " . GroupwfPeer::GRP_STATUS . "='ACTIVE'" - . " ) AND " - . " " . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE . "=2 " - . ")"; + . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_ID . " IN (" . implode(",", $arrayId) . ") AND " + . " " . AppAssignSelfServiceValueGroupPeer::ASSIGNEE_TYPE . " = 2 " + . ")"; $criteria->setDistinct(); $criteria->addSelectColumn(AppAssignSelfServiceValuePeer::APP_UID); diff --git a/workflow/engine/classes/model/LoginLog.php b/workflow/engine/classes/model/LoginLog.php index c8bc914ca..568dd5bf6 100644 --- a/workflow/engine/classes/model/LoginLog.php +++ b/workflow/engine/classes/model/LoginLog.php @@ -130,5 +130,43 @@ public function getLastLoginAllUsers () } return $aRows; } + + /** + * Returns the last session id of a user + * @param string $userUid User uid + * @return array All session id of php + * @throws PropelException + * @throws SQLException + */ + public function getSessionsIdByUser($userUid) + { + $criteria = new Criteria(); + $criteria->addSelectColumn('LOG_SID'); + $criteria->add(LoginLogPeer::USR_UID, $userUid); + $criteria->add(LoginLogPeer::LOG_STATUS, 'ACTIVE'); + $criteria->setDistinct(); + $criteria->addDescendingOrderByColumn(LoginLogPeer::LOG_INIT_DATE); + $resultSet = LoginLogPeer::doSelectRS($criteria); + $resultSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $row = []; + while($resultSet->next()) { + $row[] = $resultSet->getRow(); + } + return $row; + } + + /** + * Delete all records related to a user uid + * @param string $userUid User uid + * @return int + * @throws PropelException + */ + public function removeByUser($userUid) + { + $criteria = new Criteria(); + $criteria->add(LoginLogPeer::USR_UID, $userUid); + $resultSet = LoginLogPeer::doDelete($criteria); + return $resultSet; + } } diff --git a/workflow/engine/classes/model/OauthAccessTokens.php b/workflow/engine/classes/model/OauthAccessTokens.php index 6d251b992..e40db5772 100644 --- a/workflow/engine/classes/model/OauthAccessTokens.php +++ b/workflow/engine/classes/model/OauthAccessTokens.php @@ -173,6 +173,20 @@ public function getAll($arrayFilterData = array(), $sortField = "", $sortDir = " return array("numRecTotal" => $numRecTotal, "data" => $arrayData); } + + /** + * Delete all records related to a user uid + * @param string $userUid User uid + * @return int + * @throws PropelException + */ + public function removeByUser($userUid) + { + $criteria = new Criteria(); + $criteria->add(OauthAccessTokensPeer::USER_ID, $userUid); + $resultSet = OauthAccessTokensPeer::doDelete($criteria); + return $resultSet; + } } // OauthAccessTokens diff --git a/workflow/engine/classes/model/OauthAuthorizationCodes.php b/workflow/engine/classes/model/OauthAuthorizationCodes.php index 491e49d0c..415f3229e 100644 --- a/workflow/engine/classes/model/OauthAuthorizationCodes.php +++ b/workflow/engine/classes/model/OauthAuthorizationCodes.php @@ -14,6 +14,19 @@ * * @package classes.model */ -class OauthAuthorizationCodes extends BaseOauthAuthorizationCodes { - +class OauthAuthorizationCodes extends BaseOauthAuthorizationCodes +{ + /** + * Delete all records related to a user uid + * @param string $userUid User uid + * @return int + * @throws PropelException + */ + public function removeByUser($userUid) + { + $criteria = new Criteria(); + $criteria->add(OauthAuthorizationCodesPeer::USER_ID, $userUid); + $resultSet = OauthAuthorizationCodesPeer::doDelete($criteria); + return $resultSet; + } } // OauthAuthorizationCodes diff --git a/workflow/engine/classes/model/OauthClients.php b/workflow/engine/classes/model/OauthClients.php index c0fc4e9ef..8e4d2ce69 100644 --- a/workflow/engine/classes/model/OauthClients.php +++ b/workflow/engine/classes/model/OauthClients.php @@ -209,6 +209,19 @@ public function getAll($arrayFilterData = array(), $sortField = "", $sortDir = " return array("numRecTotal" => $numRecTotal, "data" => $arrayData); } + /** + * Delete all records related to a user uid + * @param string $userUid User uid + * @return int + * @throws PropelException + */ + public function removeByUser($userUid) + { + $criteria = new Criteria(); + $criteria->add(OauthClientsPeer::USR_UID, $userUid); + $resultSet = OauthClientsPeer::doDelete($criteria); + return $resultSet; + } } // OauthClients diff --git a/workflow/engine/classes/model/OauthRefreshTokens.php b/workflow/engine/classes/model/OauthRefreshTokens.php index 5d65629be..70c4eb368 100644 --- a/workflow/engine/classes/model/OauthRefreshTokens.php +++ b/workflow/engine/classes/model/OauthRefreshTokens.php @@ -14,6 +14,19 @@ * * @package classes.model */ -class OauthRefreshTokens extends BaseOauthRefreshTokens { - +class OauthRefreshTokens extends BaseOauthRefreshTokens +{ + /** + * Delete all records related to a user uid + * @param string $userUid User uid + * @return int + * @throws PropelException + */ + public function removeByUser($userUid) + { + $criteria = new Criteria(); + $criteria->add(OauthRefreshTokensPeer::USER_ID, $userUid); + $resultSet = OauthRefreshTokensPeer::doDelete($criteria); + return $resultSet; + } } // OauthRefreshTokens diff --git a/workflow/engine/classes/model/OutputDocument.php b/workflow/engine/classes/model/OutputDocument.php index 2b3283ae8..37da4fbf9 100644 --- a/workflow/engine/classes/model/OutputDocument.php +++ b/workflow/engine/classes/model/OutputDocument.php @@ -1,16 +1,7 @@ process((G::is_https() ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . '/files/' . $_SESSION['APPLICATION'] . '/outdocs/' . $sFilename . '.html', $g_media); + $status = $pipeline->process(System::getServerProtocolHost() . '/files/' . $_SESSION['APPLICATION'] . '/outdocs/' . $sFilename . '.html', $g_media); copy(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf', $sPath . $sFilename . '.pdf'); unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.pdf'); unlink(PATH_OUTPUT_FILE_DIRECTORY . $sFilename . '.html'); diff --git a/workflow/engine/classes/model/PmoauthUserAccessTokens.php b/workflow/engine/classes/model/PmoauthUserAccessTokens.php index df28c54e2..e3327b597 100644 --- a/workflow/engine/classes/model/PmoauthUserAccessTokens.php +++ b/workflow/engine/classes/model/PmoauthUserAccessTokens.php @@ -29,4 +29,20 @@ public function getSessionData($token) return (is_array($result) && empty($result)) ? false : $result[0]; } + + /** + * Delete all records related to a user uid + * + * @param string $userUid User uid + * + * @return int + */ + public function removeByUser($userUid) + { + $criteria = new Criteria(); + $criteria->add(PmoauthUserAccessTokensPeer::USER_ID, $userUid); + $resultSet = PmoauthUserAccessTokensPeer::doDelete($criteria); + + return $resultSet; + } } // PmoauthUserAccessTokens diff --git a/workflow/engine/classes/model/Process.php b/workflow/engine/classes/model/Process.php index 7e895d69d..69c59feec 100644 --- a/workflow/engine/classes/model/Process.php +++ b/workflow/engine/classes/model/Process.php @@ -775,11 +775,22 @@ public function getAllProcessesByCategory() return $aProc; } + /** + * Get the trigger configured in committing an action in cases + * + * @param string $proUid + * @param string $action + * + * @return mixed + * + * @see Cases::getExecuteTriggerProcess() + * @link https://wiki.processmaker.com/3.2/Triggers#When_action_cases + */ public function getTriggerWebBotProcess($proUid, $action) { require_once("classes/model/Triggers.php"); - if ((! isset($proUid) && $proUid == '') || (! isset($action) && $action == '')) { + if (empty($proUid) || empty($action)){ return false; } @@ -788,40 +799,41 @@ public function getTriggerWebBotProcess($proUid, $action) switch ($action) { case 'CREATE': - $var = ProcessPeer::PRO_TRI_CREATE; + $columnName = ProcessPeer::PRO_TRI_CREATE; break; case 'OPEN': - $var = ProcessPeer::PRO_TRI_OPEN; + $columnName = ProcessPeer::PRO_TRI_OPEN; break; case 'DELETED': - $var = ProcessPeer::PRO_TRI_DELETED; + $columnName = ProcessPeer::PRO_TRI_DELETED; break; case 'CANCELED': - $var = ProcessPeer::PRO_TRI_CANCELED; + $columnName = ProcessPeer::PRO_TRI_CANCELED; break; case 'PAUSED': - $var = ProcessPeer::PRO_TRI_PAUSED; + $columnName = ProcessPeer::PRO_TRI_PAUSED; break; case 'REASSIGNED': - $var = ProcessPeer::PRO_TRI_REASSIGNED; + $columnName = ProcessPeer::PRO_TRI_REASSIGNED; break; case "UNPAUSE": - $var = ProcessPeer::PRO_TRI_UNPAUSED; + $columnName = ProcessPeer::PRO_TRI_UNPAUSED; break; } - $oCriteria = new Criteria('workflow'); - $oCriteria->addSelectColumn($var); - $oCriteria->addSelectColumn(TriggersPeer::TRI_UID); - $oCriteria->addSelectColumn(TriggersPeer::TRI_WEBBOT); - $oCriteria->addJoin($var, TriggersPeer::TRI_UID, Criteria::LEFT_JOIN); - $oCriteria->add(ProcessPeer::PRO_UID, $proUid); - $oDataSet = ProcessPeer::doSelectRS($oCriteria, Propel::getDbConnection('workflow_ro')); - - $oDataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); - if ($oDataSet->next()) { - $row = $oDataSet->getRow(); - $arrayWebBotTrigger = ['TRI_UID' => $row['TRI_UID'], 'TRI_WEBBOT' => $row['TRI_WEBBOT']]; + $criteria = new Criteria('workflow'); + $criteria->addSelectColumn($columnName); + $criteria->addSelectColumn(TriggersPeer::TRI_UID); + $criteria->addSelectColumn(TriggersPeer::TRI_WEBBOT); + $criteria->addSelectColumn(TriggersPeer::TRI_TITLE); + $criteria->addJoin($columnName, TriggersPeer::TRI_UID, Criteria::LEFT_JOIN); + $criteria->add(ProcessPeer::PRO_UID, $proUid); + $criteria->add($columnName, '', Criteria::NOT_EQUAL); + $dataSet = ProcessPeer::doSelectRS($criteria, Propel::getDbConnection('workflow_ro')); + $dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + if ($dataSet->next()) { + $arrayWebBotTrigger[] = $dataSet->getRow(); } //Return diff --git a/workflow/engine/classes/model/Session.php b/workflow/engine/classes/model/Session.php index 918a47fb8..fa682223a 100644 --- a/workflow/engine/classes/model/Session.php +++ b/workflow/engine/classes/model/Session.php @@ -20,5 +20,18 @@ */ class Session extends BaseSession { + /** + * Delete all records related to a user uid + * @param string $userUid User uid + * @return int + * @throws PropelException + */ + public function removeByUser($userUid) + { + $criteria = new Criteria(); + $criteria->add(SessionPeer::USR_UID, $userUid); + $resultSet = SessionPeer::doDelete($criteria); + return $resultSet; + } } diff --git a/workflow/engine/classes/model/SubApplication.php b/workflow/engine/classes/model/SubApplication.php index 59466a920..175f69e6c 100644 --- a/workflow/engine/classes/model/SubApplication.php +++ b/workflow/engine/classes/model/SubApplication.php @@ -152,5 +152,29 @@ public static function getSubProcessInfo($appUid, $status = 'ACTIVE') return $result; } + + + /** + * Load all cases with the same parent case + * + * @param $appUid + * + * @return array + */ + public function loadByAppUidParent($appUid) + { + $criteria = new Criteria('workflow'); + $criteria->add(SubApplicationPeer::APP_PARENT, $appUid); + $dataSet = SubApplicationPeer::doSelectRS($criteria); + + $dataSet->setFetchmode(ResultSet::FETCHMODE_ASSOC); + + $result = []; + while ($dataSet->next()) { + $result[] = $dataSet->getRow(); + } + + return $result; + } } diff --git a/workflow/engine/classes/model/UsersProperties.php b/workflow/engine/classes/model/UsersProperties.php index b52d021cf..11d2c14ec 100644 --- a/workflow/engine/classes/model/UsersProperties.php +++ b/workflow/engine/classes/model/UsersProperties.php @@ -125,70 +125,144 @@ public function loadOrCreateIfNotExists($sUserUID, $aUserProperty = array()) return $aUserProperty; } - public function validatePassword($sPassword, $sLastUpdate, $iChangePasswordNextTime, $nowLogin = false) + /** + * This function will be validate the password policies + * + * @param string $password + * @param string $lastUpdate + * @param integer $changePassword + * @param boolean $nowLogin + * + * @return array + */ + public function validatePassword($password, $lastUpdate, $changePassword, $nowLogin = false) { - if (! defined('PPP_MINIMUM_LENGTH')) { + if (!defined('PPP_MINIMUM_LENGTH')) { define('PPP_MINIMUM_LENGTH', 5); } - if (! defined('PPP_MAXIMUM_LENGTH')) { + if (!defined('PPP_MAXIMUM_LENGTH')) { define('PPP_MAXIMUM_LENGTH', 20); } - if (! defined('PPP_NUMERICAL_CHARACTER_REQUIRED')) { + if (!defined('PPP_NUMERICAL_CHARACTER_REQUIRED')) { define('PPP_NUMERICAL_CHARACTER_REQUIRED', 0); } - if (! defined('PPP_UPPERCASE_CHARACTER_REQUIRED')) { + if (!defined('PPP_UPPERCASE_CHARACTER_REQUIRED')) { define('PPP_UPPERCASE_CHARACTER_REQUIRED', 0); } - if (! defined('PPP_SPECIAL_CHARACTER_REQUIRED')) { + if (!defined('PPP_SPECIAL_CHARACTER_REQUIRED')) { define('PPP_SPECIAL_CHARACTER_REQUIRED', 0); } - if (! defined('PPP_EXPIRATION_IN')) { + if (!defined('PPP_EXPIRATION_IN')) { define('PPP_EXPIRATION_IN', 0); } - if (function_exists('mb_strlen')) { - $iLength = mb_strlen($sPassword); - } else { - $iLength = strlen($sPassword); - } - $aErrors = array(); - if ($iLength < PPP_MINIMUM_LENGTH || $nowLogin) { - $aErrors[] = 'ID_PPP_MINIMUM_LENGTH'; + $lengthPassword = function_exists('mb_strlen') ? mb_strlen($password): strlen($password); + + $listErrors = []; + //The password has the minimum length + if ($lengthPassword < PPP_MINIMUM_LENGTH || $nowLogin) { + $listErrors[] = 'ID_PPP_MINIMUM_LENGTH'; } - if ($iLength > PPP_MAXIMUM_LENGTH || $nowLogin) { - $aErrors[] = 'ID_PPP_MAXIMUM_LENGTH'; + //The password has the maximum length + if ($lengthPassword > PPP_MAXIMUM_LENGTH || $nowLogin) { + $listErrors[] = 'ID_PPP_MAXIMUM_LENGTH'; } + //The password requires a number if (PPP_NUMERICAL_CHARACTER_REQUIRED == 1) { - if (preg_match_all('/[0-9]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) == 0 || $nowLogin) { - $aErrors[] = 'ID_PPP_NUMERICAL_CHARACTER_REQUIRED'; + if (preg_match_all('/[0-9]/', $password, $aMatch, + PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) == 0 || $nowLogin) { + $listErrors[] = 'ID_PPP_NUMERICAL_CHARACTER_REQUIRED'; } } + //The password requires a upper case if (PPP_UPPERCASE_CHARACTER_REQUIRED == 1) { - if (preg_match_all('/[A-Z]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) == 0 || $nowLogin) { - $aErrors[] = 'ID_PPP_UPPERCASE_CHARACTER_REQUIRED'; + if (preg_match_all('/[A-Z]/', $password, $aMatch, + PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) == 0 || $nowLogin) { + $listErrors[] = 'ID_PPP_UPPERCASE_CHARACTER_REQUIRED'; } } + //The password requires a special character if (PPP_SPECIAL_CHARACTER_REQUIRED == 1) { - if (preg_match_all('/[��\\!|"@�#$~%�&�\/()=\'?��*+\-_.:,;]/', $sPassword, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) == 0 || $nowLogin) { - $aErrors[] = 'ID_PPP_SPECIAL_CHARACTER_REQUIRED'; + if (preg_match_all('/[��\\!|"@�#$~%�&�\/()=\'?��*+\-_.:,;]/', $password, $aMatch, + PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) == 0 || $nowLogin) { + $listErrors[] = 'ID_PPP_SPECIAL_CHARACTER_REQUIRED'; } } + //The configuration PPP_EXPIRATION_IN is saved in hours if (PPP_EXPIRATION_IN > 0) { - $oCalendar = new Calendar(); - - if ($oCalendar->pmCalendarUid == '') { - $oCalendar->pmCalendarUid = '00000000000000000000000000000001'; - $oCalendar->getCalendarData(); + $hoursBetweenDates = (strtotime(date('Y-m-d H:i:s')) - strtotime($lastUpdate)) / (60 * 60); + if ($hoursBetweenDates > PPP_EXPIRATION_IN || $nowLogin) { + $listErrors[] = 'ID_PPP_EXPIRATION_IN'; + $changePassword = 1; } + } + + if ($changePassword == 1) { + $listErrors[] = 'ID_PPP_CHANGE_PASSWORD_AFTER_NEXT_LOGIN'; + } + + return $listErrors; + } - $fDays = $oCalendar->calculateDuration(date('Y-m-d H:i:s'), $sLastUpdate); - if ($fDays > (PPP_EXPIRATION_IN * 24) || $nowLogin) { - $aErrors[] = 'ID_PPP_EXPIRATION_IN'; + /** + * This function will be get the message for show what policies does not complied + * + * @param array $errorsInPassword + * @param boolean $afterFillingPass + * @param boolean $onlyText + * + * @return array + */ + public function getMessageValidatePassword($errorsInPassword, $afterFillingPass = true, $onlyText = false){ + $messPassword = []; + $policyErrors = false; + if ($afterFillingPass) { + $policyMessage = G::LoadTranslation('ID_POLICY_ALERT'); + } else { + $policyMessage = G::LoadTranslation('ID_POLICY_ALERT_INFO'); + } + $policyMessage .= ($onlyText) ? ' ' : '

'; + + foreach ($errorsInPassword as $error) { + switch ($error) { + case 'ID_PPP_CHANGE_PASSWORD_AFTER_NEXT_LOGIN': + //Does not consider a policy for the final user, the administrator request to change password + $messPassword[substr($error, 3)] = PPP_MINIMUM_LENGTH; + break; + case 'ID_PPP_MINIMUM_LENGTH': + $policyErrors = true; + $policyMessage .= '- ' . G::LoadTranslation($error) . ': ' . PPP_MINIMUM_LENGTH; + $policyMessage .= ($onlyText) ? '. ' : '
'; + $messPassword[substr($error, 3)] = PPP_MINIMUM_LENGTH; + $messPassword['PPP_MINIMUN_LENGTH'] = PPP_MINIMUM_LENGTH; + break; + case 'ID_PPP_MAXIMUM_LENGTH': + $policyErrors = true; + $policyMessage .= '- ' . G::LoadTranslation($error) . ': ' . PPP_MAXIMUM_LENGTH; + $policyMessage .= ($onlyText) ? '. ' : '
'; + $messPassword[substr($error, 3)] = PPP_MAXIMUM_LENGTH; + $messPassword['PPP_MAXIMUN_LENGTH'] = PPP_MAXIMUM_LENGTH; + break; + case 'ID_PPP_EXPIRATION_IN': + //Does not consider a policy for the final user, this is enhanced login configuration + $messPassword[substr($error, 3)] = PPP_EXPIRATION_IN; + break; + default: + //PPP_NUMERICAL_CHARACTER_REQUIRED + //PPP_UPPERCASE_CHARACTER_REQUIRED + //PPP_SPECIAL_CHARACTER_REQUIRED + $policyErrors = true; + $policyMessage .= '- ' . G::LoadTranslation($error); + $policyMessage .= ($onlyText) ? '. ' : '
'; + $messPassword[substr($error, 3)] = 1; + break; } } - if ($iChangePasswordNextTime == 1) { - $aErrors[] = 'ID_PPP_CHANGE_PASSWORD_AFTER_NEXT_LOGIN'; + if ($afterFillingPass){ + $policyMessage .= G::LoadTranslation('ID_PLEASE_CHANGE_PASSWORD_POLICY'); } - return $aErrors; + $messPassword['DESCRIPTION'] = ($policyErrors) ? $policyMessage : ''; + + return $messPassword; } /** diff --git a/workflow/engine/config/mobileios.pem b/workflow/engine/config/mobileios.pem index bb56d7bda..6a0728eef 100644 --- a/workflow/engine/config/mobileios.pem +++ b/workflow/engine/config/mobileios.pem @@ -1,111 +1,73 @@ ------BEGIN CERTIFICATE----- -MIIGVTCCBT2gAwIBAgIIC2XzArbAqykwDQYJKoZIhvcNAQELBQAwgZYxCzAJBgNV -BAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSwwKgYDVQQLDCNBcHBsZSBXb3Js -ZHdpZGUgRGV2ZWxvcGVyIFJlbGF0aW9uczFEMEIGA1UEAww7QXBwbGUgV29ybGR3 -aWRlIERldmVsb3BlciBSZWxhdGlvbnMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw -HhcNMTcxMDA0MTM0MzMwWhcNMTgxMTAzMTM0MzMwWjCBqTEtMCsGCgmSJomT8ixk -AQEMHWNvbS5wcm9jZXNzbWFrZXIuUHJvY2Vzc01ha2VyMTswOQYDVQQDDDJBcHBs -ZSBQdXNoIFNlcnZpY2VzOiBjb20ucHJvY2Vzc21ha2VyLlByb2Nlc3NNYWtlcjET -MBEGA1UECwwKOTQyUVA3UUpFOTEZMBcGA1UECgwQUHJvY2Vzc01ha2VyIEluYzEL -MAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDwQgZG -uKp6qEd1Uwgh0qmJLEFlMaIPjxkY+mGjbZyZys73oenLHgPwPukm+64oPdxs7UXl -ZifbWYU4rHbQDEkmOC4GyQU5n9s4zgNtgTqCpab3BuODA/1ffm2OullK1SHmS0cG -Cm8WC93SDa9nmF5xIaiUBbfOsZGcjUKM+MTn/5ETWoZEBUqlf5PKPGZ63/99Q/pj -UxNftY3LTE3o37GYATxFX/sIFtB98vB5hcTdt4zfXHzwisAtqQpkuWIGd5nULX5w -JzlAUjq4werqQhg/k/OAw7kL/JP/PDHpgrbCoO9BZTsAD8H21aZDZR1uDSFSa4H/ -2FeWj286U6Uu10XfAgMBAAGjggKQMIICjDAdBgNVHQ4EFgQUZtV15ABNLGW8Kjjp -yUaQl6f5eRowDAYDVR0TAQH/BAIwADAfBgNVHSMEGDAWgBSIJxcJqbYYYIvs67r2 -R1nFUlSjtzCCARwGA1UdIASCARMwggEPMIIBCwYJKoZIhvdjZAUBMIH9MIHDBggr -BgEFBQcCAjCBtgyBs1JlbGlhbmNlIG9uIHRoaXMgY2VydGlmaWNhdGUgYnkgYW55 -IHBhcnR5IGFzc3VtZXMgYWNjZXB0YW5jZSBvZiB0aGUgdGhlbiBhcHBsaWNhYmxl -IHN0YW5kYXJkIHRlcm1zIGFuZCBjb25kaXRpb25zIG9mIHVzZSwgY2VydGlmaWNh -dGUgcG9saWN5IGFuZCBjZXJ0aWZpY2F0aW9uIHByYWN0aWNlIHN0YXRlbWVudHMu -MDUGCCsGAQUFBwIBFilodHRwOi8vd3d3LmFwcGxlLmNvbS9jZXJ0aWZpY2F0ZWF1 -dGhvcml0eTAwBgNVHR8EKTAnMCWgI6Ahhh9odHRwOi8vY3JsLmFwcGxlLmNvbS93 -d2RyY2EuY3JsMA4GA1UdDwEB/wQEAwIHgDATBgNVHSUEDDAKBggrBgEFBQcDAjAQ -BgoqhkiG92NkBgMBBAIFADAQBgoqhkiG92NkBgMCBAIFADCBoAYKKoZIhvdjZAYD -BgSBkTCBjgwdY29tLnByb2Nlc3NtYWtlci5Qcm9jZXNzTWFrZXIwBQwDYXBwDCJj -b20ucHJvY2Vzc21ha2VyLlByb2Nlc3NNYWtlci52b2lwMAYMBHZvaXAMKmNvbS5w -cm9jZXNzbWFrZXIuUHJvY2Vzc01ha2VyLmNvbXBsaWNhdGlvbjAODAxjb21wbGlj -YXRpb24wDQYJKoZIhvcNAQELBQADggEBADLO70r/cMu7M2A1xNu356IBL4vOtGK7 -nKaAxnjt7aZB+qGTz9xzjH0sHKIefAtlTTSzUzcR/9+gprKt4cdmwgV0zWBpO0UU -7Nu0WreMJKKJ1COO26d8WywvaNdWWHH7+lksZBJFiqFcYvECu3CaMoe77PUqKrWy -R/7MhsHtTsMLz/IMATgMU32NTUs3qKElXjHwTOyE2c+n5VYNoDDMUpx//mbZ5K1B -zA12bA2lg5VLXq4yA9p2Xc2JBg647CXcMQdzPphQ/NZaetcfmE0F01FAF3dfhmmX -jbNoPanngYpPEUVR6kt4MpB/3SeBXgU3HPhBIo7vtfIwI0wT+QlB5bw= ------END CERTIFICATE----- Bag Attributes friendlyName: Apple Push Services: com.processmaker.ProcessMaker - localKeyID: 66 D5 75 E4 00 4D 2C 65 BC 2A 38 E9 C9 46 90 97 A7 F9 79 1A + localKeyID: F1 9A 92 AC CD 22 C3 0B 7A 24 A2 EE 2F 93 87 DD 0E 97 F3 FA subject=/UID=com.processmaker.ProcessMaker/CN=Apple Push Services: com.processmaker.ProcessMaker/OU=942QP7QJE9/O=ProcessMaker Inc/C=US issuer=/C=US/O=Apple Inc./OU=Apple Worldwide Developer Relations/CN=Apple Worldwide Developer Relations Certification Authority -----BEGIN CERTIFICATE----- -MIIGVTCCBT2gAwIBAgIIC2XzArbAqykwDQYJKoZIhvcNAQELBQAwgZYxCzAJBgNV +MIIGVTCCBT2gAwIBAgIIBHXDf7O3LYgwDQYJKoZIhvcNAQELBQAwgZYxCzAJBgNV BAYTAlVTMRMwEQYDVQQKDApBcHBsZSBJbmMuMSwwKgYDVQQLDCNBcHBsZSBXb3Js ZHdpZGUgRGV2ZWxvcGVyIFJlbGF0aW9uczFEMEIGA1UEAww7QXBwbGUgV29ybGR3 aWRlIERldmVsb3BlciBSZWxhdGlvbnMgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkw -HhcNMTcxMDA0MTM0MzMwWhcNMTgxMTAzMTM0MzMwWjCBqTEtMCsGCgmSJomT8ixk +HhcNMTgxMjE4MTcyMzUxWhcNMjAwMTE3MTcyMzUxWjCBqTEtMCsGCgmSJomT8ixk AQEMHWNvbS5wcm9jZXNzbWFrZXIuUHJvY2Vzc01ha2VyMTswOQYDVQQDDDJBcHBs ZSBQdXNoIFNlcnZpY2VzOiBjb20ucHJvY2Vzc21ha2VyLlByb2Nlc3NNYWtlcjET MBEGA1UECwwKOTQyUVA3UUpFOTEZMBcGA1UECgwQUHJvY2Vzc01ha2VyIEluYzEL -MAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDwQgZG -uKp6qEd1Uwgh0qmJLEFlMaIPjxkY+mGjbZyZys73oenLHgPwPukm+64oPdxs7UXl -ZifbWYU4rHbQDEkmOC4GyQU5n9s4zgNtgTqCpab3BuODA/1ffm2OullK1SHmS0cG -Cm8WC93SDa9nmF5xIaiUBbfOsZGcjUKM+MTn/5ETWoZEBUqlf5PKPGZ63/99Q/pj -UxNftY3LTE3o37GYATxFX/sIFtB98vB5hcTdt4zfXHzwisAtqQpkuWIGd5nULX5w -JzlAUjq4werqQhg/k/OAw7kL/JP/PDHpgrbCoO9BZTsAD8H21aZDZR1uDSFSa4H/ -2FeWj286U6Uu10XfAgMBAAGjggKQMIICjDAdBgNVHQ4EFgQUZtV15ABNLGW8Kjjp -yUaQl6f5eRowDAYDVR0TAQH/BAIwADAfBgNVHSMEGDAWgBSIJxcJqbYYYIvs67r2 -R1nFUlSjtzCCARwGA1UdIASCARMwggEPMIIBCwYJKoZIhvdjZAUBMIH9MIHDBggr -BgEFBQcCAjCBtgyBs1JlbGlhbmNlIG9uIHRoaXMgY2VydGlmaWNhdGUgYnkgYW55 -IHBhcnR5IGFzc3VtZXMgYWNjZXB0YW5jZSBvZiB0aGUgdGhlbiBhcHBsaWNhYmxl -IHN0YW5kYXJkIHRlcm1zIGFuZCBjb25kaXRpb25zIG9mIHVzZSwgY2VydGlmaWNh -dGUgcG9saWN5IGFuZCBjZXJ0aWZpY2F0aW9uIHByYWN0aWNlIHN0YXRlbWVudHMu -MDUGCCsGAQUFBwIBFilodHRwOi8vd3d3LmFwcGxlLmNvbS9jZXJ0aWZpY2F0ZWF1 -dGhvcml0eTAwBgNVHR8EKTAnMCWgI6Ahhh9odHRwOi8vY3JsLmFwcGxlLmNvbS93 -d2RyY2EuY3JsMA4GA1UdDwEB/wQEAwIHgDATBgNVHSUEDDAKBggrBgEFBQcDAjAQ +MAkGA1UEBhMCVVMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDTiJTM +ExiPxHCgYAD5MUlKnx0z8lQfk0///r12hi36bbXeGWceaCyGMEgWgryAmkvyCTde +gMqE8h9mlEMnq11vwPu9KRjJufnIeGZjpz5JdF5kD+XQp9S5epYgBodJyuLQsFi+ +1d9sArsgNx0xZX+B2qh+Q+GO8/r+01JxwSmecSG5SQQgZZzeCp6soGIKMtxkt4Rp +WCAkV0pROnLF18EVwlHGaFCwABoTR8q5mkixaekyWeRfyb6WoOVXAA/l9fbxTXKr +/4yRV6Gw7Jtu5vmULSqVlfXWTbhNf27hE/sYQmdW124j6uT6UvYF+DPen1PwOore +TaKxqjHbpNvPc6OJAgMBAAGjggKQMIICjDAMBgNVHRMBAf8EAjAAMB8GA1UdIwQY +MBaAFIgnFwmpthhgi+zruvZHWcVSVKO3MIIBHAYDVR0gBIIBEzCCAQ8wggELBgkq +hkiG92NkBQEwgf0wgcMGCCsGAQUFBwICMIG2DIGzUmVsaWFuY2Ugb24gdGhpcyBj +ZXJ0aWZpY2F0ZSBieSBhbnkgcGFydHkgYXNzdW1lcyBhY2NlcHRhbmNlIG9mIHRo +ZSB0aGVuIGFwcGxpY2FibGUgc3RhbmRhcmQgdGVybXMgYW5kIGNvbmRpdGlvbnMg +b2YgdXNlLCBjZXJ0aWZpY2F0ZSBwb2xpY3kgYW5kIGNlcnRpZmljYXRpb24gcHJh +Y3RpY2Ugc3RhdGVtZW50cy4wNQYIKwYBBQUHAgEWKWh0dHA6Ly93d3cuYXBwbGUu +Y29tL2NlcnRpZmljYXRlYXV0aG9yaXR5MBMGA1UdJQQMMAoGCCsGAQUFBwMCMDAG +A1UdHwQpMCcwJaAjoCGGH2h0dHA6Ly9jcmwuYXBwbGUuY29tL3d3ZHJjYS5jcmww +HQYDVR0OBBYEFPGakqzNIsMLeiSi7i+Th90Ol/P6MA4GA1UdDwEB/wQEAwIHgDAQ BgoqhkiG92NkBgMBBAIFADAQBgoqhkiG92NkBgMCBAIFADCBoAYKKoZIhvdjZAYD BgSBkTCBjgwdY29tLnByb2Nlc3NtYWtlci5Qcm9jZXNzTWFrZXIwBQwDYXBwDCJj b20ucHJvY2Vzc21ha2VyLlByb2Nlc3NNYWtlci52b2lwMAYMBHZvaXAMKmNvbS5w cm9jZXNzbWFrZXIuUHJvY2Vzc01ha2VyLmNvbXBsaWNhdGlvbjAODAxjb21wbGlj -YXRpb24wDQYJKoZIhvcNAQELBQADggEBADLO70r/cMu7M2A1xNu356IBL4vOtGK7 -nKaAxnjt7aZB+qGTz9xzjH0sHKIefAtlTTSzUzcR/9+gprKt4cdmwgV0zWBpO0UU -7Nu0WreMJKKJ1COO26d8WywvaNdWWHH7+lksZBJFiqFcYvECu3CaMoe77PUqKrWy -R/7MhsHtTsMLz/IMATgMU32NTUs3qKElXjHwTOyE2c+n5VYNoDDMUpx//mbZ5K1B -zA12bA2lg5VLXq4yA9p2Xc2JBg647CXcMQdzPphQ/NZaetcfmE0F01FAF3dfhmmX -jbNoPanngYpPEUVR6kt4MpB/3SeBXgU3HPhBIo7vtfIwI0wT+QlB5bw= +YXRpb24wDQYJKoZIhvcNAQELBQADggEBAHeOD1oHNW5cRUSq52dIpzBxp/9QnK4M +v9YeNempdjI9ajo3gHzA2iJHpy5+JWTkxuE7iUdTP4KfjL/vYPIJvCdESv+o7wre +SfLMlarSx5X+AmCDsQLMVyb3aoiNA4qE16OIpu+UTs7Np90xtL4bsgLLf0wwVLSF +x74NKKEQLgrhjfThnmZ8a4u7CiVhXSGPosqaXyT43WXKyWreDnCW1Pzm+sfSlD43 +yCKglvGJeDvfWb1RfEJpqNWp7duAb/HiD2oIWrdtN+6XYEucQEuRrKfj2XOHS1+r +rmsU8hWBHhGgMYectSe4nXBOCtyOzDTaYIs+TVCt+xnxCq5ItUaxSQo= -----END CERTIFICATE----- Bag Attributes - friendlyName: ProcessMaker Prod Key - localKeyID: 66 D5 75 E4 00 4D 2C 65 BC 2A 38 E9 C9 46 90 97 A7 F9 79 1A + friendlyName: Mauricio Veliz + localKeyID: F1 9A 92 AC CD 22 C3 0B 7A 24 A2 EE 2F 93 87 DD 0E 97 F3 FA Key Attributes: ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,6D70077A389A3A8C - -bziMWwK5LMeP0dIM2wHeO6juXqzmtH/U9FW5GAZuJEKt0zYAyv1DmEJFfyMMZmob -4j+LfvfdZVium6cIEkC+JMPFwW0dSRQNgA6I44E2AT73MTQr6u7pZi/QiQ09CJCQ -JjFJ2Q08ZgHQXrJMy62PeHO+uWOQW6YuI5aNC/K+AdvIwNyzlCj/HNWcf7IeSaeE -urH5/dL1cVSfpeBXMsqfYSAcfTZOXgAb8BRwngi+RSGNQ6SawEl53vm94gDSH3Mi -3tzCsDcw0Gw5Wu1d/755Zzakl48LOqxLzptbOr5QbJK5BeGhE0y3Db+rYNpG3fzw -I3YdZTMhkzaigG4xp/BLyLL2tgGzSIGg8BARMHF/GkXcdKBJyQrweXMkhhoeYxr2 -dzWurOd0Bkw3DJXONE9uPNQb/i33TYmflQMhWJFlHkKhkHlIgAu5cIzTwRNbHCF7 -aRKiHz5uL+/WufgVlw62JZp9JZ1mPsmJINba4BAT9i9zkUnPvxYN/GB5Z2Ttz1nj -ylyGiAtdAZ7l05OWd7I9gEUTce8dsojThIun3QQ1UFCRJUmg38Dp/XxMzWP5IpTb -E2McM90jyN+M8gII2KU6U5uqTXDiMMFiXFa9WlTc4xIkHNQLINDASBgUQr7pIqth -UTvU4YoST6wma9BNYAuGX9ga6uEg94kmVXrUEBZWI13T56bSpw4cyvzSJvNwcH8m -nClVXMIrysoGgQ1Gxs6G2xWTduXysK5E26bY6Gypk9VPMUyo6oVENnY3EQs3Cj/R -W2vyz1t05xPonPxmun2mFTQQvgSbbkfUbuL02tBQXxkWNoo5rCAVuRMFlVjFzIEF -qZ3uiU8ui5Nj1Tc5SAosuoTu53vLp4ynn9A5WVmLXdE1DucCXTumN8teISF69cUU -XYVy2Ch39LxUGumWTSVZNDJBJgSFtiNxCmpwS4jQsNRF9piK/T+t3INSXRcRB9mF -f3DYOrjor6TTu0hEppZosIUfoo7EDgplfMK5x9ZjL8JWSWEqA2U2JoRbe9ucMkGy -wbFTsbyg9NNSdF1jEZUEKWKr7dT3ShPHhut/F9HOi5KvbMAgUf0HnYgUsCTYhZru -UbVf8cWnfYPyVUW3Doa12/uSpqwrHzOduexb1LzO0mukdfyR7UhY/rRv5w4KkTXJ -+zlNncWiSZQiDJq053i8UYhDj0U7+YzmpxE/BUU5HwMcZ8wtl0MDac66Z1YXkqgs -bO2dK71tNQ1D5msmDDP+Cw0W4wLdRiJn8FNF5oBl2QYMyTyclduhrlCMp8VgnMmT -mDrygATrWoaToSiR+Mc6D7rOLyHt+29HMtFx1Lgs3jpgzLQ4nBWBtLN5uxkxTclH -W35sMR2eDYiM7nEO9TJSBlC8lkFiGsv4xYYK8gLEZ2h7OMPrO/9L9CmHk/v3Ts8I -wSt0FiVZNP4JEL0NZ5nSZMnDT0R47CuFkEgf271Um4lNPPRV7mPA0fWkKXt59FeK -LoBZYkGes/QliAUWdY44tVKgg6oIM6IqubsO92Hru5o36Px7ucVoqiNHnSy1lo/v -KAfvW9/40XJ+z1JUTYwreaLoO+Wlk0Irkvv4Fro0KTA8rXDNFm/JL2gkgknEae4i ------END RSA PRIVATE KEY----- +-----BEGIN PRIVATE KEY----- +MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDTiJTMExiPxHCg +YAD5MUlKnx0z8lQfk0///r12hi36bbXeGWceaCyGMEgWgryAmkvyCTdegMqE8h9m +lEMnq11vwPu9KRjJufnIeGZjpz5JdF5kD+XQp9S5epYgBodJyuLQsFi+1d9sArsg +Nx0xZX+B2qh+Q+GO8/r+01JxwSmecSG5SQQgZZzeCp6soGIKMtxkt4RpWCAkV0pR +OnLF18EVwlHGaFCwABoTR8q5mkixaekyWeRfyb6WoOVXAA/l9fbxTXKr/4yRV6Gw +7Jtu5vmULSqVlfXWTbhNf27hE/sYQmdW124j6uT6UvYF+DPen1PwOoreTaKxqjHb +pNvPc6OJAgMBAAECggEAfYWZjjNyqrUNhA0T5sr5S795S77rbkUy/pxB/xgGJol9 +lwqJ50A303TJAhqYEtP8ZuZTJc/U3Ojz+yHVa6/DZTIl74x4ehPShcP0NgQi8OGN +tWC9pYBBucJlXSGinAY5a06JisxMpMJGGgq6Vvp8nCiNPUe4i+R5N0dcr8XIlYxG +FU+r6rGqmcRGxPp8yQfh5fP1P+9xyjZt1WuUuvF4Y5dTeVmR0z/dZQqlrC0Q5hAD +kAfimf31ViPYaNwhxHTG53aC8GMbRJqTeM/MW3bZ+dVRcW8Yk2Ym/mbDY3cQvi0V +sGOVDHaoJNa8pfQNZ+y+tvJPRYIdbmPG2pGcJeuqAQKBgQDtQiZ8/V4DBmboZyBt +60Rnafue1bSfQssxoOuNtlRosOW28piCfNRftYhCKT3ylKbPVY02ekNisUIJYaZI +8ipCGNGdZD2oOitWVYDDq+A9O28JinsJc5i9ffQQ6dK+Krw5k7Bo4DzytwhJlwXa +8YxvntN7PlzM68wncKL+1jnwSQKBgQDkPjilC/4UiXnGmhFeu6oZ6dz0V7yjdoP0 +ApdHVsOvCyIIl34vBy4Du4iZ/xXzwd+ZwOsTHXf8iU1Ayig5WFNDsr+HRItvNRg+ +FxOSiqLnclJYsJMNtGN7SnlTKyGWGpxzCydaeOq1Yapq8VkcFL9gtZYt911prD0u +THx2vRKZQQKBgF3ZwOfIQZvouGROBuH0IobVwZa+6kflYAMtqH/SE+mlr/iCVhmn +z0pcwJ2LOtnuO13gdY+LJYSwoXKcke5g/J5QuvoLYOheui3YfKrqHjWagP3BLZI7 +i7vJSvY1yAs5VGNiLHIP4YwRItIZT1OgIPE2Xmlt7b+RtpwTTiaIDzshAoGBAMmN +TJYq9e8Ky5eem/ItBHQnuW+oPrOWx8VluFNOAjWEPkSaCtramz6+j012HduIe70Z +yDy0DC3czXSGUGj7X2Pr6Ag6dmr41vSVijog5OQ/Zwpcuy8h+at5Q5Q3BUy5KSjK +U7EoEBOmMEiJ4ifTBoEPOZRT2ZCkgc5tyodMRa1BAoGAKE39g4yX+H+/kXtXqe7d +/lCBWbPTLGxo43HROjcftXvsZi+voYDlDQVfD6d3Ew8rLMWYfZ4hVYtWR4AeE0My +7aeW6JX2hD6kANFOlOCOUApZeL2X9SiCUyXQWb5M+oSmS63IWK9eHamBNqzpY6HU +V2ajfnwBPcbydtbtUcv7D7k= +-----END PRIVATE KEY----- \ No newline at end of file diff --git a/workflow/engine/config/schema.xml b/workflow/engine/config/schema.xml index 74d40bc8e..2419ba032 100644 --- a/workflow/engine/config/schema.xml +++ b/workflow/engine/config/schema.xml @@ -589,6 +589,9 @@ + + + diff --git a/workflow/engine/content/translations/english/processmaker.en.po b/workflow/engine/content/translations/english/processmaker.en.po index 8c58d0a38..8f6edb9b1 100644 --- a/workflow/engine/content/translations/english/processmaker.en.po +++ b/workflow/engine/content/translations/english/processmaker.en.po @@ -1,8 +1,8 @@ msgid "" msgstr "" -"Project-Id-Version: ProcessMaker (Branch 3.2.3)\n" +"Project-Id-Version: ProcessMaker (Branch 3.3.1)\n" "POT-Creation-Date: \n" -"PO-Revision-Date: 2018-02-19 20:22:41\n" +"PO-Revision-Date: 2018-10-23 16:48:05\n" "Last-Translator: \n" "Language-Team: Colosa Developers Team \n" "MIME-Version: 1.0\n" @@ -3863,6 +3863,12 @@ msgstr "Case Tracker Properties Saved Successfully" msgid "The case {APP_NUMBER} was reactivated successfully!" msgstr "The case {APP_NUMBER} was reactivated successfully!" +# TRANSLATION +# LABEL/ID_CASE_RESPONSE_NOT_AVAILABLE +#: LABEL/ID_CASE_RESPONSE_NOT_AVAILABLE +msgid "No response available, please review the case information" +msgstr "No response available, please review the case information" + # TRANSLATION # LABEL/ID_CASE_ROUTED_TO #: LABEL/ID_CASE_ROUTED_TO @@ -8585,36 +8591,6 @@ msgstr "Full Text Search" msgid "@function() It evaluates the value, then executes a PHP function" msgstr "@function() It evaluates the value, then executes a PHP function" -# TRANSLATION -# LABEL/ID_G_SUITE_CONFIGURATION_SAVED -#: LABEL/ID_G_SUITE_CONFIGURATION_SAVED -msgid "G Suite Configuration Saved" -msgstr "G Suite Configuration Saved" - -# TRANSLATION -# LABEL/ID_G_SUITE_CONNECT -#: LABEL/ID_G_SUITE_CONNECT -msgid "Request G Suite connection" -msgstr "Request G Suite connection" - -# TRANSLATION -# LABEL/ID_G_SUITE_DISCONNECT -#: LABEL/ID_G_SUITE_DISCONNECT -msgid "Disconnect G Suite" -msgstr "Disconnect G Suite" - -# TRANSLATION -# LABEL/ID_G_SUITE_LOAD_GROUPS -#: LABEL/ID_G_SUITE_LOAD_GROUPS -msgid "Update G Suite groups" -msgstr "Update G Suite groups" - -# TRANSLATION -# LABEL/ID_G_SUITE_SYNC_USERS -#: LABEL/ID_G_SUITE_SYNC_USERS -msgid "Syncing Users" -msgstr "Syncing Users" - # TRANSLATION # LABEL/ID_GENERAL #: LABEL/ID_GENERAL @@ -8975,6 +8951,12 @@ msgstr "No skins to display" msgid "No users to display" msgstr "No users to display" +# TRANSLATION +# LABEL/ID_GRID_VARIABLE_NAME_ERROR +#: LABEL/ID_GRID_VARIABLE_NAME_ERROR +msgid "A valid variable starts with a letter or underscore, followed by any number of letters, numbers, or underscores. Variables with wrong names: {0}" +msgstr "A valid variable starts with a letter or underscore, followed by any number of letters, numbers, or underscores. Variables with wrong names: {0}" + # TRANSLATION # LABEL/ID_GRID_WIZARD #: LABEL/ID_GRID_WIZARD @@ -9101,6 +9083,36 @@ msgstr "The user with {0}: {1} is already assigned to the group." msgid "The user with {0}: {1} is not assigned to the group." msgstr "The user with {0}: {1} is not assigned to the group." +# TRANSLATION +# LABEL/ID_G_SUITE_CONFIGURATION_SAVED +#: LABEL/ID_G_SUITE_CONFIGURATION_SAVED +msgid "G Suite Configuration Saved" +msgstr "G Suite Configuration Saved" + +# TRANSLATION +# LABEL/ID_G_SUITE_CONNECT +#: LABEL/ID_G_SUITE_CONNECT +msgid "Request G Suite connection" +msgstr "Request G Suite connection" + +# TRANSLATION +# LABEL/ID_G_SUITE_DISCONNECT +#: LABEL/ID_G_SUITE_DISCONNECT +msgid "Disconnect G Suite" +msgstr "Disconnect G Suite" + +# TRANSLATION +# LABEL/ID_G_SUITE_LOAD_GROUPS +#: LABEL/ID_G_SUITE_LOAD_GROUPS +msgid "Update G Suite groups" +msgstr "Update G Suite groups" + +# TRANSLATION +# LABEL/ID_G_SUITE_SYNC_USERS +#: LABEL/ID_G_SUITE_SYNC_USERS +msgid "Syncing Users" +msgstr "Syncing Users" + # TRANSLATION # LABEL/ID_HAS_BEEN_DELETED #: LABEL/ID_HAS_BEEN_DELETED @@ -9983,18 +9995,6 @@ msgstr "Intermediate Message Events (Task Notifications)" msgid "[LABEL/ID_INTERMEDIATE_MESSAGE_EVENTS] Intermediate Message Events (Task Notifications)" msgstr "Intermediate Message Events (Task Notifications)" -# TRANSLATION -# LABEL/ID_INTERMEDIATE_TIMER_EVENT -#: LABEL/ID_INTERMEDIATE_TIMER_EVENT -msgid "Intermediate Timer Event (Multiple Event)" -msgstr "Intermediate Timer Event (Multiple Event)" - -# TRANSLATION -# LABEL/ID_INTERMEDIATE_TIMER_EVENTS -#: LABEL/ID_INTERMEDIATE_TIMER_EVENTS -msgid "[LABEL/ID_INTERMEDIATE_TIMER_EVENTS] Intermediate Timer Event (Multiple Event)" -msgstr "Intermediate Timer Event (Multiple Event)" - # TRANSLATION # LABEL/ID_INTERMEDIATE_THROW_EMAIL_EVENT #: LABEL/ID_INTERMEDIATE_THROW_EMAIL_EVENT @@ -10007,6 +10007,18 @@ msgstr "Untitled - Intermediate Email Event" msgid "Untitled - Intermediate Receive Message Event" msgstr "Untitled - Intermediate Receive Message Event" +# TRANSLATION +# LABEL/ID_INTERMEDIATE_TIMER_EVENT +#: LABEL/ID_INTERMEDIATE_TIMER_EVENT +msgid "Intermediate Timer Event (Multiple Event)" +msgstr "Intermediate Timer Event (Multiple Event)" + +# TRANSLATION +# LABEL/ID_INTERMEDIATE_TIMER_EVENTS +#: LABEL/ID_INTERMEDIATE_TIMER_EVENTS +msgid "[LABEL/ID_INTERMEDIATE_TIMER_EVENTS] Intermediate Timer Event (Multiple Event)" +msgstr "Intermediate Timer Event (Multiple Event)" + # TRANSLATION # LABEL/ID_INTERNATIONAL #: LABEL/ID_INTERNATIONAL @@ -10703,6 +10715,12 @@ msgstr "The specified subform could not be found in the process." msgid "Database connection edited successfully" msgstr "Database connection edited successfully" +# TRANSLATION +# LABEL/ID_MAFE_004d33be4d12eb8c0ae00703e7c70f61 +#: LABEL/ID_MAFE_004d33be4d12eb8c0ae00703e7c70f61 +msgid "Pick Second" +msgstr "Pick Second" + # TRANSLATION # LABEL/ID_MAFE_004fa281c757ed0c2ed3ca2b19dc26f4 #: LABEL/ID_MAFE_004fa281c757ed0c2ed3ca2b19dc26f4 @@ -10733,6 +10751,12 @@ msgstr "Invalid flow between elements. Please delete the flow and reconnect the msgid "[LABEL/ID_MAFE_014bd6f385cb5aec29ec9714b8106ccb] Search ..." msgstr "Search ..." +# TRANSLATION +# LABEL/ID_MAFE_018987001347cd85be2f30fcaac4ec7f +#: LABEL/ID_MAFE_018987001347cd85be2f30fcaac4ec7f +msgid "Reassign my cases" +msgstr "Reassign my cases" + # TRANSLATION # LABEL/ID_MAFE_01bc6f8efa4202821e95f4fdf6298b30 #: LABEL/ID_MAFE_01bc6f8efa4202821e95f4fdf6298b30 @@ -10776,10 +10800,10 @@ msgid "The key and label must be supplied." msgstr "The key and label must be supplied." # TRANSLATION -# LABEL/ID_MAFE_035f4e29da2d6d31303f7d7cfa1be13b -#: LABEL/ID_MAFE_035f4e29da2d6d31303f7d7cfa1be13b -msgid "Subtitle" -msgstr "Subtitle" +# LABEL/ID_MAFE_033db172e7506126611760711854d755 +#: LABEL/ID_MAFE_033db172e7506126611760711854d755 +msgid "Next Month" +msgstr "Next Month" # TRANSLATION # LABEL/ID_MAFE_03727ac48595a24daed975559c944a44 @@ -10871,12 +10895,6 @@ msgstr "Terminate" msgid "
  • YYYY MM DD >> \"Valid date\"
  • " msgstr "
  • YYYY MM DD >> \"Valid date\"
  • " -# TRANSLATION -# LABEL/ID_MAFE_05ac967e9cc3b518f931564827ffe738 -#: LABEL/ID_MAFE_05ac967e9cc3b518f931564827ffe738 -msgid "Checkgroup" -msgstr "Checkgroup" - # TRANSLATION # LABEL/ID_MAFE_0610123bdd4ffc191a3ea05a847e1307 #: LABEL/ID_MAFE_0610123bdd4ffc191a3ea05a847e1307 @@ -10931,6 +10949,12 @@ msgstr "Receive Message" msgid "Wait for" msgstr "Wait for" +# TRANSLATION +# LABEL/ID_MAFE_07463a98d573b3749d9230c9c02c38d0 +#: LABEL/ID_MAFE_07463a98d573b3749d9230c9c02c38d0 +msgid "Accepted Values is an empty string" +msgstr "Accepted Values is an empty string" + # TRANSLATION # LABEL/ID_MAFE_07501edbc1f9fd2f7d0f0d71712b11cf #: LABEL/ID_MAFE_07501edbc1f9fd2f7d0f0d71712b11cf @@ -11309,12 +11333,6 @@ msgstr "Prev" msgid "Send Message" msgstr "Send Message" -# TRANSLATION -# LABEL/ID_MAFE_1522e792d4751e5bbc85ce386da71da9 -#: LABEL/ID_MAFE_1522e792d4751e5bbc85ce386da71da9 -msgid "Qr Code" -msgstr "Qr Code" - # TRANSLATION # LABEL/ID_MAFE_157b53019e903b82b3b34209dbb26b21 #: LABEL/ID_MAFE_157b53019e903b82b3b34209dbb26b21 @@ -11363,6 +11381,12 @@ msgstr "Task properties saved successfully" msgid "Third" msgstr "Third" +# TRANSLATION +# LABEL/ID_MAFE_16e4992123f5046ce89c07829efc9ac2 +#: LABEL/ID_MAFE_16e4992123f5046ce89c07829efc9ac2 +msgid "Decrement Hour" +msgstr "Decrement Hour" + # TRANSLATION # LABEL/ID_MAFE_16f49c0f891dce505db0ffe478aff96f #: LABEL/ID_MAFE_16f49c0f891dce505db0ffe478aff96f @@ -11573,6 +11597,12 @@ msgstr "Do you want to delete this lang?" msgid "sum" msgstr "sum" +# TRANSLATION +# LABEL/ID_MAFE_1d6785e8bc575506eb7ee226614a6d18 +#: LABEL/ID_MAFE_1d6785e8bc575506eb7ee226614a6d18 +msgid "Allowed file extensions:" +msgstr "Allowed file extensions:" + # TRANSLATION # LABEL/ID_MAFE_1dccefa9aa4b700675ca17101bccd7d3 #: LABEL/ID_MAFE_1dccefa9aa4b700675ca17101bccd7d3 @@ -11603,12 +11633,6 @@ msgstr "Require user login" msgid "datasource" msgstr "datasource" -# TRANSLATION -# LABEL/ID_MAFE_1f32d2c1b49b9b0c9d99bd10da107e41 -#: LABEL/ID_MAFE_1f32d2c1b49b9b0c9d99bd10da107e41 -msgid "Radio" -msgstr "Radio" - # TRANSLATION # LABEL/ID_MAFE_1f5a44e6621dc51b6daca35844ba8311 #: LABEL/ID_MAFE_1f5a44e6621dc51b6daca35844ba8311 @@ -11807,6 +11831,12 @@ msgstr "TEMPLATES" msgid "Required field error message" msgstr "Required field error message" +# TRANSLATION +# LABEL/ID_MAFE_25d7912714632dcc5283517e20ead1f1 +#: LABEL/ID_MAFE_25d7912714632dcc5283517e20ead1f1 +msgid "Next Decade" +msgstr "Next Decade" + # TRANSLATION # LABEL/ID_MAFE_25d902c24283ab8cfbac54dfa101ad31 #: LABEL/ID_MAFE_25d902c24283ab8cfbac54dfa101ad31 @@ -12197,12 +12227,6 @@ msgstr "SQL Editor" msgid "- Select -" msgstr "- Select -" -# TRANSLATION -# LABEL/ID_MAFE_34e2d1989a1dbf75cd631596133ee5ee -#: LABEL/ID_MAFE_34e2d1989a1dbf75cd631596133ee5ee -msgid "Video" -msgstr "Video" - # TRANSLATION # LABEL/ID_MAFE_353279c7161c0a9425743a96a9b709ef #: LABEL/ID_MAFE_353279c7161c0a9425743a96a9b709ef @@ -12251,12 +12275,6 @@ msgstr "There are problems updating the routing rule, please try again." msgid "Panel:" msgstr "Panel:" -# TRANSLATION -# LABEL/ID_MAFE_380e3a2b4db75629a3b9bf6bfcf0fa10 -#: LABEL/ID_MAFE_380e3a2b4db75629a3b9bf6bfcf0fa10 -msgid "History Of Use" -msgstr "History Of Use" - # TRANSLATION # LABEL/ID_MAFE_380e92305f89798cc7ff7db6e73b22c6 #: LABEL/ID_MAFE_380e92305f89798cc7ff7db6e73b22c6 @@ -12359,6 +12377,12 @@ msgstr "Enable Grid Lines" msgid "Media" msgstr "Media" +# TRANSLATION +# LABEL/ID_MAFE_3bb055cd21140e7c1b17eeeace227bdb +#: LABEL/ID_MAFE_3bb055cd21140e7c1b17eeeace227bdb +msgid "Select Year" +msgstr "Select Year" + # TRANSLATION # LABEL/ID_MAFE_3c8a58a423ed96c806664b1d4e803e2c #: LABEL/ID_MAFE_3c8a58a423ed96c806664b1d4e803e2c @@ -12437,12 +12461,6 @@ msgstr "Insert an email variable" msgid "Output Document saved successfully" msgstr "Output Document saved successfully" -# TRANSLATION -# LABEL/ID_MAFE_3e20abeb08058faefc326fd8ebf81c97 -#: LABEL/ID_MAFE_3e20abeb08058faefc326fd8ebf81c97 -msgid "Subform" -msgstr "Subform" - # TRANSLATION # LABEL/ID_MAFE_3e661ccd1bd840f47829d2e6dbb5e651 #: LABEL/ID_MAFE_3e661ccd1bd840f47829d2e6dbb5e651 @@ -12461,6 +12479,12 @@ msgstr "responsive" msgid "[LABEL/ID_MAFE_3e8f92eb64623f0ecd16d2efcd0acd7e] Report Tables" msgstr "Report Tables" +# TRANSLATION +# LABEL/ID_MAFE_3edcc5150c225068c9ae501ffe62ceb9 +#: LABEL/ID_MAFE_3edcc5150c225068c9ae501ffe62ceb9 +msgid "Increment Second" +msgstr "Increment Second" + # TRANSLATION # LABEL/ID_MAFE_3edf8ca26a1ec14dd6e91dd277ae1de6 #: LABEL/ID_MAFE_3edf8ca26a1ec14dd6e91dd277ae1de6 @@ -12653,6 +12677,18 @@ msgstr "suggest" msgid "[LABEL/ID_MAFE_44749712dbec183e983dcd78a7736c41] Date" msgstr "Date" +# TRANSLATION +# LABEL/ID_MAFE_4498e6305304230bc7f2600f5d1b1d84 +#: LABEL/ID_MAFE_4498e6305304230bc7f2600f5d1b1d84 +msgid "Mail (PHP)" +msgstr "Mail (PHP)" + +# TRANSLATION +# LABEL/ID_MAFE_449c6d9f5ba15789700b2c8ea380e3fa +#: LABEL/ID_MAFE_449c6d9f5ba15789700b2c8ea380e3fa +msgid "Untitled label" +msgstr "Untitled label" + # TRANSLATION # LABEL/ID_MAFE_44fdec47036f482b68b748f9d786801b #: LABEL/ID_MAFE_44fdec47036f482b68b748f9d786801b @@ -12684,10 +12720,10 @@ msgid "Assign Users and Groups as Supervisors" msgstr "Assign Users and Groups as Supervisors" # TRANSLATION -# LABEL/ID_MAFE_473f81670bcdd9d92624698f43d6a517 -#: LABEL/ID_MAFE_473f81670bcdd9d92624698f43d6a517 -msgid "Empty." -msgstr "Empty." +# LABEL/ID_MAFE_47a23c652a2e04c0963f15326ebef11a +#: LABEL/ID_MAFE_47a23c652a2e04c0963f15326ebef11a +msgid "Go to today" +msgstr "Go to today" # TRANSLATION # LABEL/ID_MAFE_47b5269b1f60dcd4d18f0cc5f17a7c21 @@ -12821,6 +12857,12 @@ msgstr "Script Task" msgid "The row can not be removed, because is being edited." msgstr "The row can not be removed, because is being edited." +# TRANSLATION +# LABEL/ID_MAFE_4b441851f94a139dc89c37f6c03be611 +#: LABEL/ID_MAFE_4b441851f94a139dc89c37f6c03be611 +msgid "Pick Minute" +msgstr "Pick Minute" + # TRANSLATION # LABEL/ID_MAFE_4b7c4e2a902673b967b1d63f9a4bed74 #: LABEL/ID_MAFE_4b7c4e2a902673b967b1d63f9a4bed74 @@ -12881,6 +12923,18 @@ msgstr "Method" msgid "[LABEL/ID_MAFE_4c524bf462d270df1443cd80bf70e5de] Input Document" msgstr "Input Document" +# TRANSLATION +# LABEL/ID_MAFE_4d0c42523f93e7ce5f25230010a3aa00 +#: LABEL/ID_MAFE_4d0c42523f93e7ce5f25230010a3aa00 +msgid "The parameter maxlength is not a number" +msgstr "The parameter maxlength is not a number" + +# TRANSLATION +# LABEL/ID_MAFE_4d287ea3f5618dc027b8de8bba546ef0 +#: LABEL/ID_MAFE_4d287ea3f5618dc027b8de8bba546ef0 +msgid "Close the picker" +msgstr "Close the picker" + # TRANSLATION # LABEL/ID_MAFE_4d34f1097f6c8b9cee28bca8b78bbee9 #: LABEL/ID_MAFE_4d34f1097f6c8b9cee28bca8b78bbee9 @@ -12917,12 +12971,6 @@ msgstr "Create variable" msgid "Document Type" msgstr "Document Type" -# TRANSLATION -# LABEL/ID_MAFE_4f8222964f9a317cef99dddc23a121bd -#: LABEL/ID_MAFE_4f8222964f9a317cef99dddc23a121bd -msgid "Checkbox" -msgstr "Checkbox" - # TRANSLATION # LABEL/ID_MAFE_4f92f36c19f0ad317fb71d493a18caac #: LABEL/ID_MAFE_4f92f36c19f0ad317fb71d493a18caac @@ -13457,6 +13505,12 @@ msgstr "External Step" msgid "In the design area you can drop the process elements and order or arrange them to design your process." msgstr "In the design area you can drop the process elements and order or arrange them to design your process." +# TRANSLATION +# LABEL/ID_MAFE_635f2145a06da2d4ce2c355bf94da6ed +#: LABEL/ID_MAFE_635f2145a06da2d4ce2c355bf94da6ed +msgid "Previous Year" +msgstr "Previous Year" + # TRANSLATION # LABEL/ID_MAFE_6384750fb02541d64a749b1a9296a43f #: LABEL/ID_MAFE_6384750fb02541d64a749b1a9296a43f @@ -13745,6 +13799,12 @@ msgstr "New variables created" msgid "Weekly" msgstr "Weekly" +# TRANSLATION +# LABEL/ID_MAFE_6cae1a8108be3aec1aa792644c69c190 +#: LABEL/ID_MAFE_6cae1a8108be3aec1aa792644c69c190 +msgid "Information Required" +msgstr "Information Required" + # TRANSLATION # LABEL/ID_MAFE_6cb85fb9933f1990eaa1dc7619c84233 #: LABEL/ID_MAFE_6cb85fb9933f1990eaa1dc7619c84233 @@ -13757,12 +13817,6 @@ msgstr "Data Store" msgid "Apr" msgstr "Apr" -# TRANSLATION -# LABEL/ID_MAFE_6e139990d75202b4688849d505e9f659 -#: LABEL/ID_MAFE_6e139990d75202b4688849d505e9f659 -msgid "Current form." -msgstr "Current form." - # TRANSLATION # LABEL/ID_MAFE_6e51ca3efb50c3fa4e7eb7fb75cba556 #: LABEL/ID_MAFE_6e51ca3efb50c3fa4e7eb7fb75cba556 @@ -13853,6 +13907,12 @@ msgstr "DynaForm" msgid "View groups" msgstr "View groups" +# TRANSLATION +# LABEL/ID_MAFE_714b68ca17408b57ef4b48b30f390dcd +#: LABEL/ID_MAFE_714b68ca17408b57ef4b48b30f390dcd +msgid "Pick Hour" +msgstr "Pick Hour" + # TRANSLATION # LABEL/ID_MAFE_716de874a0d74f25c0aa8c444c3a7539 #: LABEL/ID_MAFE_716de874a0d74f25c0aa8c444c3a7539 @@ -13895,6 +13955,12 @@ msgstr "Properties saved successfully" msgid "Error Update File" msgstr "Error Update File" +# TRANSLATION +# LABEL/ID_MAFE_7215ee9c7d9dc229d2921a40e899ec5f +#: LABEL/ID_MAFE_7215ee9c7d9dc229d2921a40e899ec5f +msgid "[LABEL/ID_MAFE_7215ee9c7d9dc229d2921a40e899ec5f] " +msgstr "" + # TRANSLATION # LABEL/ID_MAFE_725255d7ccc0cf426c1da6abe0afe7e4 #: LABEL/ID_MAFE_725255d7ccc0cf426c1da6abe0afe7e4 @@ -13925,6 +13991,12 @@ msgstr "An unexpected error while assigning the trigger, please try again later. msgid "Output Document" msgstr "Output Document" +# TRANSLATION +# LABEL/ID_MAFE_736fda6b62eaca111776a53611ef2c92 +#: LABEL/ID_MAFE_736fda6b62eaca111776a53611ef2c92 +msgid "Increment Minute" +msgstr "Increment Minute" + # TRANSLATION # LABEL/ID_MAFE_73c146408e22128ca6a56f748ad0da66 #: LABEL/ID_MAFE_73c146408e22128ca6a56f748ad0da66 @@ -13955,12 +14027,6 @@ msgstr "month" msgid "YES" msgstr "YES" -# TRANSLATION -# LABEL/ID_MAFE_7498c445a737312f3678aa1494e01a38 -#: LABEL/ID_MAFE_7498c445a737312f3678aa1494e01a38 -msgid "Dropdown" -msgstr "Dropdown" - # TRANSLATION # LABEL/ID_MAFE_755c1cdb25ce0b28166932338fc860d8 #: LABEL/ID_MAFE_755c1cdb25ce0b28166932338fc860d8 @@ -14117,12 +14183,6 @@ msgstr "File name is invalid" msgid "Black Box Pool" msgstr "Black Box Pool" -# TRANSLATION -# LABEL/ID_MAFE_7acdf85c69cc3c5305456a293524386e -#: LABEL/ID_MAFE_7acdf85c69cc3c5305456a293524386e -msgid "Hidden" -msgstr "Hidden" - # TRANSLATION # LABEL/ID_MAFE_7aed506b0364be3a144ccb63ceb7b704 #: LABEL/ID_MAFE_7aed506b0364be3a144ccb63ceb7b704 @@ -14195,6 +14255,12 @@ msgstr "Sub-Process name" msgid "Create Database Connection" msgstr "Create Database Connection" +# TRANSLATION +# LABEL/ID_MAFE_7d73db163473796198dec30144f711e3 +#: LABEL/ID_MAFE_7d73db163473796198dec30144f711e3 +msgid "Next Century" +msgstr "Next Century" + # TRANSLATION # LABEL/ID_MAFE_7dce122004969d56ae2e0245cb754d35 #: LABEL/ID_MAFE_7dce122004969d56ae2e0245cb754d35 @@ -14213,12 +14279,6 @@ msgstr "Templates" msgid "external libs" msgstr "external libs" -# TRANSLATION -# LABEL/ID_MAFE_7e78595cdd80192f888e0599c8dd06ca -#: LABEL/ID_MAFE_7e78595cdd80192f888e0599c8dd06ca -msgid "Geomap" -msgstr "Geomap" - # TRANSLATION # LABEL/ID_MAFE_7e823b37564da492ca1629b4732289a8 #: LABEL/ID_MAFE_7e823b37564da492ca1629b4732289a8 @@ -14297,6 +14357,12 @@ msgstr "There are problems updating the Case Tracker, please try again." msgid "Please configure cron to wait for time event." msgstr "Please configure cron to wait for time event." +# TRANSLATION +# LABEL/ID_MAFE_80ffff123555bd5173345bc8f144edeb +#: LABEL/ID_MAFE_80ffff123555bd5173345bc8f144edeb +msgid "Clear selection" +msgstr "Clear selection" + # TRANSLATION # LABEL/ID_MAFE_812a48ba719daeda82e4da8e812d426c #: LABEL/ID_MAFE_812a48ba719daeda82e4da8e812d426c @@ -14369,6 +14435,12 @@ msgstr "Enable versioning" msgid "[LABEL/ID_MAFE_825689fed4e8cd85dbc5beedf98feec0] Database Name" msgstr "Database Name" +# TRANSLATION +# LABEL/ID_MAFE_8265a4157a2febe0b6faa43345c61652 +#: LABEL/ID_MAFE_8265a4157a2febe0b6faa43345c61652 +msgid "Next Year" +msgstr "Next Year" + # TRANSLATION # LABEL/ID_MAFE_8292553558a75e672bc62e5a84244c82 #: LABEL/ID_MAFE_8292553558a75e672bc62e5a84244c82 @@ -14423,6 +14495,12 @@ msgstr "Smartphone" msgid "Validate Now" msgstr "Validate Now" +# TRANSLATION +# LABEL/ID_MAFE_85a2bbe801286ff44a6c4b1a4a4e9bc9 +#: LABEL/ID_MAFE_85a2bbe801286ff44a6c4b1a4a4e9bc9 +msgid "Select Decade" +msgstr "Select Decade" + # TRANSLATION # LABEL/ID_MAFE_85cc96b9ef52490be95df14539d47a39 #: LABEL/ID_MAFE_85cc96b9ef52490be95df14539d47a39 @@ -14453,6 +14531,12 @@ msgstr "Select Origin Process" msgid "There are problems updating the Email Event, please try again." msgstr "There are problems updating the Email Event, please try again." +# TRANSLATION +# LABEL/ID_MAFE_86a32f8032467f8a54055fc4d429f2e8 +#: LABEL/ID_MAFE_86a32f8032467f8a54055fc4d429f2e8 +msgid "Increment Hour" +msgstr "Increment Hour" + # TRANSLATION # LABEL/ID_MAFE_86f5978d9b80124f509bdb71786e929e #: LABEL/ID_MAFE_86f5978d9b80124f509bdb71786e929e @@ -14477,12 +14561,6 @@ msgstr "End" msgid "Email Message" msgstr "Email Message" -# TRANSLATION -# LABEL/ID_MAFE_87b7760f14fbff78d8819291f36ab9a0 -#: LABEL/ID_MAFE_87b7760f14fbff78d8819291f36ab9a0 -msgid "[LABEL/ID_MAFE_87b7760f14fbff78d8819291f36ab9a0] Button" -msgstr "Button" - # TRANSLATION # LABEL/ID_MAFE_87d17f4624a514e81dc7c8e016a7405c #: LABEL/ID_MAFE_87d17f4624a514e81dc7c8e016a7405c @@ -14549,6 +14627,12 @@ msgstr "Database connection deleted successfully" msgid "Copy Trigger" msgstr "Copy Trigger" +# TRANSLATION +# LABEL/ID_MAFE_89d0fdd0f8b1b6f918815729a338cd50 +#: LABEL/ID_MAFE_89d0fdd0f8b1b6f918815729a338cd50 +msgid "Select Month" +msgstr "Select Month" + # TRANSLATION # LABEL/ID_MAFE_89d626523f83c2d1f8a5549a845dd6aa #: LABEL/ID_MAFE_89d626523f83c2d1f8a5549a845dd6aa @@ -14633,12 +14717,6 @@ msgstr "of" msgid "To learn more about regular expressions, see the wiki.

    " msgstr "To learn more about regular expressions, see the wiki.

    " -# TRANSLATION -# LABEL/ID_MAFE_8c09001c99ecb6fdd8d6023fcf039054 -#: LABEL/ID_MAFE_8c09001c99ecb6fdd8d6023fcf039054 -msgid "Signature" -msgstr "Signature" - # TRANSLATION # LABEL/ID_MAFE_8c38e95ae34b84df395afebaff1ffb21 #: LABEL/ID_MAFE_8c38e95ae34b84df395afebaff1ffb21 @@ -14711,12 +14789,6 @@ msgstr "extra formats" msgid "Variable deleted successfully" msgstr "Variable deleted successfully" -# TRANSLATION -# LABEL/ID_MAFE_8ed7724f13ef6d80145fe7291f0b37eb -#: LABEL/ID_MAFE_8ed7724f13ef6d80145fe7291f0b37eb -msgid "Mobile Controls" -msgstr "Mobile Controls" - # TRANSLATION # LABEL/ID_MAFE_8f0996dac68d535131ecd654a0345a75 #: LABEL/ID_MAFE_8f0996dac68d535131ecd654a0345a75 @@ -14741,12 +14813,6 @@ msgstr "modify" msgid "Delay" msgstr "Delay" -# TRANSLATION -# LABEL/ID_MAFE_8f72759a8a4c1e446eed395d1adc3d1c -#: LABEL/ID_MAFE_8f72759a8a4c1e446eed395d1adc3d1c -msgid "- Select an email account -" -msgstr "- Select an email account -" - # TRANSLATION # LABEL/ID_MAFE_8f7afecbc8fbc4cd0f50a57d1172482e #: LABEL/ID_MAFE_8f7afecbc8fbc4cd0f50a57d1172482e @@ -15029,6 +15095,12 @@ msgstr "Html Editor" msgid "[LABEL/ID_MAFE_9639e32cab248434a17ab32237cb3b71] Apply" msgstr "Apply" +# TRANSLATION +# LABEL/ID_MAFE_96baacdc276036c2b8fb65264750a3b4 +#: LABEL/ID_MAFE_96baacdc276036c2b8fb65264750a3b4 +msgid "Choose Files" +msgstr "Choose Files" + # TRANSLATION # LABEL/ID_MAFE_9766aede44e9d1b176b4fbb0367b9853 #: LABEL/ID_MAFE_9766aede44e9d1b176b4fbb0367b9853 @@ -15107,6 +15179,12 @@ msgstr "Screenshot640" msgid "The input document is required, please select the value." msgstr "The input document is required, please select the value." +# TRANSLATION +# LABEL/ID_MAFE_99567b953da8beace4e3e7296bf1fc23 +#: LABEL/ID_MAFE_99567b953da8beace4e3e7296bf1fc23 +msgid "Assign type" +msgstr "Assign type" + # TRANSLATION # LABEL/ID_MAFE_99b2439e63f73ad515f7ab2447a80673 #: LABEL/ID_MAFE_99b2439e63f73ad515f7ab2447a80673 @@ -15257,6 +15335,12 @@ msgstr "Condition" msgid "Output Document deleted successfully" msgstr "Output Document deleted successfully" +# TRANSLATION +# LABEL/ID_MAFE_9ed8ac8a23206c93a3602884788be7fa +#: LABEL/ID_MAFE_9ed8ac8a23206c93a3602884788be7fa +msgid "Previous Month" +msgstr "Previous Month" + # TRANSLATION # LABEL/ID_MAFE_9f1658da12738ea1b34318bd8258181b #: LABEL/ID_MAFE_9f1658da12738ea1b34318bd8258181b @@ -15323,12 +15407,6 @@ msgstr "Datetime" msgid "An integer or decimal number" msgstr "An integer or decimal number" -# TRANSLATION -# LABEL/ID_MAFE_a1d80becb5b8402bd8a4236920c12e87 -#: LABEL/ID_MAFE_a1d80becb5b8402bd8a4236920c12e87 -msgid "Suggest" -msgstr "Suggest" - # TRANSLATION # LABEL/ID_MAFE_a1fa27779242b4902f7ae3bdd5c6d508 #: LABEL/ID_MAFE_a1fa27779242b4902f7ae3bdd5c6d508 @@ -15341,6 +15419,12 @@ msgstr "Type" msgid "Select the mode of the control:
    " msgstr "Select the mode of the control:
    " +# TRANSLATION +# LABEL/ID_MAFE_a22b8023226bc5caac2e1dd0d5a15c5b +#: LABEL/ID_MAFE_a22b8023226bc5caac2e1dd0d5a15c5b +msgid "The maximum length are" +msgstr "The maximum length are" + # TRANSLATION # LABEL/ID_MAFE_a2609d846e9af22fcc3412a8c99510a5 #: LABEL/ID_MAFE_a2609d846e9af22fcc3412a8c99510a5 @@ -15419,12 +15503,6 @@ msgstr "For a better design we recommend using values above 3.
    If you need mo msgid "File updated successfully" msgstr "File updated successfully" -# TRANSLATION -# LABEL/ID_MAFE_a4d3b161ce1309df1c4e25df28694b7b -#: LABEL/ID_MAFE_a4d3b161ce1309df1c4e25df28694b7b -msgid "Submit" -msgstr "Submit" - # TRANSLATION # LABEL/ID_MAFE_a4ecfc70574394990cf17bd83df499f7 #: LABEL/ID_MAFE_a4ecfc70574394990cf17bd83df499f7 @@ -15443,12 +15521,6 @@ msgstr "Top" msgid "Select a Skin." msgstr "Select a Skin." -# TRANSLATION -# LABEL/ID_MAFE_a54b4b8fb14402ba55f5a10cf818090a -#: LABEL/ID_MAFE_a54b4b8fb14402ba55f5a10cf818090a -msgid "Are you sure you want to delete this file" -msgstr "Are you sure you want to delete this file" - # TRANSLATION # LABEL/ID_MAFE_a5a299eb1993f98a6b58401ee62b66a0 #: LABEL/ID_MAFE_a5a299eb1993f98a6b58401ee62b66a0 @@ -15467,6 +15539,12 @@ msgstr "setOrientation(): parameter is not valid" msgid "audio" msgstr "audio" +# TRANSLATION +# LABEL/ID_MAFE_a5d4e481e66121a71151435c2c0e68f6 +#: LABEL/ID_MAFE_a5d4e481e66121a71151435c2c0e68f6 +msgid "Decrement Second" +msgstr "Decrement Second" + # TRANSLATION # LABEL/ID_MAFE_a603905470e2a5b8c13e96b579ef0dba #: LABEL/ID_MAFE_a603905470e2a5b8c13e96b579ef0dba @@ -15485,6 +15563,12 @@ msgstr "Ok" msgid "Notify the assigned user to this task" msgstr "Notify the assigned user to this task" +# TRANSLATION +# LABEL/ID_MAFE_a6122a65eaa676f700ae68d393054a37 +#: LABEL/ID_MAFE_a6122a65eaa676f700ae68d393054a37 +msgid "Start" +msgstr "Start" + # TRANSLATION # LABEL/ID_MAFE_a6527af0da63377b07a3effae750a485 #: LABEL/ID_MAFE_a6527af0da63377b07a3effae750a485 @@ -15497,6 +15581,12 @@ msgstr "
    Triggers: Create scripts." msgid "Input Document deleted successfully" msgstr "Input Document deleted successfully" +# TRANSLATION +# LABEL/ID_MAFE_a6ca4597da3795aed1b1fa92f0e8d9a6 +#: LABEL/ID_MAFE_a6ca4597da3795aed1b1fa92f0e8d9a6 +msgid "Previous Decade" +msgstr "Previous Decade" + # TRANSLATION # LABEL/ID_MAFE_a6ce2340cef46384d71cb790606e9c67 #: LABEL/ID_MAFE_a6ce2340cef46384d71cb790606e9c67 @@ -15671,12 +15761,6 @@ msgstr "required" msgid "forms" msgstr "forms" -# TRANSLATION -# LABEL/ID_MAFE_acd6337dfeb8a29685e3856bfa76756c -#: LABEL/ID_MAFE_acd6337dfeb8a29685e3856bfa76756c -msgid "History of use" -msgstr "History of use" - # TRANSLATION # LABEL/ID_MAFE_ad7bdeed2bf3d72e17abe1a8d0508958 #: LABEL/ID_MAFE_ad7bdeed2bf3d72e17abe1a8d0508958 @@ -15791,12 +15875,6 @@ msgstr "print dynaform" msgid "[LABEL/ID_MAFE_b206a1b4ea1097761f78e8876f6da779] External" msgstr "External" -# TRANSLATION -# LABEL/ID_MAFE_b22f0418e8ac915eb66f829d262d14a2 -#: LABEL/ID_MAFE_b22f0418e8ac915eb66f829d262d14a2 -msgid "Audio" -msgstr "Audio" - # TRANSLATION # LABEL/ID_MAFE_b243a6cb94ba1c81a0caa579227ab48c #: LABEL/ID_MAFE_b243a6cb94ba1c81a0caa579227ab48c @@ -15839,6 +15917,12 @@ msgstr "initial selection date" msgid "Trigger is assigned." msgstr "Trigger is assigned." +# TRANSLATION +# LABEL/ID_MAFE_b4c7ae206140c5179619b952c3b672ef +#: LABEL/ID_MAFE_b4c7ae206140c5179619b952c3b672ef +msgid "Invalid value for the integer field" +msgstr "Invalid value for the integer field" + # TRANSLATION # LABEL/ID_MAFE_b4e7d2116bb1534c687d16bdc104ddfe #: LABEL/ID_MAFE_b4e7d2116bb1534c687d16bdc104ddfe @@ -15911,12 +15995,6 @@ msgstr "Description" msgid "subform" msgstr "subform" -# TRANSLATION -# LABEL/ID_MAFE_b5d4d25fe3fa9f8263b5f279a372b709 -#: LABEL/ID_MAFE_b5d4d25fe3fa9f8263b5f279a372b709 -msgid "Textarea" -msgstr "Textarea" - # TRANSLATION # LABEL/ID_MAFE_b5d909fa36b2d67d91e6607c7f23cd92 #: LABEL/ID_MAFE_b5d909fa36b2d67d91e6607c7f23cd92 @@ -15965,12 +16043,6 @@ msgstr "Do you want to close? All your changes will be lost if you close it." msgid "[LABEL/ID_MAFE_b74a43dbb36287ea86eb5b0c7b86e8e8] Evaluation" msgstr "Evaluation" -# TRANSLATION -# LABEL/ID_MAFE_b754d64a4ddb13e5eb9803baabb938b6 -#: LABEL/ID_MAFE_b754d64a4ddb13e5eb9803baabb938b6 -msgid "This content is empty." -msgstr "This content is empty." - # TRANSLATION # LABEL/ID_MAFE_b776b96aded5145322e09111013ef8c5 #: LABEL/ID_MAFE_b776b96aded5145322e09111013ef8c5 @@ -15995,6 +16067,12 @@ msgstr "Title" msgid "Please enter a numeric value" msgstr "Please enter a numeric value" +# TRANSLATION +# LABEL/ID_MAFE_b7c2aaa55124be654f3f09361d6e0f62 +#: LABEL/ID_MAFE_b7c2aaa55124be654f3f09361d6e0f62 +msgid "Decrement Minute" +msgstr "Decrement Minute" + # TRANSLATION # LABEL/ID_MAFE_b7de7e4247d4ab279ef031b7a44c201d #: LABEL/ID_MAFE_b7de7e4247d4ab279ef031b7a44c201d @@ -16037,12 +16115,6 @@ msgstr "Webbot" msgid "
  • View: Allow user to only view the control's value.
  • " msgstr "
  • View: Allow user to only view the control's value.
  • " -# TRANSLATION -# LABEL/ID_MAFE_b8da6df14bf06283cbf588df6998722e -#: LABEL/ID_MAFE_b8da6df14bf06283cbf588df6998722e -msgid "Panel" -msgstr "Panel" - # TRANSLATION # LABEL/ID_MAFE_b9925a331df6b1464182bdd6cbb2807c #: LABEL/ID_MAFE_b9925a331df6b1464182bdd6cbb2807c @@ -16139,12 +16211,6 @@ msgstr "Event" msgid "A7" msgstr "A7" -# TRANSLATION -# LABEL/ID_MAFE_be53a0541a6d36f6ecb879fa2c584b08 -#: LABEL/ID_MAFE_be53a0541a6d36f6ecb879fa2c584b08 -msgid "[LABEL/ID_MAFE_be53a0541a6d36f6ecb879fa2c584b08] Image" -msgstr "Image" - # TRANSLATION # LABEL/ID_MAFE_bebfb2a099450ef06ded421e59c888b2 #: LABEL/ID_MAFE_bebfb2a099450ef06ded421e59c888b2 @@ -16253,6 +16319,12 @@ msgstr "Friday" msgid "Message Field Name" msgstr "Message Field Name" +# TRANSLATION +# LABEL/ID_MAFE_c3ff20c4d95f758bb6e0e5dcfda8ad4f +#: LABEL/ID_MAFE_c3ff20c4d95f758bb6e0e5dcfda8ad4f +msgid "Invalid value for the float field" +msgstr "Invalid value for the float field" + # TRANSLATION # LABEL/ID_MAFE_c40b29699c408c2934c6b87e776965db #: LABEL/ID_MAFE_c40b29699c408c2934c6b87e776965db @@ -16319,6 +16391,12 @@ msgstr "Invalid Connection between elements" msgid "Invalid operation: Delete message flow before converting it to" msgstr "Invalid operation: Delete message flow before converting it to" +# TRANSLATION +# LABEL/ID_MAFE_c5e54f7804fa817826dfa5ecc13cd92f +#: LABEL/ID_MAFE_c5e54f7804fa817826dfa5ecc13cd92f +msgid "Last User Name" +msgstr "Last User Name" + # TRANSLATION # LABEL/ID_MAFE_c5f93fd19468533ea5c9114801c2958d #: LABEL/ID_MAFE_c5f93fd19468533ea5c9114801c2958d @@ -16391,6 +16469,12 @@ msgstr "Steps for task" msgid "Multiple Steps" msgstr "Multiple Steps" +# TRANSLATION +# LABEL/ID_MAFE_c75f7811d70d17dbcd88e9d03752cbed +#: LABEL/ID_MAFE_c75f7811d70d17dbcd88e9d03752cbed +msgid "[LABEL/ID_MAFE_c75f7811d70d17dbcd88e9d03752cbed] Authentication" +msgstr "Authentication" + # TRANSLATION # LABEL/ID_MAFE_c7892ebbb139886662c6f2fc8c450710 #: LABEL/ID_MAFE_c7892ebbb139886662c6f2fc8c450710 @@ -16613,18 +16697,6 @@ msgstr "Custom Trigger" msgid "[LABEL/ID_MAFE_ce50a09343724eb82df11390e2c1de18] button" msgstr "button" -# TRANSLATION -# LABEL/ID_MAFE_ce5f8a0a2fea8e45ddfd3fe51ae60703 -#: LABEL/ID_MAFE_ce5f8a0a2fea8e45ddfd3fe51ae60703 -msgid "Fileupload" -msgstr "Fileupload" - -# TRANSLATION -# LABEL/ID_MAFE_ceacb93de81fd75fc4d78446523a451f -#: LABEL/ID_MAFE_ceacb93de81fd75fc4d78446523a451f -msgid "Textbox" -msgstr "Textbox" - # TRANSLATION # LABEL/ID_MAFE_cec5d779d280ccc9c11ba492353a3a02 #: LABEL/ID_MAFE_cec5d779d280ccc9c11ba492353a3a02 @@ -16679,6 +16751,12 @@ msgstr "Pending Task / Not Executed" msgid "parent" msgstr "parent" +# TRANSLATION +# LABEL/ID_MAFE_d1376c0b3248b39302f2ac2fa87de4b8 +#: LABEL/ID_MAFE_d1376c0b3248b39302f2ac2fa87de4b8 +msgid "Default date is out of range." +msgstr "Default date is out of range." + # TRANSLATION # LABEL/ID_MAFE_d14f18dc87737c53160abb29b9da643c #: LABEL/ID_MAFE_d14f18dc87737c53160abb29b9da643c @@ -16949,12 +17027,6 @@ msgstr "Define accepted variable values" msgid "[LABEL/ID_MAFE_dc30bc0c7914db5918da4263fce93ad2] Clear" msgstr "Clear" -# TRANSLATION -# LABEL/ID_MAFE_dc3fd488f03d423a04da27ce66274c1b -#: LABEL/ID_MAFE_dc3fd488f03d423a04da27ce66274c1b -msgid "Warning!" -msgstr "Warning!" - # TRANSLATION # LABEL/ID_MAFE_dc45332742bde79337287a115c6422a4 #: LABEL/ID_MAFE_dc45332742bde79337287a115c6422a4 @@ -17177,6 +17249,12 @@ msgstr "Select a Control" msgid "Please configure script to wait for a signal." msgstr "Please configure script to wait for a signal." +# TRANSLATION +# LABEL/ID_MAFE_e2ac1703ae8a4bb8b146f7337a7e4cab +#: LABEL/ID_MAFE_e2ac1703ae8a4bb8b146f7337a7e4cab +msgid "Last User" +msgstr "Last User" + # TRANSLATION # LABEL/ID_MAFE_e2b9d6eb9f3ec7d4e6089274a4481fab #: LABEL/ID_MAFE_e2b9d6eb9f3ec7d4e6089274a4481fab @@ -17237,6 +17315,12 @@ msgstr "Units" msgid "Start Event" msgstr "Start Event" +# TRANSLATION +# LABEL/ID_MAFE_e635032a5f71d809146d3872389f5b0c +#: LABEL/ID_MAFE_e635032a5f71d809146d3872389f5b0c +msgid "Choose File" +msgstr "Choose File" + # TRANSLATION # LABEL/ID_MAFE_e659b52eba1f0299b2d8ca3483919e72 #: LABEL/ID_MAFE_e659b52eba1f0299b2d8ca3483919e72 @@ -17651,6 +17735,12 @@ msgstr "Assignment" msgid "EXCLUSIVE" msgstr "EXCLUSIVE" +# TRANSLATION +# LABEL/ID_MAFE_f45fabda0c6a595f709b3996398132f5 +#: LABEL/ID_MAFE_f45fabda0c6a595f709b3996398132f5 +msgid "Diverging gateways expect to receive only one incoming flow." +msgstr "Diverging gateways expect to receive only one incoming flow." + # TRANSLATION # LABEL/ID_MAFE_f4636507ca93332f92f92fb219a43b02 #: LABEL/ID_MAFE_f4636507ca93332f92f92fb219a43b02 @@ -17741,12 +17831,30 @@ msgstr "The process was saved successfully." msgid "Do you want to delete all routing rules?" msgstr "Do you want to delete all routing rules?" +# TRANSLATION +# LABEL/ID_MAFE_f727eb287649c090519308749775c175 +#: LABEL/ID_MAFE_f727eb287649c090519308749775c175 +msgid "Previous Century" +msgstr "Previous Century" + # TRANSLATION # LABEL/ID_MAFE_f7531e2d0ea27233ce00b5f01c5bf335 #: LABEL/ID_MAFE_f7531e2d0ea27233ce00b5f01c5bf335 msgid "print" msgstr "print" +# TRANSLATION +# LABEL/ID_MAFE_f75963d32a20c9b16e02169b667aa569 +#: LABEL/ID_MAFE_f75963d32a20c9b16e02169b667aa569 +msgid "Callback Action" +msgstr "Callback Action" + +# TRANSLATION +# LABEL/ID_MAFE_f77415a724d143456212940f13767f42 +#: LABEL/ID_MAFE_f77415a724d143456212940f13767f42 +msgid "The file size exceeds the limit. Max allowed limit is:" +msgstr "The file size exceeds the limit. Max allowed limit is:" + # TRANSLATION # LABEL/ID_MAFE_f775fa07e143b2e671946a48af8f42ca #: LABEL/ID_MAFE_f775fa07e143b2e671946a48af8f42ca @@ -17963,24 +18071,30 @@ msgstr "Edit Label" msgid "Every" msgstr "Every" -# TRANSLATION -# LABEL/ID_MAFE_TRANSLATION_DIRECTORY -#: LABEL/ID_MAFE_TRANSLATION_DIRECTORY -msgid "Mafe Translation Directory" -msgstr "Mafe Translation Directory" - -# TRANSLATION -# LABEL/ID_MAFE_TRANSLATION_NOT_WRITEABLE -#: LABEL/ID_MAFE_TRANSLATION_NOT_WRITEABLE -msgid "The mafe translation file is not writable.
    Please give write permission to file:" -msgstr "The mafe translation file is not writable.
    Please give write permission to file:" - # TRANSLATION # LABEL/ID_MAIL_SENT_SUCCESSFULLY #: LABEL/ID_MAIL_SENT_SUCCESSFULLY msgid "Your message has been sent successfully" msgstr "Your message has been sent successfully" +# TRANSLATION +# LABEL/ID_MAIL_STATUS_ERROR +#: LABEL/ID_MAIL_STATUS_ERROR +msgid "[LABEL/ID_MAIL_STATUS_ERROR] Error" +msgstr "Error" + +# TRANSLATION +# LABEL/ID_MAIL_STATUS_PENDING +#: LABEL/ID_MAIL_STATUS_PENDING +msgid "Pending" +msgstr "Pending" + +# TRANSLATION +# LABEL/ID_MAIL_STATUS_SENT +#: LABEL/ID_MAIL_STATUS_SENT +msgid "[LABEL/ID_MAIL_STATUS_SENT] Sent" +msgstr "Sent" + # TRANSLATION # LABEL/ID_MAIL_TEST_SUCCESS #: LABEL/ID_MAIL_TEST_SUCCESS @@ -18278,7 +18392,7 @@ msgstr "The Variable Name with {0}: \"{1}\" already exists." # TRANSLATION # LABEL/ID_MESS_ENGINE_TYPE_1 #: LABEL/ID_MESS_ENGINE_TYPE_1 -msgid "Mail (PHP)" +msgid "[LABEL/ID_MESS_ENGINE_TYPE_1] Mail (PHP)" msgstr "Mail (PHP)" # TRANSLATION @@ -20210,7 +20324,7 @@ msgstr "Pausing Case" # TRANSLATION # LABEL/ID_PENDING #: LABEL/ID_PENDING -msgid "Pending" +msgid "[LABEL/ID_PENDING] Pending" msgstr "Pending" # TRANSLATION @@ -20705,6 +20819,12 @@ msgstr "File \"{0}\" imported but with errors:" msgid "The following fields cannot be created because they contain the reserved words \"{0}\"" msgstr "The following fields cannot be created because they contain the reserved words \"{0}\"" +# TRANSLATION +# LABEL/ID_PMTABLE_INVALID_FIELD_NAME_VARIABLE +#: LABEL/ID_PMTABLE_INVALID_FIELD_NAME_VARIABLE +msgid "There is a conflict with some field names: \"{0}\", please rename them avoiding the use of numbers and considering that underscores are ignored when validating unique field names." +msgstr "There is a conflict with some field names: \"{0}\", please rename them avoiding the use of numbers and considering that underscores are ignored when validating unique field names." + # TRANSLATION # LABEL/ID_PMTABLE_INVALID_FILE #: LABEL/ID_PMTABLE_INVALID_FILE @@ -20840,8 +20960,14 @@ msgstr "PM Table" # TRANSLATION # LABEL/ID_POLICY_ALERT #: LABEL/ID_POLICY_ALERT -msgid "Your password does not meet the following password policies" -msgstr "Your password does not meet the following password policies" +msgid "Your password does not meet the following password policies:" +msgstr "Your password does not meet the following password policies:" + +# TRANSLATION +# LABEL/ID_POLICY_ALERT_INFO +#: LABEL/ID_POLICY_ALERT_INFO +msgid "Your password must meet the following policies:" +msgstr "Your password must meet the following policies:" # TRANSLATION # LABEL/ID_PORT @@ -20876,8 +21002,8 @@ msgstr "The posted data is empty!" # TRANSLATION # LABEL/ID_PPP_CHANGE_PASSWORD_AFTER_NEXT_LOGIN #: LABEL/ID_PPP_CHANGE_PASSWORD_AFTER_NEXT_LOGIN -msgid "User must change his/her password after next login" -msgstr "User must change his/her password after next login" +msgid "Your previous password has expired, please enter a new password" +msgstr "Your previous password has expired, please enter a new password" # TRANSLATION # LABEL/ID_PPP_EXPIRATION_IN @@ -20960,7 +21086,7 @@ msgstr "Previous" # TRANSLATION # LABEL/ID_PREVIOUS_MONTH #: LABEL/ID_PREVIOUS_MONTH -msgid "Previous Month" +msgid "[LABEL/ID_PREVIOUS_MONTH] Previous Month" msgstr "Previous Month" # TRANSLATION @@ -20984,7 +21110,7 @@ msgstr "Previous Week" # TRANSLATION # LABEL/ID_PREVIOUS_YEAR #: LABEL/ID_PREVIOUS_YEAR -msgid "Previous Year" +msgid "[LABEL/ID_PREVIOUS_YEAR] Previous Year" msgstr "Previous Year" # TRANSLATION @@ -21968,7 +22094,7 @@ msgstr "Do you want to reassign the case?" # TRANSLATION # LABEL/ID_REASSIGN_MY_CASES #: LABEL/ID_REASSIGN_MY_CASES -msgid "Reassign my cases" +msgid "[LABEL/ID_REASSIGN_MY_CASES] Reassign my cases" msgstr "Reassign my cases" # TRANSLATION @@ -24761,18 +24887,48 @@ msgstr "Error: The application {0} is not canceled." msgid "The default configuration was not defined" msgstr "The default configuration was not defined" +# TRANSLATION +# LABEL/ID_THE_FILE_SIZE_IS_BIGGER_THAN_THE_MAXIMUM_ALLOWED +#: LABEL/ID_THE_FILE_SIZE_IS_BIGGER_THAN_THE_MAXIMUM_ALLOWED +msgid "The file size is bigger than the maximum allowed, the maximum size allowed is {0} Mbytes." +msgstr "The file size is bigger than the maximum allowed, the maximum size allowed is {0} Mbytes." + +# TRANSLATION +# LABEL/ID_THE_MAXIMUM_VALUE_OF_THIS_FIELD_IS +#: LABEL/ID_THE_MAXIMUM_VALUE_OF_THIS_FIELD_IS +msgid "The maximum value of this field is {0}." +msgstr "The maximum value of this field is {0}." + +# TRANSLATION +# LABEL/ID_THE_MIMETYPE_EXTENSION_ERROR +#: LABEL/ID_THE_MIMETYPE_EXTENSION_ERROR +msgid "The mime type does not correspond to the permitted extension, please verify your file." +msgstr "The mime type does not correspond to the permitted extension, please verify your file." + # TRANSLATION # LABEL/ID_THE_NAME_CHANGE_MAY_CAUSE_DATA_LOSS #: LABEL/ID_THE_NAME_CHANGE_MAY_CAUSE_DATA_LOSS msgid "The change might cause data loss in the PM table. Do you want to continue?" msgstr "The change might cause data loss in the PM table. Do you want to continue?" +# TRANSLATION +# LABEL/ID_THE_PHP_FILES_EXECUTION_WAS_DISABLED +#: LABEL/ID_THE_PHP_FILES_EXECUTION_WAS_DISABLED +msgid "The PHP files execution was disabled please contact the system administrator." +msgstr "The PHP files execution was disabled please contact the system administrator." + # TRANSLATION # LABEL/ID_THE_REASON_REASSIGN_USER_EMPTY #: LABEL/ID_THE_REASON_REASSIGN_USER_EMPTY msgid "Please complete the reassign reason." msgstr "Please complete the reassign reason." +# TRANSLATION +# LABEL/ID_THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED +#: LABEL/ID_THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED +msgid "The upload of PHP files was disabled please contact the system administrator." +msgstr "The upload of PHP files was disabled please contact the system administrator." + # TRANSLATION # LABEL/ID_THE_USERNAME_EMAIL_IS_INCORRECT #: LABEL/ID_THE_USERNAME_EMAIL_IS_INCORRECT @@ -25097,6 +25253,12 @@ msgstr "Today" msgid "Tools" msgstr "Tools" +# TRANSLATION +# LABEL/ID_TOO_MANY_REQUESTS +#: LABEL/ID_TOO_MANY_REQUESTS +msgid "Upon configurations, you have reached the maximum number of files to upload." +msgstr "Upon configurations, you have reached the maximum number of files to upload." + # TRANSLATION # LABEL/ID_TOP_MARGIN #: LABEL/ID_TOP_MARGIN @@ -25823,6 +25985,18 @@ msgstr "The uploaded file exceeds the upload_max_filesize directive in php.ini" msgid "The file has not been attached because the extension is not allowed or because the content doesn't correspond." msgstr "The file has not been attached because the extension is not allowed or because the content doesn't correspond." +# TRANSLATION +# LABEL/ID_UPLOAD_INVALID_DOC_MAX_FILESIZE +#: LABEL/ID_UPLOAD_INVALID_DOC_MAX_FILESIZE +msgid "File size exceeds the allowable limit of {0}" +msgstr "File size exceeds the allowable limit of {0}" + +# TRANSLATION +# LABEL/ID_UPLOAD_INVALID_DOC_TYPE_FILE +#: LABEL/ID_UPLOAD_INVALID_DOC_TYPE_FILE +msgid "Invalid file format, please upload a file with one of the following formats {0}" +msgstr "Invalid file format, please upload a file with one of the following formats {0}" + # TRANSLATION # LABEL/ID_UPLOAD_ERR_NO_FILE #: LABEL/ID_UPLOAD_ERR_NO_FILE @@ -35694,7 +35868,7 @@ msgstr "Password" # dynaforms/fields_Toolbar.xml?suggest # dynaforms/fields_Toolbar.xml #: toolButton - suggest -msgid "[dynaforms/fields_Toolbar.xml?suggest] Suggest" +msgid "Suggest" msgstr "Suggest" # dynaforms/fields_Toolbar.xml?textarea @@ -35712,7 +35886,7 @@ msgstr "Title" # dynaforms/fields_Toolbar.xml?subtitle # dynaforms/fields_Toolbar.xml #: toolButton - subtitle -msgid "[dynaforms/fields_Toolbar.xml?subtitle] Subtitle" +msgid "Subtitle" msgstr "Subtitle" # dynaforms/fields_Toolbar.xml?button @@ -35724,7 +35898,7 @@ msgstr "Button" # dynaforms/fields_Toolbar.xml?submit # dynaforms/fields_Toolbar.xml #: toolButton - submit -msgid "[dynaforms/fields_Toolbar.xml?submit] Submit" +msgid "Submit" msgstr "Submit" # dynaforms/fields_Toolbar.xml?reset @@ -35736,7 +35910,7 @@ msgstr "Reset" # dynaforms/fields_Toolbar.xml?dropdown # dynaforms/fields_Toolbar.xml #: toolButton - dropdown -msgid "[dynaforms/fields_Toolbar.xml?dropdown] Dropdown" +msgid "Dropdown" msgstr "Dropdown" # dynaforms/fields_Toolbar.xml?yesno @@ -35754,7 +35928,7 @@ msgstr "Listbox" # dynaforms/fields_Toolbar.xml?checkbox # dynaforms/fields_Toolbar.xml #: toolButton - checkbox -msgid "[dynaforms/fields_Toolbar.xml?checkbox] Checkbox" +msgid "Checkbox" msgstr "Checkbox" # dynaforms/fields_Toolbar.xml?checkgroup @@ -35778,7 +35952,7 @@ msgstr "Date" # dynaforms/fields_Toolbar.xml?hidden # dynaforms/fields_Toolbar.xml #: toolButton - hidden -msgid "[dynaforms/fields_Toolbar.xml?hidden] Hidden" +msgid "Hidden" msgstr "Hidden" # dynaforms/fields_Toolbar.xml?link diff --git a/workflow/engine/controllers/InstallerModule.php b/workflow/engine/controllers/InstallerModule.php index 51e3c2181..3fd6869c1 100644 --- a/workflow/engine/controllers/InstallerModule.php +++ b/workflow/engine/controllers/InstallerModule.php @@ -555,7 +555,7 @@ private function displayError() public function forceTogenerateTranslationsFiles($url) { $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, G::browserCacheFilesUrl((G::is_https() ? "https://" : "http://") . $_SERVER["HTTP_HOST"] . "/js/ext/translation.en.js?r=" . rand(1, 10000))); + curl_setopt($ch, CURLOPT_URL, G::browserCacheFilesUrl(System::getServerProtocolHost() . "/js/ext/translation.en.js?r=" . rand(1, 10000))); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FRESH_CONNECT, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 60); @@ -856,13 +856,6 @@ public function createMySQLWorkspace() $this->installLog(G::LoadTranslation('ID_CREATING', SYS_LANG, [$db_file])); file_put_contents($db_file, $dbText); - /*----------------------------------********---------------------------------*/ - //Generate the env.ini file - $envIniFile = $path_site . 'env.ini'; - $content = 'system_utc_time_zone = 1' . "\n"; - - $this->installLog(G::LoadTranslation('ID_CREATING', SYS_LANG, [$envIniFile])); - file_put_contents($envIniFile, $content); /*----------------------------------********---------------------------------*/ //Generate the databases.php file diff --git a/workflow/engine/controllers/adminProxy.php b/workflow/engine/controllers/adminProxy.php index 6c86f2c06..65d1fafdc 100644 --- a/workflow/engine/controllers/adminProxy.php +++ b/workflow/engine/controllers/adminProxy.php @@ -2,6 +2,7 @@ use ProcessMaker\Core\System; use ProcessMaker\Plugins\PluginRegistry; +use ProcessMaker\Validation\ValidationUploadedFiles; /** * adminProxy.php @@ -573,8 +574,10 @@ public function testConnection($params) } /** - * for send email configuration - * @autor Alvaro + * For test email configuration + * @return stdClass() + * + * @see adminProxy->testConnection() */ public function sendTestMail() { @@ -623,7 +626,7 @@ public function sendTestMail() '', '', '', - 'TEST', + WsBase::MESSAGE_TYPE_TEST_EMAIL, $subject, $from, $_POST['TO'], @@ -1025,7 +1028,14 @@ public function createThumb($img_file, $ori_path, $thumb_path, $img_type) */ public function uploadImage() { - //!dataSystem + ValidationUploadedFiles::getValidationUploadedFiles()->dispatch(function($validator) { + echo G::json_encode([ + 'success' => true, + 'failed' => true, + 'message' => $validator->getMessage() + ]); + exit(); + }); $filter = new InputFilter(); $_SERVER["REQUEST_URI"] = $filter->xssFilterHard($_SERVER["REQUEST_URI"]); diff --git a/workflow/engine/controllers/appProxy.php b/workflow/engine/controllers/appProxy.php index b54ca5502..3d9f519f4 100644 --- a/workflow/engine/controllers/appProxy.php +++ b/workflow/engine/controllers/appProxy.php @@ -1,4 +1,6 @@ message = G::LoadTranslation('ID_LOGIN_AGAIN'); @@ -23,15 +25,22 @@ class AppProxy extends HttpProxyController * @param int $httpData->start * @param int $httpData->limit * @param string $httpData->appUid (optionalif it is not passed try use $_SESSION['APPLICATION']) - * @return array containg the case notes + * @return array containing the case notes + * + * @see workflow/engine/methods/cases/open.php + * @see workflow/engine/methods/cases/casesListExtJs.php + * @see workflow/engine/methods/cases/casesConsolidatedListExtJs.php + * + * @link https://wiki.processmaker.com/3.2/Case_Notes + * @link https://wiki.processmaker.com/3.2/Cases/Case_Notes */ - function getNotesList ($httpData) + function getNotesList($httpData) { if (!isset($_SESSION['USER_LOGGED'])) { $response = new stdclass(); $response->message = G::LoadTranslation('ID_LOGIN_AGAIN'); $response->lostSession = true; - print G::json_encode( $response ); + print G::json_encode($response); die(); } @@ -66,8 +75,7 @@ function getNotesList ($httpData) $httpData->pro = $caseLoad['PRO_UID']; } - if(!isset($httpData->pro) || empty($httpData->pro) ) - { + if (!isset($httpData->pro) || empty($httpData->pro)) { $proUid = $_SESSION['PROCESS']; } else { $proUid = $httpData->pro; @@ -80,12 +88,15 @@ function getNotesList ($httpData) } $usrUid = $_SESSION['USER_LOGGED']; - $respView = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, "VIEW", $delIndex); + $respView = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, "VIEW", $delIndex); $respBlock = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, "BLOCK", $delIndex); if ($respView['CASES_NOTES'] == 0 && $respBlock['CASES_NOTES'] == 0) { - return array ('totalCount' => 0,'notes' => array (),'noPerms' => 1 - ); + return [ + 'totalCount' => 0, + 'notes' => [], + 'noPerms' => 1 + ]; } $usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : ""; @@ -93,6 +104,12 @@ function getNotesList ($httpData) $response = $appNotes->getNotesList($appUid, '', $httpData->start, $httpData->limit); $response = AppNotes::applyHtmlentitiesInNotes($response); + $iterator = 0; + foreach ($response['array']['notes'] as $value) { + $response ['array']['notes'][$iterator]['NOTE_DATE'] = DateTime::convertUtcToTimeZone($value['NOTE_DATE']); + $iterator++; + } + require_once("classes/model/Application.php"); $oApplication = new Application(); $aApplication = $oApplication->Load($appUid); diff --git a/workflow/engine/controllers/caseSchedulerProxy.php b/workflow/engine/controllers/caseSchedulerProxy.php index 428a007ae..1ddc31c12 100644 --- a/workflow/engine/controllers/caseSchedulerProxy.php +++ b/workflow/engine/controllers/caseSchedulerProxy.php @@ -1,5 +1,6 @@ WS_USER ); $sWS_PASS = trim( $params->WS_PASS ); - if (G::is_https()) { - $http = 'https://'; - } else { - $http = 'http://'; - } - $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; + $endpoint = System::getServerMainPath() . '/services/wsdl2'; @$client = new SoapClient( $endpoint ); $user = $sWS_USER; diff --git a/workflow/engine/controllers/designer.php b/workflow/engine/controllers/designer.php index c89483f26..966094b2f 100644 --- a/workflow/engine/controllers/designer.php +++ b/workflow/engine/controllers/designer.php @@ -11,9 +11,10 @@ */ use Maveriks\Util\ClassLoader; -use \OAuth2\Request; -use \ProcessMaker\BusinessModel\Light\Tracker; -use \ProcessMaker\Services\OAuth2\Server; +use OAuth2\Request; +use ProcessMaker\BusinessModel\InputDocument; +use ProcessMaker\BusinessModel\Light\Tracker; +use ProcessMaker\Services\OAuth2\Server; class Designer extends Controller { @@ -27,6 +28,8 @@ public function __construct() * Index Action * * @param string $httpData (opional) + * + * @see Controller->call() */ public function index($httpData) { @@ -55,6 +58,8 @@ public function index($httpData) $this->setVar("SYS_LANG", SYS_LANG); $this->setVar("SYS_SKIN", SYS_SKIN); $this->setVar('HTTP_SERVER_HOSTNAME', System::getHttpServerHostnameRequestsFrontEnd()); + $inpuDocument = new InputDocument(); + $this->setVar('maxFileSizeInformation', G::json_encode($inpuDocument->getMaxFileSize())); if ($debug) { if (!file_exists(PATH_HTML . "lib-dev/pmUI/build.cache")) { diff --git a/workflow/engine/controllers/home.php b/workflow/engine/controllers/home.php index 75110531d..216c502d1 100644 --- a/workflow/engine/controllers/home.php +++ b/workflow/engine/controllers/home.php @@ -1,6 +1,7 @@ render(); } + /** + * Get the cases information + * + * @param string $type + * @param integer $start + * @param integer $limit + * @param string $user + * @param string $filter + * @param string $search + * @param string $process + * @param string $status + * @param string $dateFrom + * @param string $dateTo + * @param string $callback + * @param string $dir + * @param string $sort + * @param string $category + * @return array + * + * @see \Home->appAdvancedSearch() + * @see \Home->appList() + * @see \Home->getApps() + */ public function getAppsData( $type, $start = null, @@ -404,10 +428,10 @@ public function getAppsData( $solrEnabled = false; if (( - $type == "todo" || $type == "draft" || $type == "paused" || $type == "sent" || - $type == "selfservice" || $type == "unassigned" || $type == "search" - ) && - (($solrConf = System::solrEnv()) !== false) + $type == "todo" || $type == "draft" || $type == "paused" || $type == "sent" || + $type == "selfservice" || $type == "unassigned" || $type == "search" + ) && + (($solrConf = System::solrEnv()) !== false) ) { $ApplicationSolrIndex = new AppSolr( $solrConf["solr_enabled"], @@ -443,21 +467,21 @@ public function getAppsData( $category ); } else { - $dataList['userId'] = $user; - $dataList['userUid'] = $this->userUid; - $dataList['start'] = $start; - $dataList['limit'] = $limit; - $dataList['filter'] = $filter; - $dataList['search'] = $search; - $dataList['process'] = $process; - $dataList['status'] = $status; + $dataList['userId'] = $user; + $dataList['userUid'] = $this->userUid; + $dataList['start'] = $start; + $dataList['limit'] = $limit; + $dataList['filter'] = $filter; + $dataList['search'] = $search; + $dataList['process'] = $process; + $dataList['status'] = $status; $dataList['dateFrom'] = $dateFrom; - $dataList['dateTo'] = $dateTo; + $dataList['dateTo'] = $dateTo; $dataList['callback'] = $callback; - $dataList['dir'] = $dir; - $dataList['sort'] = $sort; + $dataList['dir'] = $dir; + $dataList['sort'] = $sort; $dataList['category'] = $category; - $dataList['action'] = $type; + $dataList['action'] = $type; $dataList['dir'] = 'DESC'; /*----------------------------------********---------------------------------*/ $case = new \ProcessMaker\BusinessModel\Cases(); @@ -494,8 +518,9 @@ public function getAppsData( $generalConfCasesList = $conf->getConfiguration('ENVIRONMENT_SETTINGS', ''); $cases['data'][$i]['DEL_DELEGATE_DATE'] = ''; if (!empty(config("system.workspace"))) { - if (isset( $generalConfCasesList['casesListDateFormat'] ) && ! empty( $generalConfCasesList['casesListDateFormat'] )) { - $cases['data'][$i]['DEL_DELEGATE_DATE'] = $conf->getSystemDate($row['DEL_DELEGATE_DATE'], 'casesListDateFormat'); + if (isset($generalConfCasesList['casesListDateFormat']) && !empty($generalConfCasesList['casesListDateFormat'])) { + $cases['data'][$i]['DEL_DELEGATE_DATE'] = $conf->getSystemDate($row['DEL_DELEGATE_DATE'], + 'casesListDateFormat'); } } if ($cases['data'][$i]['DEL_DELEGATE_DATE'] == '') { @@ -509,6 +534,12 @@ public function getAppsData( $notes = $appNotes->getNotesList($row['APP_UID'], '', $notesStart, $notesLimit); $notes = AppNotes::applyHtmlentitiesInNotes($notes); + $iterator = 0; + foreach ($notes['array']['notes'] as $val) { + $notes ['array']['notes'][$iterator]['NOTE_DATE'] = DateTime::convertUtcToTimeZone($val['NOTE_DATE']); + $iterator++; + } + $notes = $notes['array']; $cases['data'][$i]['NOTES_COUNT'] = $notes['totalCount']; diff --git a/workflow/engine/controllers/pmTablesProxy.php b/workflow/engine/controllers/pmTablesProxy.php index 0c45b18dd..4ef2703b6 100644 --- a/workflow/engine/controllers/pmTablesProxy.php +++ b/workflow/engine/controllers/pmTablesProxy.php @@ -8,6 +8,8 @@ */ use ProcessMaker\Core\System; +use ProcessMaker\Validation\ExceptionRestApi; +use ProcessMaker\Validation\ValidationUploadedFiles; header("Content-type: text/html;charset=utf-8"); require_once 'classes/model/AdditionalTables.php'; @@ -26,68 +28,70 @@ class pmTablesProxy extends HttpProxyController * @param string $httpData->limit * @param string $httpData->textFilter */ - public function getList ($httpData) + public function getList($httpData) { $configurations = new Configurations(); $processMap = new ProcessMap(); // setting parameters - $config = $configurations->getConfiguration( 'additionalTablesList', 'pageSize', '', $_SESSION['USER_LOGGED'] ); - $env = $configurations->getConfiguration( 'ENVIRONMENT_SETTINGS', '' ); - $limit_size = isset( $config->pageSize ) ? $config['pageSize'] : 20; - $start = isset( $httpData->start ) ? $httpData->start : 0; - $limit = isset( $httpData->limit ) ? $httpData->limit : $limit_size; - $filter = isset( $httpData->textFilter ) ? $httpData->textFilter : ''; - $pro_uid = isset( $httpData->pro_uid ) ? $httpData->pro_uid : null; + $config = $configurations->getConfiguration('additionalTablesList', 'pageSize', '', $_SESSION['USER_LOGGED']); + $env = $configurations->getConfiguration('ENVIRONMENT_SETTINGS', ''); + $limit_size = isset($config->pageSize) ? $config['pageSize'] : 20; + $start = isset($httpData->start) ? $httpData->start : 0; + $limit = isset($httpData->limit) ? $httpData->limit : $limit_size; + $filter = isset($httpData->textFilter) ? $httpData->textFilter : ''; + $pro_uid = isset($httpData->pro_uid) ? $httpData->pro_uid : null; if ($pro_uid !== null) { - $process = $pro_uid == '' ? array ('not_equal' => $pro_uid - ) : array ('equal' => $pro_uid); - $addTables = AdditionalTables::getAll( false, false, $filter, $process ); + $process = $pro_uid == '' ? ['not_equal' => $pro_uid] : ['equal' => $pro_uid]; + $addTables = AdditionalTables::getAll(false, false, $filter, $process); - $c = $processMap->getReportTablesCriteria( $pro_uid ); - $oDataset = RoutePeer::doSelectRS( $c ); - $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); - $reportTablesOldList = array (); + $c = $processMap->getReportTablesCriteria($pro_uid); + $oDataset = RoutePeer::doSelectRS($c); + $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $reportTablesOldList = array(); while ($oDataset->next()) { $reportTablesOldList[] = $oDataset->getRow(); } foreach ($reportTablesOldList as $i => $oldRepTab) { - if($filter != ''){ - if((stripos($oldRepTab['REP_TAB_NAME'], $filter) !== false) || (stripos($oldRepTab['REP_TAB_TITLE'], $filter) !== false)){ - $addTables['rows'][] = array ('ADD_TAB_UID' => $oldRepTab['REP_TAB_UID'],'PRO_UID' => $oldRepTab['PRO_UID'],'DBS_UID' => ($oldRepTab['REP_TAB_CONNECTION'] == 'wf' ? 'workflow' : 'rp'),'ADD_TAB_DESCRIPTION' => $oldRepTab['REP_TAB_TITLE'],'ADD_TAB_NAME' => $oldRepTab['REP_TAB_NAME'],'ADD_TAB_TYPE' => $oldRepTab['REP_TAB_TYPE'],'TYPE' => 'CLASSIC' ); - } - } else { - $addTables['rows'][] = array ('ADD_TAB_UID' => $oldRepTab['REP_TAB_UID'],'PRO_UID' => $oldRepTab['PRO_UID'],'DBS_UID' => ($oldRepTab['REP_TAB_CONNECTION'] == 'wf' ? 'workflow' : 'rp'),'ADD_TAB_DESCRIPTION' => $oldRepTab['REP_TAB_TITLE'],'ADD_TAB_NAME' => $oldRepTab['REP_TAB_NAME'],'ADD_TAB_TYPE' => $oldRepTab['REP_TAB_TYPE'],'TYPE' => 'CLASSIC' ); - } + if ($filter != '') { + if ((stripos($oldRepTab['REP_TAB_NAME'], $filter) !== false) || + (stripos($oldRepTab['REP_TAB_TITLE'], $filter) !== false)) { + $addTables['rows'][] = [ + 'ADD_TAB_UID' => $oldRepTab['REP_TAB_UID'], + 'PRO_UID' => $oldRepTab['PRO_UID'], + 'DBS_UID' => ($oldRepTab['REP_TAB_CONNECTION'] == 'wf' ? 'workflow' : 'rp'), + 'ADD_TAB_DESCRIPTION' => $oldRepTab['REP_TAB_TITLE'], + 'ADD_TAB_NAME' => $oldRepTab['REP_TAB_NAME'], + 'ADD_TAB_TYPE' => $oldRepTab['REP_TAB_TYPE'], + 'TYPE' => 'CLASSIC' + ]; + } + } else { + $addTables['rows'][] = [ + 'ADD_TAB_UID' => $oldRepTab['REP_TAB_UID'], + 'PRO_UID' => $oldRepTab['PRO_UID'], + 'DBS_UID' => ($oldRepTab['REP_TAB_CONNECTION'] == 'wf' ? 'workflow' : 'rp'), + 'ADD_TAB_DESCRIPTION' => $oldRepTab['REP_TAB_TITLE'], + 'ADD_TAB_NAME' => $oldRepTab['REP_TAB_NAME'], + 'ADD_TAB_TYPE' => $oldRepTab['REP_TAB_TYPE'], + 'TYPE' => 'CLASSIC' + ]; + } } $addTables['count'] = count($addTables['rows']); - if($start != 0){ - $addTables['rows'] = array_splice($addTables['rows'], $start); + if ($start != 0) { + $addTables['rows'] = array_splice($addTables['rows'], $start); } $addTables['rows'] = array_splice($addTables['rows'], 0, $limit); } else { - $addTables = AdditionalTables::getAll( $start, $limit, $filter ); + $addTables = AdditionalTables::getAll($start, $limit, $filter); } foreach ($addTables['rows'] as $i => $table) { - try { - $con = Propel::getConnection( PmTable::resolveDbSource( $table['DBS_UID'] ) ); - $stmt = $con->createStatement(); - $rs = $stmt->executeQuery( 'SELECT COUNT(*) AS NUM_ROWS from ' . $table['ADD_TAB_NAME'] ); - if ($rs->next()) { - $r = $rs->getRow(); - $addTables['rows'][$i]['NUM_ROWS'] = $r['NUM_ROWS']; - } else { - $addTables['rows'][$i]['NUM_ROWS'] = 0; - } - - //removing the prefix "PMT" to allow alphabetical order (just in view) - if (substr( $addTables['rows'][$i]['ADD_TAB_NAME'], 0, 4 ) == 'PMT_') { - $addTables['rows'][$i]['ADD_TAB_NAME'] = substr( $addTables['rows'][$i]['ADD_TAB_NAME'], 4 ); - } - } catch (Exception $e) { - $addTables['rows'][$i]['NUM_ROWS'] = G::LoadTranslation( 'ID_TABLE_NOT_FOUND' ); + //removing the prefix "PMT" to allow alphabetical order (just in view) + if (substr($addTables['rows'][$i]['ADD_TAB_NAME'], 0, 4) == 'PMT_') { + $addTables['rows'][$i]['ADD_TAB_NAME'] = substr($addTables['rows'][$i]['ADD_TAB_NAME'], 4); } } @@ -721,6 +725,9 @@ public function import ($httpData) } try { + ValidationUploadedFiles::getValidationUploadedFiles()->dispatch(function($validator) { + throw new ExceptionRestApi($validator->getMessage()); + }); $result = new stdClass(); $errors = ''; $fromConfirm = false; @@ -889,6 +896,11 @@ public function import ($httpData) } $result->message = $msg; + } catch (ExceptionRestApi $e) { + $result = new stdClass(); + $result->success = false; + $result->errorType = 'notice'; + $result->message = $e->getMessage(); } catch (Exception $e) { $result = new stdClass(); $result->fromAdmin = $fromAdmin; @@ -1152,7 +1164,13 @@ public function _dataDestroy ($row) } } - public function genDataReport ($httpData) + /** + * It eliminates and generates the data report from the cases of a process. + * + * @param object $httpData + * @return object + */ + public function genDataReport($httpData) { $result = new stdClass(); @@ -1160,12 +1178,26 @@ public function genDataReport ($httpData) $result->success = true; $additionalTables = new AdditionalTables(); - $table = $additionalTables->load( $httpData->id ); - if ($table['PRO_UID'] != '') { - $additionalTables->populateReportTable( $table['ADD_TAB_NAME'], PmTable::resolveDbSource( $table['DBS_UID'] ), $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID'], $table['ADD_TAB_UID'] ); - $result->message = 'generated for table ' . $table['ADD_TAB_NAME']; - } + $table = $additionalTables->load($httpData->id); + if (!empty($table) && $table['PRO_UID'] != '') { + try { + $additionalTables->populateReportTable($table['ADD_TAB_NAME'], PmTable::resolveDbSource($table['DBS_UID']), $table['ADD_TAB_TYPE'], $table['PRO_UID'], $table['ADD_TAB_GRID'], $table['ADD_TAB_UID']); + $result->message = 'Generated for table ' . $table['ADD_TAB_NAME']; + } catch (Exception $e) { + $context = Bootstrap::getDefaultContextLog(); + $context['proUid'] = $table['PRO_UID']; + $context['tableName'] = $table['ADD_TAB_NAME']; + $context['message'] = $e->getMessage(); + Bootstrap::registerMonolog('dataReport', 500, 'Generation of data report could not be completed', $context, $context['workspace'], 'processmaker.log'); + + $result->message = 'Generation of data report could not be completed. Please check the processmaker.log for more details.'; + $result->success = false; + } + } else { + $result->message = 'Unable to retrieve the table for this id: ' . $httpData->id . '.'; + $result->success = false; + } return $result; } diff --git a/workflow/engine/controllers/webEntryProxy.php b/workflow/engine/controllers/webEntryProxy.php index 20ea01856..fc6b40ed0 100644 --- a/workflow/engine/controllers/webEntryProxy.php +++ b/workflow/engine/controllers/webEntryProxy.php @@ -40,13 +40,7 @@ public function checkCredentials ($params) $sWS_USER = trim( $params->WS_USER ); $sWS_PASS = trim( $params->WS_PASS ); - if (G::is_https()) { - $http = 'https://'; - } else { - $http = 'http://'; - } - - $endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2'; + $endpoint = System::getServerMainPath() . '/services/wsdl2'; @$client = new SoapClient( $endpoint ); $user = $sWS_USER; @@ -137,12 +131,6 @@ public function save ($params) $oTask->load( $sTASKS ); $tas_title = $oTask->getTasTitle(); - if (G::is_https()) { - $http = 'https://'; - } else { - $http = 'http://'; - } - $sContent = ''; $SITE_PUBLIC_PATH = ''; if (file_exists( $SITE_PUBLIC_PATH . '' )) { @@ -167,8 +155,8 @@ public function save ($params) $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; $template = new TemplatePower( $pluginTpl ); $template->prepare(); - $template->assign( 'wsdlUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2' ); - $template->assign( 'wsUploadUrl', $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/upload' ); + $template->assign( 'wsdlUrl', System::getServerMainPath() . '/services/wsdl2'); + $template->assign( 'wsUploadUrl', System::getServerMainPath() . '/services/upload'); $template->assign( 'processUid', $sPRO_UID ); $template->assign( 'dynaformUid', $sDYNAFORM ); $template->assign( 'taskUid', $sTASKS ); @@ -218,7 +206,7 @@ public function save ($params) $aDataEvent['EVN_CONDITIONS'] = $sWS_USER; $output = $oEvent->update( $aDataEvent ); - $link = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; + $link = System::getServerMainPath() . '/' . $sPRO_UID . '/' . $dynTitle . '.php'; $this->success = true; $this->msg = G::LoadTranslation( 'ID_WEB_ENTRY_SUCCESS_NEW' ); diff --git a/workflow/engine/data/mysql/insert.sql b/workflow/engine/data/mysql/insert.sql index bab798762..176ec2005 100644 --- a/workflow/engine/data/mysql/insert.sql +++ b/workflow/engine/data/mysql/insert.sql @@ -1,8 +1,8 @@ -INSERT INTO USERS (USR_UID,USR_USERNAME,USR_PASSWORD,USR_FIRSTNAME,USR_LASTNAME,USR_EMAIL,USR_DUE_DATE,USR_CREATE_DATE,USR_UPDATE_DATE,USR_STATUS,USR_COUNTRY,USR_CITY,USR_LOCATION,USR_ADDRESS,USR_PHONE,USR_FAX,USR_CELLULAR,USR_ZIP_CODE,DEP_UID,USR_POSITION,USR_RESUME,USR_BIRTHDAY,USR_ROLE,USR_REPORTS_TO,USR_REPLACED_BY ) VALUES +INSERT INTO USERS (USR_UID,USR_USERNAME,USR_PASSWORD,USR_FIRSTNAME,USR_LASTNAME,USR_EMAIL,USR_DUE_DATE,USR_CREATE_DATE,USR_UPDATE_DATE,USR_STATUS,USR_COUNTRY,USR_CITY,USR_LOCATION,USR_ADDRESS,USR_PHONE,USR_FAX,USR_CELLULAR,USR_ZIP_CODE,DEP_UID,USR_POSITION,USR_RESUME,USR_BIRTHDAY,USR_ROLE,USR_REPORTS_TO,USR_REPLACED_BY ) VALUES ('00000000000000000000000000000001','admin','21232f297a57a5a743894a0e4a801fc3','Administrator',' ', 'admin@processmaker.com','2020-01-01','1999-11-30 00:00:00','2008-05-23 18:36:19','ACTIVE', 'US','FL','MMK','','', '1-305-402-0282','1-305-675-1400','','','Administrator', '','1999-02-25','PROCESSMAKER_ADMIN','',''), ('00000000000000000000000000000002','guest','674ba9750749d735ec9787d606170d78','Guest',' ', 'guest@processmaker.com','2030-01-01','2009-02-01 12:24:36','2009-02-01 12:24:36','INACTIVE', 'US','FL','MMK','','', '1-305-402-0282','1-305-675-1400','','','Guest', '','2009-02-01','PROCESSMAKER_GUEST','',''); -INSERT INTO CONTENT (CON_CATEGORY,CON_PARENT,CON_ID,CON_LANG,CON_VALUE) VALUES +INSERT INTO CONTENT (CON_CATEGORY,CON_PARENT,CON_ID,CON_LANG,CON_VALUE) VALUES ('PER_NAME','','00000000000000000000000000000001','en','Login'), ('PER_NAME','','00000000000000000000000000000002','en','Setup'), ('ROL_NAME','','00000000000000000000000000000002','en','System Administrator'), @@ -57451,6 +57451,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES ( 'LABEL','ID_CASE_REACTIVATED_SUCCESSFULLY','en','The case {APP_NUMBER} was reactivated successfully!','2014-01-15') , +( 'LABEL','ID_CASE_RESPONSE_NOT_AVAILABLE','en','No response available, please review the case information','2018-03-02') , ( 'LABEL','ID_CASE_ROUTED_TO','en','Case routed to','2017-06-02') , ( 'LABEL','ID_CASE_SCHEDULER','en','Case Scheduler','2014-01-15') , ( 'LABEL','ID_CASE_SCHEDULER_CLASSIC','en','Case Scheduler (classic processes)','2017-10-13') , @@ -58256,11 +58257,6 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_FULL_NAME','en','Full Name','2014-01-15') , ( 'LABEL','ID_FULL_TEXT_SEARCH','en','Full Text Search','2014-01-15') , ( 'LABEL','ID_FUNCTION','en','@function() It evaluates the value, then executes a PHP function','2014-01-15') , -( 'LABEL','ID_G_SUITE_CONFIGURATION_SAVED','en','G Suite Configuration Saved','2018-09-21') , -( 'LABEL','ID_G_SUITE_CONNECT','en','Request G Suite connection','2018-09-21') , -( 'LABEL','ID_G_SUITE_DISCONNECT','en','Disconnect G Suite','2018-09-21') , -( 'LABEL','ID_G_SUITE_LOAD_GROUPS','en','Update G Suite groups','2018-09-21') , -( 'LABEL','ID_G_SUITE_SYNC_USERS','en','Syncing Users','2018-09-21') , ( 'LABEL','ID_GENERAL','en','General','2014-01-15') , ( 'LABEL','ID_GENERAL_PROCESS_NUMBERS','en','General Process Numbers','2014-01-15') , ( 'LABEL','ID_GENERATE','en','Generate','2014-01-15') , @@ -58323,6 +58319,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_GRID_PAGE_NO_ROWS_MESSAGE','en','No rows to display','2014-01-15') , ( 'LABEL','ID_GRID_PAGE_NO_SKIN_MESSAGE','en','No skins to display','2014-01-15') , ( 'LABEL','ID_GRID_PAGE_NO_USERS_MESSAGE','en','No users to display','2014-01-15') , +( 'LABEL','ID_GRID_VARIABLE_NAME_ERROR','en','A valid variable starts with a letter or underscore, followed by any number of letters, numbers, or underscores. Variables with wrong names: {0}','2017-11-16') , ( 'LABEL','ID_GRID_WIZARD','en','ProcessMaker Grid Wizard','2014-01-15') , ( 'LABEL','ID_GROUP','en','Group','2014-01-15') , ( 'LABEL','ID_GROUPS','en','Groups','2014-01-15') , @@ -58344,19 +58341,24 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_GROUP_USERS','en','Group or Users','2014-01-15') , ( 'LABEL','ID_GROUP_USER_IS_ALREADY_ASSIGNED','en','The user with {0}: {1} is already assigned to the group.','2014-05-20') , ( 'LABEL','ID_GROUP_USER_IS_NOT_ASSIGNED','en','The user with {0}: {1} is not assigned to the group.','2014-05-20') , +( 'LABEL','ID_G_SUITE_CONFIGURATION_SAVED','en','G Suite Configuration Saved','2018-09-21') , +( 'LABEL','ID_G_SUITE_CONNECT','en','Request G Suite connection','2018-09-21') , +( 'LABEL','ID_G_SUITE_DISCONNECT','en','Disconnect G Suite','2018-09-21') , +( 'LABEL','ID_G_SUITE_LOAD_GROUPS','en','Update G Suite groups','2018-09-21') , +( 'LABEL','ID_G_SUITE_SYNC_USERS','en','Syncing Users','2018-09-21') , ( 'LABEL','ID_HAS_BEEN_DELETED','en','Has been deleted','2014-01-15') , ( 'LABEL','ID_HEADER_ALIGN','en','Align','2014-01-15') , ( 'LABEL','ID_HEADER_FIELD_NAME','en','Field Name','2014-01-15') , ( 'LABEL','ID_HEADER_FIELD_TYPE','en','Field Type','2014-01-15') , -( 'LABEL','ID_HEADER_LABEL','en','Label','2014-01-15') , +( 'LABEL','ID_HEADER_LABEL','en','Label','2014-01-15') ; +INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES + ( 'LABEL','ID_HEADER_NUMBER','en','#','2014-01-15') , ( 'LABEL','ID_HEADER_WIDTH','en','Width','2014-01-15') , ( 'LABEL','ID_HEARTBEAT_CONFIG','en','Heart Beat','2014-01-15') , ( 'LABEL','ID_HEARTBEAT_DISPLAY','en','Heart Beat','2014-01-15') , ( 'LABEL','ID_HEART_BEAT_DETAILS_1','en','The usage statistics will help the development team to better understand user requirements and prioritize improvements in future releases.','2014-01-15') , -( 'LABEL','ID_HEART_BEAT_DETAILS_2','en','We cannot and will not reverse-engineer that collected data to find specific details concerning your projects.','2014-01-15') ; -INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES - +( 'LABEL','ID_HEART_BEAT_DETAILS_2','en','We cannot and will not reverse-engineer that collected data to find specific details concerning your projects.','2014-01-15') , ( 'LABEL','ID_HEART_BEAT_DISABLED','en','Heart beat has been disabled','2014-01-15') , ( 'LABEL','ID_HEART_BEAT_ENABLED','en','Heart beat has been enabled','2014-01-15') , ( 'LABEL','ID_HELP','en','Help','2015-04-06') , @@ -58430,15 +58432,15 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_INDEX_NOT_WRITEABLE','en','The index file is not writable.
    Please give write permission to file:','2014-01-15') , ( 'LABEL','ID_INDICATOR','en','Indicator','2015-03-09') , ( 'LABEL','ID_INDICATOR_GOAL','en','Goal','2015-03-09') , -( 'LABEL','ID_INDICATOR_PROCESS_REQUIRED','en','The field Process of indicator "{0}" is required.','2015-03-18') , +( 'LABEL','ID_INDICATOR_PROCESS_REQUIRED','en','The field Process of indicator "{0}" is required.','2015-03-18') ; +INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES + ( 'LABEL','ID_INDICATOR_TITLE','en','Indicator Title','2015-03-09') , ( 'LABEL','ID_INDICATOR_TITLE_REQUIRED','en','The field Title of indicator "{0}" is required.','2015-03-18') , ( 'LABEL','ID_INDICATOR_TYPE','en','Indicator Type','2015-03-09') , ( 'LABEL','ID_INDICATOR_TYPE_REQUIRED','en','The field Type of indicator "{0}" is required.','2015-03-18') , ( 'LABEL','ID_INEFFICIENCY_COST','en','Costs or Savings','2015-05-06') , -( 'LABEL','ID_INFO','en','Info','2014-01-15') ; -INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES - +( 'LABEL','ID_INFO','en','Info','2014-01-15') , ( 'LABEL','ID_INFORMATION','en','Information','2014-01-15') , ( 'LABEL','ID_INFORMATION_EMPTY','en','The information sent is empty!','2014-10-21') , ( 'LABEL','ID_INFORMATION_WAS_STORED_SUCCESSFULLY','en','information was stored successfully','2014-01-15') , @@ -58495,10 +58497,10 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_INTERMEDIATE_CATCH_TIMER_EVENT','en','Untitled - Intermediate Timer Event','2018-05-23') , ( 'LABEL','ID_INTERMEDIATE_MESSAGE_EVENT','en','Intermediate Message Events (Task Notifications)','2014-01-15') , ( 'LABEL','ID_INTERMEDIATE_MESSAGE_EVENTS','en','Intermediate Message Events (Task Notifications)','2014-01-15') , -( 'LABEL','ID_INTERMEDIATE_TIMER_EVENT','en','Intermediate Timer Event (Multiple Event)','2014-01-15') , -( 'LABEL','ID_INTERMEDIATE_TIMER_EVENTS','en','Intermediate Timer Event (Multiple Event)','2014-01-15') , ( 'LABEL','ID_INTERMEDIATE_THROW_EMAIL_EVENT','en','Untitled - Intermediate Email Event','2018-05-23') , ( 'LABEL','ID_INTERMEDIATE_THROW_MESSAGE_EVENT','en','Untitled - Intermediate Receive Message Event','2018-05-23') , +( 'LABEL','ID_INTERMEDIATE_TIMER_EVENT','en','Intermediate Timer Event (Multiple Event)','2014-01-15') , +( 'LABEL','ID_INTERMEDIATE_TIMER_EVENTS','en','Intermediate Timer Event (Multiple Event)','2014-01-15') , ( 'LABEL','ID_INTERNATIONAL','en','International','2014-01-15') , ( 'LABEL','ID_INVALID_APPLICATION_ID_MSG','en','An invalid application ID was stored for the session.
    This could have happened if you opened another case in a new tab or window.
    Please {0} the case.','2014-10-21') , ( 'LABEL','ID_INVALID_APPLICATION_NUMBER','en','You have set a invalid Application Number','2014-01-15') , @@ -58512,7 +58514,9 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_INVALID_NAME','en','Invalid name!','2014-01-15') , ( 'LABEL','ID_INVALID_ORIGIN_USER','en','Invalid origin user','2014-01-15') , ( 'LABEL','ID_INVALID_PRF_PATH','en','Invalid value specified for prf_path. Expecting templates/ or public/','2014-05-21') , -( 'LABEL','ID_INVALID_PROCESS','en','Invalid process','2014-01-15') , +( 'LABEL','ID_INVALID_PROCESS','en','Invalid process','2014-01-15') ; +INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES + ( 'LABEL','ID_INVALID_PROCESS_NAME','en','Invalid process name, please just use alphanumeric characters.','2014-01-15') , ( 'LABEL','ID_INVALID_PROCESS_NAME2','en','Invalid process name, please just use alphanumeric characters.','2014-01-15') , ( 'LABEL','ID_INVALID_QUERY','en','Invalid query.','2015-10-23') , @@ -58522,9 +58526,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_INVALID_SCH_START_DATE','en','Invalid value specified for sch_start_date. Expecting date in YYYY-MM-DD format, such as 2014-01-01','2014-05-21') , ( 'LABEL','ID_INVALID_SCH_START_DAY_1','en','Invalid value specified for sch_start_day_opt_1. Must be between 1 and 31','2014-05-21') , ( 'LABEL','ID_INVALID_SCH_START_TIME','en','Invalid value specified for sch_start_time. Expecting time in HH:MM format (The time can not be greater than 23:59)','2014-10-21') , -( 'LABEL','ID_INVALID_START','en','Invalid value specified for start','2014-05-22') ; -INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES - +( 'LABEL','ID_INVALID_START','en','Invalid value specified for start','2014-05-22') , ( 'LABEL','ID_INVALID_START_HOURS','en','The following start hours rows are invalid:','2014-01-15') , ( 'LABEL','ID_INVALID_TRIGGER','en','Invalid trigger ''{TRIGGER_INDEX}''','2014-01-15') , ( 'LABEL','ID_INVALID_VALUE','en','Invalid value for "{0}".','2014-05-20') , @@ -58594,7 +58596,9 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_LICENSE_SERVER','en','License server','2014-09-18') , ( 'LABEL','ID_LIFETIME_VALIDATE','en','Max Lifetime value has to be a positive integer','2017-04-05') , ( 'LABEL','ID_LINE','en','Line','2014-01-15') , -( 'LABEL','ID_LINES','en','Lines','2015-03-09') , +( 'LABEL','ID_LINES','en','Lines','2015-03-09') ; +INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES + ( 'LABEL','ID_LOADING','en','Loading, please wait...','2014-01-15') , ( 'LABEL','ID_LOADING_GRID','en','Loading...','2014-01-15') , ( 'LABEL','ID_LOAD_FAILED','en','Load Failed','2014-01-15') , @@ -58604,9 +58608,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_LOCATION','en','Location','2014-01-15') , ( 'LABEL','ID_LOGGED','en','Logged on','2014-01-15') , ( 'LABEL','ID_LOGIN','en','Login','2014-01-15') , -( 'LABEL','ID_LOGIN_AGAIN','en','You have lost your session and you have to login again.','2014-01-15') ; -INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES - +( 'LABEL','ID_LOGIN_AGAIN','en','You have lost your session and you have to login again.','2014-01-15') , ( 'LABEL','ID_LOGIN_LIBRARY','en','Login into ProcessMaker Library','2014-01-15') , ( 'LABEL','ID_LOGIN_SETTINGS','en','Login Settings','2014-01-15') , ( 'LABEL','ID_LOGIN_TITLE','en','Please enter your credentials below','2015-12-07') , @@ -58619,11 +58621,13 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_LOG_INFO','en','Log Information','2014-01-15') , ( 'LABEL','ID_MAFE_0015b7e51c1ca4293041c429985ca323','en','The specified subform could not be found in the process.', NOW()) , ( 'LABEL','ID_MAFE_0025301679e9722c3abd5914cfbc7dd7','en','Database connection edited successfully', NOW()) , +( 'LABEL','ID_MAFE_004d33be4d12eb8c0ae00703e7c70f61','en','Pick Second', NOW()) , ( 'LABEL','ID_MAFE_004fa281c757ed0c2ed3ca2b19dc26f4','en','Please select a file to upload', NOW()) , ( 'LABEL','ID_MAFE_0095a9fa74d1713e43e370a7d7846224','en','Export', NOW()) , ( 'LABEL','ID_MAFE_00d23a76e43b46dae9ec7aa9dcbebb32','en','Enabled', NOW()) , ( 'LABEL','ID_MAFE_011306a5e88efff7332299ca7d8e4515','en','Invalid flow between elements. Please delete the flow and reconnect the elements.', NOW()) , ( 'LABEL','ID_MAFE_014bd6f385cb5aec29ec9714b8106ccb','en','Search ...', NOW()) , +( 'LABEL','ID_MAFE_018987001347cd85be2f30fcaac4ec7f','en','Reassign my cases', NOW()) , ( 'LABEL','ID_MAFE_01bc6f8efa4202821e95f4fdf6298b30','en','clear', NOW()) , ( 'LABEL','ID_MAFE_01d9ea29b533da28fc3a3dc45826530b','en','Fields marked with an asterisk (%%ASTERISK%%) are required.', NOW()) , ( 'LABEL','ID_MAFE_01e314c524834917a79de8eb706d379a','en','Available users list', NOW()) , @@ -58631,10 +58635,12 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_0266e5e196c710628bce171dc00a8d4e','en','Available Objects', NOW()) , ( 'LABEL','ID_MAFE_02c99274ed000da347819e732fe05bfa','en','Regular Expression', NOW()) , ( 'LABEL','ID_MAFE_02f5a8943b70bb7ee70ec52a58090caa','en','The key and label must be supplied.', NOW()) , +( 'LABEL','ID_MAFE_033db172e7506126611760711854d755','en','Next Month', NOW()) , ( 'LABEL','ID_MAFE_03727ac48595a24daed975559c944a44','en','Day', NOW()) , ( 'LABEL','ID_MAFE_03937134cedab9078be39a77ee3a48a0','en','Group', NOW()) , ( 'LABEL','ID_MAFE_03b62516184fb6ef591f45bd4974b753','en','refresh', NOW()) , ( 'LABEL','ID_MAFE_03b94d355b5045f081bd898e4d664900','en','display mode', NOW()) , +( 'LABEL','ID_MAFE_03c2e7e41ffc181a4e84080b4710e81e','en','New', NOW()) , ( 'LABEL','ID_MAFE_03de5d2d75b7dd914fbc5c775bf21b63','en','Input Document*:', NOW()) , ( 'LABEL','ID_MAFE_03df896fc71cd516fdcf44aa699c4933','en','Variables', NOW()) , ( 'LABEL','ID_MAFE_0422899c4397e3d67ffc16045df065bd','en','Please configure cron to create cases in base to a signal.', NOW()) , @@ -58654,6 +58660,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_06d4cd63bde972fc66a0aed41d2f5c51','en','comment', NOW()) , ( 'LABEL','ID_MAFE_07052d86b58157929b39588cd04bf868','en','Receive Message', NOW()) , ( 'LABEL','ID_MAFE_070acc9c521d0db8d0620a1435a36207','en','Wait for', NOW()) , +( 'LABEL','ID_MAFE_07463a98d573b3749d9230c9c02c38d0','en','Accepted Values is an empty string', NOW()) , ( 'LABEL','ID_MAFE_07501edbc1f9fd2f7d0f0d71712b11cf','en','Case Tracker updated successfully', NOW()) , ( 'LABEL','ID_MAFE_075ae3d2fc31640504f814f60e5ef713','en','disabled', NOW()) , ( 'LABEL','ID_MAFE_07603125709811efbdbcd69161b42527','en','Save process', NOW()) , @@ -58671,7 +58678,9 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_0a10134c1999989ce854ac519eb97249','en','Web Entry Anonymous Authentication', NOW()) , ( 'LABEL','ID_MAFE_0a33cdf242201623275b9897d8b4d8c4','en','Html Template', NOW()) , ( 'LABEL','ID_MAFE_0a52da7a03a6de3beefe54f8c03ad80d','en','Original', NOW()) , -( 'LABEL','ID_MAFE_0a7d55be9d12a369a6a8da0fb517fba4','en','minute', NOW()) , +( 'LABEL','ID_MAFE_0a7d55be9d12a369a6a8da0fb517fba4','en','minute', NOW()) ; +INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES + ( 'LABEL','ID_MAFE_0af63899fb5342f6d1882ea16af864c1','en','Allows date selection after this date
    (in YYYY-MM-DD HH:MM:SS format)', NOW()) , ( 'LABEL','ID_MAFE_0b27918290ff5323bea1e3b78a9cf04e','en','File', NOW()) , ( 'LABEL','ID_MAFE_0b3d5609ee81e50809b7351e848e4698','en','A6', NOW()) , @@ -58686,9 +58695,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_0d82790b0612935992bd564a17ce37d6','en','Quit', NOW()) , ( 'LABEL','ID_MAFE_0dbeaf3f5e4f954c5d7c20cf222df405','en','widget parent', NOW()) , ( 'LABEL','ID_MAFE_0dc345e011be6119663ae656cd0fc190','en','Process Category', NOW()) , -( 'LABEL','ID_MAFE_0dd4741bcb3a94e7ec755907753669ff','en','Do you want to delete this Input Document?', NOW()) ; -INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES - +( 'LABEL','ID_MAFE_0dd4741bcb3a94e7ec755907753669ff','en','Do you want to delete this Input Document?', NOW()) , ( 'LABEL','ID_MAFE_0df44e2363fd51047d55635ae4130592','en','Insert the title of the new trigger', NOW()) , ( 'LABEL','ID_MAFE_0df8347776dbb1c637387ec287c7966f','en','
    ', NOW()) , ( 'LABEL','ID_MAFE_0e0d7b681145ccfa803cd39c1b2e648f','en','There are problems deleting the dynaform, please try again.', NOW()) , @@ -58727,6 +58734,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_166a1105094f6efbcb4b3fabd27cfa40','en','The task doesn''t have assigned users', NOW()) , ( 'LABEL','ID_MAFE_16888e57558b35486dfc46f2a39fdac9','en','Task properties saved successfully', NOW()) , ( 'LABEL','ID_MAFE_168909c0b6f1dfbd48f679d47059c1d6','en','Third', NOW()) , +( 'LABEL','ID_MAFE_16e4992123f5046ce89c07829efc9ac2','en','Decrement Hour', NOW()) , ( 'LABEL','ID_MAFE_16f49c0f891dce505db0ffe478aff96f','en','Next →', NOW()) , ( 'LABEL','ID_MAFE_171c9ea8629e74f980018c522d83bada','en','Variables Out', NOW()) , ( 'LABEL','ID_MAFE_172ac8a8053b32e15c602be955a2f098','en','Execute a trigger when a case is cancelled', NOW()) , @@ -58752,7 +58760,9 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_1a79a39f343f2224748ec987ccf8431f','en','Lane', NOW()) , ( 'LABEL','ID_MAFE_1ad9db0953957569c62d12728f2b0874','en','Get value from', NOW()) , ( 'LABEL','ID_MAFE_1b539f6f34e8503c97f6d3421346b63c','en','July', NOW()) , -( 'LABEL','ID_MAFE_1ba532aebcefcfd5cc7a5c1dd99dbd8b','en','Work Days', NOW()) , +( 'LABEL','ID_MAFE_1ba532aebcefcfd5cc7a5c1dd99dbd8b','en','Work Days', NOW()) ; +INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES + ( 'LABEL','ID_MAFE_1bda80f2be4d3658e0baa43fbe7ae8c1','en','view', NOW()) , ( 'LABEL','ID_MAFE_1c0b8f236cc7ad13254af9a32ea15be8','en','Resend', NOW()) , ( 'LABEL','ID_MAFE_1c7444be9626d149ab598fb79b639f96','en','Portrait', NOW()) , @@ -58762,15 +58772,14 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_1d1ded75bd737a314cd8e39f4a715ab9','en','Note: To remove days, months or years from the date picker, use a format which does not have those elements. For example a format of "MM/YYY" will not allow the user to select days.', NOW()) , ( 'LABEL','ID_MAFE_1d54bc57e09e7e7b52f85f0045a01474','en','Do you want to delete this lang?', NOW()) , ( 'LABEL','ID_MAFE_1d623b89683f9ce4e074de1676d12416','en','sum', NOW()) , +( 'LABEL','ID_MAFE_1d6785e8bc575506eb7ee226614a6d18','en','Allowed file extensions:', NOW()) , ( 'LABEL','ID_MAFE_1dccefa9aa4b700675ca17101bccd7d3','en','Edit Source Code', NOW()) , ( 'LABEL','ID_MAFE_1ddcb92ade31c8fbd370001f9b29a7d9','en','format', NOW()) , ( 'LABEL','ID_MAFE_1de162d73f017a9243ce0c939064a014','en','Enable gallery', NOW()) , ( 'LABEL','ID_MAFE_1e469db43d54e3019fcb2328e1ec4e27','en','Require user login', NOW()) , ( 'LABEL','ID_MAFE_1ea7e575defdf6bc3f26a3f127e98170','en','datasource', NOW()) , ( 'LABEL','ID_MAFE_1f5a44e6621dc51b6daca35844ba8311','en','Timing Control', NOW()) , -( 'LABEL','ID_MAFE_1f9d9a4ccb5e099c457588964a61b8db','en','page size', NOW()) ; -INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES - +( 'LABEL','ID_MAFE_1f9d9a4ccb5e099c457588964a61b8db','en','page size', NOW()) , ( 'LABEL','ID_MAFE_2032a8d80edc990f99b7113724f4adc6','en','The source shape can not have more than one outgoing connection', NOW()) , ( 'LABEL','ID_MAFE_203d82526c3bf7c32f75cb083c61c4ff','en','Summary Form', NOW()) , ( 'LABEL','ID_MAFE_20633a8e3019e3b5f7d394f488d237da','en','Callback Action...', NOW()) , @@ -58802,6 +58811,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_24fa2fbfb2224c63fee87993306c0c95','en','Variable Type', NOW()) , ( 'LABEL','ID_MAFE_257cb9ff74e0f915a115f902c91bc372','en','TEMPLATES', NOW()) , ( 'LABEL','ID_MAFE_25c7551bb238df62b5c5de847e0e4a0a','en','Required field error message', NOW()) , +( 'LABEL','ID_MAFE_25d7912714632dcc5283517e20ead1f1','en','Next Decade', NOW()) , ( 'LABEL','ID_MAFE_25d902c24283ab8cfbac54dfa101ad31','en','src', NOW()) , ( 'LABEL','ID_MAFE_2689a6d6b3d3e54ccf8c9af27cf95d35','en','Actions by Email', NOW()) , ( 'LABEL','ID_MAFE_26c8b24dce7a00ff4d00781dc2ee5d66','en','Execute a trigger when a case is reassigned', NOW()) , @@ -58832,7 +58842,9 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_2b30b478acce5ed435bdf80f39de9b1f','en','Please take note of the changes to update your process logic.', NOW()) , ( 'LABEL','ID_MAFE_2b30f7950c6f143b5722c4e001bddd26','en','Suggest users', NOW()) , ( 'LABEL','ID_MAFE_2b9153e1f3c6ebd7bf7ac1ee168aa7ca','en','__PARAMETERS__', NOW()) , -( 'LABEL','ID_MAFE_2bc2de57b27c665244bf4cb8d17f842f','en','Do you want to clear this variable? The following properties are reset: Variable, Data Type, DB Connection, SQL and Options.', NOW()) , +( 'LABEL','ID_MAFE_2bc2de57b27c665244bf4cb8d17f842f','en','Do you want to clear this variable? The following properties are reset: Variable, Data Type, DB Connection, SQL and Options.', NOW()) ; +INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES + ( 'LABEL','ID_MAFE_2c4429deb064b2431fb36a8b4f552713','en','It leaving this field in blank, the next user''s email will be used.', NOW()) , ( 'LABEL','ID_MAFE_2d33b0db41ea7a05caec256b28887de2','en','Text Annotation', NOW()) , ( 'LABEL','ID_MAFE_2d69cae8f3f13b440c51edced7338699','en','days of week disabled', NOW()) , @@ -58850,9 +58862,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_308a5146b0818a721c5081d2b1932398','en','is duplicated.', NOW()) , ( 'LABEL','ID_MAFE_30a2dae0a135701b862050465b3e4e97','en','Triggers after and before a step are not supported when working offline', NOW()) , ( 'LABEL','ID_MAFE_30c40215e6d00c574ca23451003db9b9','en','checkgroup', NOW()) , -( 'LABEL','ID_MAFE_3120001274fa32a921770c1b41e6dc0a','en','DETAILS', NOW()) ; -INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES - +( 'LABEL','ID_MAFE_3120001274fa32a921770c1b41e6dc0a','en','DETAILS', NOW()) , ( 'LABEL','ID_MAFE_313a6a3d25aa041ee3dc3cbd65d4f22b','en','Formula', NOW()) , ( 'LABEL','ID_MAFE_313af772d92d01300d5e89512cd93bd0','en','default value', NOW()) , ( 'LABEL','ID_MAFE_31d1eacb86fc41c8ba34934923e8b53e','en','Email Account Settings', NOW()) , @@ -58894,6 +58904,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_3b313f1e720672161bfa924e023cf015','en','Title Case', NOW()) , ( 'LABEL','ID_MAFE_3b44e8c1da430ff11f9ff3b38a67ac34','en','Enable Grid Lines', NOW()) , ( 'LABEL','ID_MAFE_3b563524fdb17b4a86590470d40bef74','en','Media', NOW()) , +( 'LABEL','ID_MAFE_3bb055cd21140e7c1b17eeeace227bdb','en','Select Year', NOW()) , ( 'LABEL','ID_MAFE_3c8a58a423ed96c806664b1d4e803e2c','en','Data Type', NOW()) , ( 'LABEL','ID_MAFE_3cab03c00dbd11bc3569afa0748013f0','en','Inactive', NOW()) , ( 'LABEL','ID_MAFE_3cc152ca5e049720eb10e6bf1fa1fa02','en','Error, There are problems removing the element', NOW()) , @@ -58910,9 +58921,12 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_3e661ccd1bd840f47829d2e6dbb5e651','en','required field error message', NOW()) , ( 'LABEL','ID_MAFE_3e80ebd582f73299f249afba8ebe7e6b','en','responsive', NOW()) , ( 'LABEL','ID_MAFE_3e8f92eb64623f0ecd16d2efcd0acd7e','en','Report Tables', NOW()) , +( 'LABEL','ID_MAFE_3edcc5150c225068c9ae501ffe62ceb9','en','Increment Second', NOW()) , ( 'LABEL','ID_MAFE_3edf8ca26a1ec14dd6e91dd277ae1de6','en','Origin', NOW()) , ( 'LABEL','ID_MAFE_3f60b096843929b02e1a070f57e27584','en','Variable Name', NOW()) , -( 'LABEL','ID_MAFE_3f66ca8856f98cde86f7a78e287cd4ba','en','', NOW()) , +( 'LABEL','ID_MAFE_3f66ca8856f98cde86f7a78e287cd4ba','en','', NOW()) ; +INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES + ( 'LABEL','ID_MAFE_3fcf026bbfffb63fb24b8de9d0446949','en','April', NOW()) , ( 'LABEL','ID_MAFE_40070e1f0867f97db0fa33039fae2063','en','File uploaded successfully', NOW()) , ( 'LABEL','ID_MAFE_40227eb4ec6a9d663f53962308a2c706','en','Case Status', NOW()) , @@ -58932,9 +58946,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_41fffd09332a35491d3bed5a34f91410','en','http://eonasdan.github.io/bootstrap-datetimepicker/', NOW()) , ( 'LABEL','ID_MAFE_42184184a95464c63c790acc3a69e564','en','Routing History', NOW()) , ( 'LABEL','ID_MAFE_421b47ffd946ca083b65cd668c6b17e6','en','video', NOW()) , -( 'LABEL','ID_MAFE_4252b72e6ebcd4d4b4c2e46a786f03d2','en','Zoom', NOW()) ; -INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES - +( 'LABEL','ID_MAFE_4252b72e6ebcd4d4b4c2e46a786f03d2','en','Zoom', NOW()) , ( 'LABEL','ID_MAFE_42728192eb543e8b035df3d040068d3d','en','Description of the new trigger', NOW()) , ( 'LABEL','ID_MAFE_42b5e40c0f14c557113865a3aa78b673','en','Insert a SQL query like: SELECT [Key field], [Label field] FROM [Table name]', NOW()) , ( 'LABEL','ID_MAFE_431fc30c29fdcdc1980d898a2f65e4e7','en','The user/group was successfully removed', NOW()) , @@ -58944,12 +58956,14 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_44314d568caee793c8d7753a816d6e02','en','An error occurred while retrieving the access token', NOW()) , ( 'LABEL','ID_MAFE_4466476a945cb091a8f4252b96f140d7','en','suggest', NOW()) , ( 'LABEL','ID_MAFE_44749712dbec183e983dcd78a7736c41','en','Date', NOW()) , +( 'LABEL','ID_MAFE_4498e6305304230bc7f2600f5d1b1d84','en','Mail (PHP)', NOW()) , +( 'LABEL','ID_MAFE_449c6d9f5ba15789700b2c8ea380e3fa','en','Untitled label', NOW()) , ( 'LABEL','ID_MAFE_44fdec47036f482b68b748f9d786801b','en','days', NOW()) , ( 'LABEL','ID_MAFE_451f887bdbe0c83be42cbfffecedb2f0','en','Select the date and time for case(s) to be initiated.', NOW()) , ( 'LABEL','ID_MAFE_4621590946adadc2f24119e194bd70a6','en','Parallel Marker Type', NOW()) , ( 'LABEL','ID_MAFE_463ab1bc075f498d1aa03b9bc062efa3','en','Element Type', NOW()) , ( 'LABEL','ID_MAFE_473293d536577cd3fa417dab23b7543c','en','Assign Users and Groups as Supervisors', NOW()) , -( 'LABEL','ID_MAFE_473f81670bcdd9d92624698f43d6a517','en','Empty.', NOW()) , +( 'LABEL','ID_MAFE_47a23c652a2e04c0963f15326ebef11a','en','Go to today', NOW()) , ( 'LABEL','ID_MAFE_47b5269b1f60dcd4d18f0cc5f17a7c21','en','Email variable', NOW()) , ( 'LABEL','ID_MAFE_47c14840d8e15331fa420b9b2f757cd9','en','Variable', NOW()) , ( 'LABEL','ID_MAFE_47cf1efb576e40705e0a45ab011f053d','en','Import Error:', NOW()) , @@ -58972,6 +58986,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_4b0786e5eb9e8b54529708004fd31b21','en','', NOW()) , ( 'LABEL','ID_MAFE_4b1f36581927bba38500601a5bf3ede8','en','Script Task', NOW()) , ( 'LABEL','ID_MAFE_4b420957db489cc5aff8bee58d07b8b1','en','The row can not be removed, because is being edited.', NOW()) , +( 'LABEL','ID_MAFE_4b441851f94a139dc89c37f6c03be611','en','Pick Minute', NOW()) , ( 'LABEL','ID_MAFE_4b7c4e2a902673b967b1d63f9a4bed74','en','Condition *', NOW()) , ( 'LABEL','ID_MAFE_4ba21d7a3d8a97aa04e405f9caf3ab3b','en','Capitalize phrase', NOW()) , ( 'LABEL','ID_MAFE_4bb78cf31aa7936d4031f8de1481d308','en','The label is empty', NOW()) , @@ -58982,6 +58997,8 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_4c2a8fe7eaf24721cc7a9f0175115bd4','en','Message', NOW()) , ( 'LABEL','ID_MAFE_4c3880bb027f159e801041b1021e88e8','en','Method', NOW()) , ( 'LABEL','ID_MAFE_4c524bf462d270df1443cd80bf70e5de','en','Input Document', NOW()) , +( 'LABEL','ID_MAFE_4d0c42523f93e7ce5f25230010a3aa00','en','The parameter maxlength is not a number', NOW()) , +( 'LABEL','ID_MAFE_4d287ea3f5618dc027b8de8bba546ef0','en','Close the picker', NOW()) , ( 'LABEL','ID_MAFE_4d34f1097f6c8b9cee28bca8b78bbee9','en','Start date', NOW()) , ( 'LABEL','ID_MAFE_4d3d769b812b6faa6b76e1a8abaece2d','en','Active', NOW()) , ( 'LABEL','ID_MAFE_4e357e7345689cff230335282b201a11','en','Enable camera', NOW()) , @@ -58989,10 +59006,13 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_4ed131033015697f970660a0cb48ff1e','en','Create variable', NOW()) , ( 'LABEL','ID_MAFE_4f67fe16b274bf31a67539fbedb8f8d3','en','Document Type', NOW()) , ( 'LABEL','ID_MAFE_4f92f36c19f0ad317fb71d493a18caac','en','
  • Parent: Inherit the mode from parent.
  • ', NOW()) , -( 'LABEL','ID_MAFE_50913568f681474c32d3f1b4a9fafdf1','en','Case Tracker', NOW()) , +( 'LABEL','ID_MAFE_50913568f681474c32d3f1b4a9fafdf1','en','Case Tracker', NOW()) ; +INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES + ( 'LABEL','ID_MAFE_50a9ec1685a51015e4509529cb939081','en','Generate Link', NOW()) , ( 'LABEL','ID_MAFE_50b5d3dcade1bb32254e0f8d54c493de','en','Please insert variable before adding to the list.', NOW()) , ( 'LABEL','ID_MAFE_5174307b9097d47b1a506bc8171c2bb3','en','textbox', NOW()) , +( 'LABEL','ID_MAFE_5174d1309f275ba6f275db3af9eb3e18','en','Grid', NOW()) , ( 'LABEL','ID_MAFE_5199decbb00b9a606e30f3ddfc951f3f','en','Database Connections', NOW()) , ( 'LABEL','ID_MAFE_520d0db389f362bf79ef56ca0af3dcab','en','Format', NOW()) , ( 'LABEL','ID_MAFE_521019040a0f4f7773357aa6bc22180b','en','DRAFT', NOW()) , @@ -59014,9 +59034,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_55f6611cb342565cf0f5002400f53a95','en','Annotation', NOW()) , ( 'LABEL','ID_MAFE_5651b7822a684ac4ae3b1b1690e147c0','en','A0Oversize', NOW()) , ( 'LABEL','ID_MAFE_56a1bf7a363021c1d31dd8338428cc03','en','Custom Trigger', NOW()) , -( 'LABEL','ID_MAFE_56b77519470d41f8b2da598f1021508e','en','max date', NOW()) ; -INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES - +( 'LABEL','ID_MAFE_56b77519470d41f8b2da598f1021508e','en','max date', NOW()) , ( 'LABEL','ID_MAFE_56dbee09e1c297e9269b967d3f1e8af8','en','There are problems updating the Web Entry, please try again.', NOW()) , ( 'LABEL','ID_MAFE_570b43e00e6db926c60b0eeee0a275b4','en','Database connection saved successfully', NOW()) , ( 'LABEL','ID_MAFE_572d795e2d044f895cc511e5c05030e5','en','INCLUSIVE', NOW()) , @@ -59070,7 +59088,9 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_60cf550c40960532dfd002fcfbc6725a','en','There are problems getting the Triggers list, please try again.', NOW()) , ( 'LABEL','ID_MAFE_611ebad77c16b1edc01a8e4962094900','en','All Tasks', NOW()) , ( 'LABEL','ID_MAFE_6126329d245973d0025f07d8d4f3c3ba','en','Allows date selection before this date
    (in YYYY-MM-DD HH:MM:SS format)', NOW()) , -( 'LABEL','ID_MAFE_61e80a8ed0aff262daa5800330e133f3','en','Service Task', NOW()) , +( 'LABEL','ID_MAFE_61e80a8ed0aff262daa5800330e133f3','en','Service Task', NOW()) ; +INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES + ( 'LABEL','ID_MAFE_6238fa95a408af9c5598d0f45d923b18','en','Please configure cron to wait for time condition.', NOW()) , ( 'LABEL','ID_MAFE_628b7db04235f228d40adc671413a8c8','en','day', NOW()) , ( 'LABEL','ID_MAFE_62902641c38f3a4a8eb3212454360e24','en','Minute', NOW()) , @@ -59078,6 +59098,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_630f6dc397fe74e52d5189e2c80f282b','en','Back to list', NOW()) , ( 'LABEL','ID_MAFE_631aea77fcb10698585c8ae77aac3800','en','External Step', NOW()) , ( 'LABEL','ID_MAFE_63401535ae5b2457b9c4471637ba8308','en','In the design area you can drop the process elements and order or arrange them to design your process.', NOW()) , +( 'LABEL','ID_MAFE_635f2145a06da2d4ce2c355bf94da6ed','en','Previous Year', NOW()) , ( 'LABEL','ID_MAFE_6384750fb02541d64a749b1a9296a43f','en','Condition Trigger', NOW()) , ( 'LABEL','ID_MAFE_6394d816bfb4220289a6f4b29cfb1834','en','textarea', NOW()) , ( 'LABEL','ID_MAFE_63a3168661b8fec46d2e90c9e0569cad','en','Default: false', NOW()) , @@ -59087,6 +59108,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_6421c440fabe27193fad6710c33cf7c7','en','There are no items.', NOW()) , ( 'LABEL','ID_MAFE_6450242531912981c3683cae88a32a66','en','Forms', NOW()) , ( 'LABEL','ID_MAFE_64684d8a069264ece1465e64cbe2a189','en','Enter a Protocol and Hostname valid value.', NOW()) , +( 'LABEL','ID_MAFE_64959029acf7b169f8d972637b75b49e','en','No records', NOW()) , ( 'LABEL','ID_MAFE_650be61892bf690026089544abbd9d26','en','Mode', NOW()) , ( 'LABEL','ID_MAFE_6547600c780b3b6483c2d5d758666c3f','en','Start Timer updated successfully', NOW()) , ( 'LABEL','ID_MAFE_656bd5e7964412e1954a5cb83cf0e31e','en','Single HTML', NOW()) , @@ -59096,9 +59118,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_65c3b5956adaf7365a8857abb7ddd26b','en','Execute a trigger when a case is deleted', NOW()) , ( 'LABEL','ID_MAFE_6606bf86257a99bf75f2d6360e92e0df','en','Please press the \"Generate Link\" button.', NOW()) , ( 'LABEL','ID_MAFE_66285b36f894a5439af5a98e3e1a36d2','en','Process Objects', NOW()) , -( 'LABEL','ID_MAFE_662f707d5491e9bce8238a6c0be92190','en','hidden', NOW()) ; -INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES - +( 'LABEL','ID_MAFE_662f707d5491e9bce8238a6c0be92190','en','hidden', NOW()) , ( 'LABEL','ID_MAFE_66b4af3ab39216f5ecddcb0613abfe04','en','Select Dynaform use in case.', NOW()) , ( 'LABEL','ID_MAFE_671aa2e8cc2c2435cf509fa4a3baf26c','en','Executive', NOW()) , ( 'LABEL','ID_MAFE_67dab01827a619fdbcb137f18a83feb5','en','End of process', NOW()) , @@ -59127,9 +59147,9 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_6be8bfc7078373aa92b3a862b5253e7e','en','Mobile controls', NOW()) , ( 'LABEL','ID_MAFE_6c24f6923944d3f9d84bcf924661abff','en','New variables created', NOW()) , ( 'LABEL','ID_MAFE_6c25e6a6da95b3d583c6ec4c3f82ed4d','en','Weekly', NOW()) , +( 'LABEL','ID_MAFE_6cae1a8108be3aec1aa792644c69c190','en','Information Required', NOW()) , ( 'LABEL','ID_MAFE_6cb85fb9933f1990eaa1dc7619c84233','en','Data Store', NOW()) , ( 'LABEL','ID_MAFE_6d7215c4b3bc4716d026ac46c6d9ae64','en','Apr', NOW()) , -( 'LABEL','ID_MAFE_6e139990d75202b4688849d505e9f659','en','Current form.', NOW()) , ( 'LABEL','ID_MAFE_6e51ca3efb50c3fa4e7eb7fb75cba556','en','Message content', NOW()) , ( 'LABEL','ID_MAFE_6e554a6c35c9b142ea806751d85818fa','en','Message Type', NOW()) , ( 'LABEL','ID_MAFE_6e599f7a2a9186d391be4537f105be98','en','Fourth', NOW()) , @@ -59145,11 +59165,14 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_7106cb2df5011f1eddfd5c67b3c84f0f','en','Variable saved successfully', NOW()) , ( 'LABEL','ID_MAFE_713aecbe2f5f5523ebccad6740dc1fc7','en','DynaForm', NOW()) , ( 'LABEL','ID_MAFE_714a04bc58e64a19344df22801f2f5b2','en','View groups', NOW()) , +( 'LABEL','ID_MAFE_714b68ca17408b57ef4b48b30f390dcd','en','Pick Hour', NOW()) , ( 'LABEL','ID_MAFE_716de874a0d74f25c0aa8c444c3a7539','en','Prefix', NOW()) , ( 'LABEL','ID_MAFE_716f6b30598ba30945d84485e61c1027','en','close', NOW()) , ( 'LABEL','ID_MAFE_71707d31908dc87d64747c61247db5f3','en','An unexpected error while deleting the DB Connection, please try again later.', NOW()) , ( 'LABEL','ID_MAFE_718bf2c47ea34a12a3c4cb559ba0fbd3','en','Input Document edited correctly.', NOW()) , -( 'LABEL','ID_MAFE_719430f5290466e7920b07175af870de','en','The process definition that you are trying to import contains BPMN elements that are not supported in ProcessMaker. Please try with other process.', NOW()) , +( 'LABEL','ID_MAFE_719430f5290466e7920b07175af870de','en','The process definition that you are trying to import contains BPMN elements that are not supported in ProcessMaker. Please try with other process.', NOW()) ; +INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES + ( 'LABEL','ID_MAFE_7208f9c293aca2d9a81fb9dc71229ee7','en','Properties saved successfully', NOW()) , ( 'LABEL','ID_MAFE_72116971e25c9b2e7926c62a5bacb915','en','Error Update File', NOW()) , ( 'LABEL','ID_MAFE_7215ee9c7d9dc229d2921a40e899ec5f','en','', NOW()) , @@ -59158,6 +59181,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_72d6d7a1885885bb55a565fd1070581a','en','Import', NOW()) , ( 'LABEL','ID_MAFE_7308cd3156257f5139f5a76d3cace070','en','An unexpected error while assigning the trigger, please try again later.', NOW()) , ( 'LABEL','ID_MAFE_7351dffefed9ebab76b3bd34aa6f755e','en','Output Document', NOW()) , +( 'LABEL','ID_MAFE_736fda6b62eaca111776a53611ef2c92','en','Increment Minute', NOW()) , ( 'LABEL','ID_MAFE_73c146408e22128ca6a56f748ad0da66','en','
    " . G::LoadTranslation('ID_CASE') . " #: " . $this->fields["APP_NUMBER"] . "     " . G::LoadTranslation('ID_TITLE') . ": " . $this->fields["APP_TITLE"] . "
    Week Yeargg70 71 ... 29 30
    gggg1970 1971 ... 2029 2030
    Minutem0 1 ... 58 59
    mm00 01 ... 58 59
    Minutem0 1 ... 58 59
    mm00 01 ... 58 59
    DDDD001 002 ... 364 365
    Day of Weekd0 1 ... 5 6
    Unix TimestampX1360013296
    Unix Millisecond Timestampx1360013296123
    ', NOW()) , ( 'LABEL','ID_MAFE_73cacd9554a835ad196092bf378f66c3','en','array of [date, moment, string]', NOW()) , ( 'LABEL','ID_MAFE_73e27bc50aef21f6770190b3a2702123','en','Error value: Day: 0 - 31', NOW()) , @@ -59178,9 +59202,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_788287625aa640447c5d9fff50644915','en','Insert a table name', NOW()) , ( 'LABEL','ID_MAFE_78972d78128699c39ce214e712bd9b03','en','Related Input Document', NOW()) , ( 'LABEL','ID_MAFE_78ae6f0cd191d25147e252dc54768238','en','Thursday', NOW()) , -( 'LABEL','ID_MAFE_7916b6aa41d5ad862bfd15786f608ef9','en','Add Routing Rule', NOW()) ; -INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES - +( 'LABEL','ID_MAFE_7916b6aa41d5ad862bfd15786f608ef9','en','Add Routing Rule', NOW()) , ( 'LABEL','ID_MAFE_7917f0a4bc9e0d07acf8cad570e5f68f','en','Dynaform Information', NOW()) , ( 'LABEL','ID_MAFE_7964c7a971166b4525713e1885ca4cc3','en','
    Dynaforms: Create dynamic forms.', NOW()) , ( 'LABEL','ID_MAFE_796932652e81946789e875a9998ac1fb','en','Case Tracker Properties', NOW()) , @@ -59203,6 +59225,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_7ce6b2286a5396e614b8484105d277e0','en','Mar', NOW()) , ( 'LABEL','ID_MAFE_7cfa673ab5fa815bb71b9950b8085e7e','en','Sub-Process name', NOW()) , ( 'LABEL','ID_MAFE_7d693ac1022a2b1da7faa568a9273367','en','Create Database Connection', NOW()) , +( 'LABEL','ID_MAFE_7d73db163473796198dec30144f711e3','en','Next Century', NOW()) , ( 'LABEL','ID_MAFE_7dce122004969d56ae2e0245cb754d35','en','Edit', NOW()) , ( 'LABEL','ID_MAFE_7df96b18c230f90ada0a9e2307226338','en','Templates', NOW()) , ( 'LABEL','ID_MAFE_7e696c3a9460470397eba473a2072210','en','external libs', NOW()) , @@ -59219,6 +59242,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_80582834244e4d1f06860c1a18062667','en','Day of YearDDD1 2 ... 364 365DDDo1st 2nd ... 364th 365th', NOW()) , ( 'LABEL','ID_MAFE_8061e4236e0f5d816ccfb3684a1e279c','en','There are problems updating the Case Tracker, please try again.', NOW()) , ( 'LABEL','ID_MAFE_80896219739fe46ae6982d3ac855a5ad','en','Please configure cron to wait for time event.', NOW()) , +( 'LABEL','ID_MAFE_80ffff123555bd5173345bc8f144edeb','en','Clear selection', NOW()) , ( 'LABEL','ID_MAFE_812a48ba719daeda82e4da8e812d426c','en','Custom URL', NOW()) , ( 'LABEL','ID_MAFE_813f078c7fbc03a222410f48f74a68c4','en','Intermediate Email Event', NOW()) , ( 'LABEL','ID_MAFE_815b565aff7fbfe8db5eb2573677e9a4','en','SubProcess must have an incoming sequence flow', NOW()) , @@ -59228,9 +59252,12 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_81a7427163958378a4181ae66e8e2b0c','en','Save as', NOW()) , ( 'LABEL','ID_MAFE_8203af436c88713cf6853998fb45e8df','en','calendar weeks', NOW()) , ( 'LABEL','ID_MAFE_82331503174acbae012b2004f6431fa5','en','December', NOW()) , -( 'LABEL','ID_MAFE_823a38edcd60271ed5106469ce7de36a','en','End date:', NOW()) , +( 'LABEL','ID_MAFE_823a38edcd60271ed5106469ce7de36a','en','End date:', NOW()) ; +INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES + ( 'LABEL','ID_MAFE_823e3d309f271d17abda0806debebd13','en','Enable versioning', NOW()) , ( 'LABEL','ID_MAFE_825689fed4e8cd85dbc5beedf98feec0','en','Database Name', NOW()) , +( 'LABEL','ID_MAFE_8265a4157a2febe0b6faa43345c61652','en','Next Year', NOW()) , ( 'LABEL','ID_MAFE_8292553558a75e672bc62e5a84244c82','en','Folio', NOW()) , ( 'LABEL','ID_MAFE_83482d97257d0242d1f259eb5d34a9f9','en','Cyclical Assignment', NOW()) , ( 'LABEL','ID_MAFE_84ae11ae520a036da288ca8a0acc89b1','en','New Trigger', NOW()) , @@ -59240,11 +59267,13 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_8512ae7d57b1396273f76fe6ed341a23','en','language', NOW()) , ( 'LABEL','ID_MAFE_853ca16bda4f3d303e70e48db81c17c6','en','Smartphone', NOW()) , ( 'LABEL','ID_MAFE_854f4a84f44dfa5ea4ad4b0bb953bc49','en','Validate Now', NOW()) , +( 'LABEL','ID_MAFE_85a2bbe801286ff44a6c4b1a4a4e9bc9','en','Select Decade', NOW()) , ( 'LABEL','ID_MAFE_85cc96b9ef52490be95df14539d47a39','en','SubProcess must have an outgoing sequence flow', NOW()) , ( 'LABEL','ID_MAFE_86266ee937d97f812a8e57d22b62ee29','en','reset', NOW()) , ( 'LABEL','ID_MAFE_8650e375ee80b2277a84fc9b85375e36','en','A9', NOW()) , ( 'LABEL','ID_MAFE_868e45e7bc9c1b6c723724f85f00defc','en','Select Origin Process', NOW()) , ( 'LABEL','ID_MAFE_8691b6a6780d4bb3dd62a8376a54be64','en','There are problems updating the Email Event, please try again.', NOW()) , +( 'LABEL','ID_MAFE_86a32f8032467f8a54055fc4d429f2e8','en','Increment Hour', NOW()) , ( 'LABEL','ID_MAFE_86f5978d9b80124f509bdb71786e929e','en','January', NOW()) , ( 'LABEL','ID_MAFE_86fd9a7abc9f357e7fa206b2d42ec5ba','en','Destination Path', NOW()) , ( 'LABEL','ID_MAFE_87557f11575c0ad78e4e28abedc13b6e','en','End', NOW()) , @@ -59260,9 +59289,8 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_898f54db33f64c0a7ecc7507b9cc5744','en','There are problems, please try again.', NOW()) , ( 'LABEL','ID_MAFE_8991f7d434ea8104741fe2c008c09f5a','en','Database connection deleted successfully', NOW()) , ( 'LABEL','ID_MAFE_899607da7ac548d9a143b9a649d9da96','en','Copy Trigger', NOW()) , -( 'LABEL','ID_MAFE_89d626523f83c2d1f8a5549a845dd6aa','en','Start Event must have an outgoing sequence flow', NOW()) ; -INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES - +( 'LABEL','ID_MAFE_89d0fdd0f8b1b6f918815729a338cd50','en','Select Month', NOW()) , +( 'LABEL','ID_MAFE_89d626523f83c2d1f8a5549a845dd6aa','en','Start Event must have an outgoing sequence flow', NOW()) , ( 'LABEL','ID_MAFE_89d7b10cb4238977d2b523dfd9ea7745','en','Loop', NOW()) , ( 'LABEL','ID_MAFE_89f7ce5690523e6fdb35f6117d9dc902','en','Enable consolidate for this task.', NOW()) , ( 'LABEL','ID_MAFE_8a32f139d42c17d5ed5fe2c8ca02958f','en','Data Object', NOW()) , @@ -59292,7 +59320,6 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_8f45539f90c1409482f8222018541bb7','en','Parallel Join', NOW()) , ( 'LABEL','ID_MAFE_8f45a2644508b5282f57fe129f62d19a','en','modify', NOW()) , ( 'LABEL','ID_MAFE_8f497c1a3d15af9e0c215019f26b887d','en','Delay', NOW()) , -( 'LABEL','ID_MAFE_8f72759a8a4c1e446eed395d1adc3d1c','en','- Select an email account -', NOW()) , ( 'LABEL','ID_MAFE_8f7afecbc8fbc4cd0f50a57d1172482e','en','COMPLETED', NOW()) , ( 'LABEL','ID_MAFE_8f9204c55a59d787851fc3af81abc23c','en','Link to fill a form', NOW()) , ( 'LABEL','ID_MAFE_8f9bfe9d1345237cb3b2b205864da075','en','User', NOW()) , @@ -59307,7 +59334,9 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_912f459b875e7f5f2a16c29700adc28e','en','Available Users List', NOW()) , ( 'LABEL','ID_MAFE_91325d2839558dade6b5d7443822a536','en','Available Elements', NOW()) , ( 'LABEL','ID_MAFE_9137b642b56c7affcc215d1f027b11d0','en','Dynaform to show a case summary', NOW()) , -( 'LABEL','ID_MAFE_91412465ea9169dfd901dd5e7c96dd99','en','Upload', NOW()) , +( 'LABEL','ID_MAFE_91412465ea9169dfd901dd5e7c96dd99','en','Upload', NOW()) ; +INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES + ( 'LABEL','ID_MAFE_916a154243f0a90150198e6fba099305','en','edit...', NOW()) , ( 'LABEL','ID_MAFE_91c7645ad0ba98666ab1648102f986e7','en','min date', NOW()) , ( 'LABEL','ID_MAFE_920337d67a019f218e8ccc1cc90a7e04','en','Exclusive Gateway', NOW()) , @@ -59340,11 +59369,10 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_960b44c579bc2f6818d2daaf9e4c16f0','en','Normal', NOW()) , ( 'LABEL','ID_MAFE_962b90039a542a29cedd51d87a9f28a1','en','Html Editor', NOW()) , ( 'LABEL','ID_MAFE_9639e32cab248434a17ab32237cb3b71','en','Apply', NOW()) , +( 'LABEL','ID_MAFE_96baacdc276036c2b8fb65264750a3b4','en','Choose Files', NOW()) , ( 'LABEL','ID_MAFE_9766aede44e9d1b176b4fbb0367b9853','en','@@ string, @# float, @% integer, @= original type, @& object.', NOW()) , ( 'LABEL','ID_MAFE_9778840a0100cb30c982876741b0b5a2','en','SQL', NOW()) , -( 'LABEL','ID_MAFE_97d8f56bf41502f60ca6fdd5d5da8edc','en','Definitions', NOW()) ; -INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ) VALUES - +( 'LABEL','ID_MAFE_97d8f56bf41502f60ca6fdd5d5da8edc','en','Definitions', NOW()) , ( 'LABEL','ID_MAFE_97e7c9a7d06eac006a28bf05467fcc8b','en','Link', NOW()) , ( 'LABEL','ID_MAFE_97f09283ddeadda4e80f20d9608cd8dd','en','An unexpected error while editing the step, please try again later.', NOW()) , ( 'LABEL','ID_MAFE_98369609669478919c74c916440e9978','en','Margin', NOW()) , @@ -59355,6 +59383,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_9925fd3c9d09e862da22c5d6912420d9','en','End event must have an incoming sequence flow', NOW()) , ( 'LABEL','ID_MAFE_992d1d47106d77216cd6c3a15415dbea','en','Screenshot640', NOW()) , ( 'LABEL','ID_MAFE_99493c187e709deb387b6ee3ec6c8179','en','The input document is required, please select the value.', NOW()) , +( 'LABEL','ID_MAFE_99567b953da8beace4e3e7296bf1fc23','en','Assign type', NOW()) , ( 'LABEL','ID_MAFE_99b2439e63f73ad515f7ab2447a80673','en','PAUSED', NOW()) , ( 'LABEL','ID_MAFE_99c293babcada00063dd86b4f53bccd7','en','Variable sent in email', NOW()) , ( 'LABEL','ID_MAFE_9a0364b9e99bb480dd25e1f0284c8555','en','content', NOW()) , @@ -59380,6 +59409,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE ( 'LABEL','ID_MAFE_9e13b69d1d2da927102acaaaf7154a37','en','Javascript', NOW()) , ( 'LABEL','ID_MAFE_9e2941b3c81256fac10392aaca4ccfde','en','Condition', NOW()) , ( 'LABEL','ID_MAFE_9e794f2c08707053dd2bb22a3b4d8888','en','Output Document deleted successfully', NOW()) , +( 'LABEL','ID_MAFE_9ed8ac8a23206c93a3602884788be7fa','en','Previous Month', NOW()) , ( 'LABEL','ID_MAFE_9f1658da12738ea1b34318bd8258181b','en','