@@ -320,51 +320,6 @@ protected function includeFile(string $file)
320320 return false ;
321321 }
322322
323- /**
324- * Check file path.
325- *
326- * Checks special characters that are illegal in filenames on certain
327- * operating systems and special characters requiring special escaping
328- * to manipulate at the command line. Replaces spaces and consecutive
329- * dashes with a single dash. Trim period, dash and underscore from beginning
330- * and end of filename.
331- *
332- * @return string The sanitized filename
333- *
334- * @deprecated No longer used. See https://github.com/codeigniter4/CodeIgniter4/issues/7055
335- */
336- public function sanitizeFilename (string $ filename ): string
337- {
338- // Only allow characters deemed safe for POSIX portable filenames.
339- // Plus the forward slash for directory separators since this might be a path.
340- // http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_278
341- // Modified to allow backslash and colons for on Windows machines.
342- $ result = preg_match_all ('/[^0-9\p{L}\s\/\-_.: \\\\]/u ' , $ filename , $ matches );
343-
344- if ($ result > 0 ) {
345- $ chars = implode ('' , $ matches [0 ]);
346-
347- throw new InvalidArgumentException (
348- 'The file path contains special characters " ' . $ chars
349- . '" that are not allowed: " ' . $ filename . '" ' ,
350- );
351- }
352- if ($ result === false ) {
353- $ message = preg_last_error_msg ();
354-
355- throw new RuntimeException ($ message . '. filename: " ' . $ filename . '" ' );
356- }
357-
358- // Clean up our filename edges.
359- $ cleanFilename = trim ($ filename , '.-_ ' );
360-
361- if ($ filename !== $ cleanFilename ) {
362- throw new InvalidArgumentException ('The characters ".-_" are not allowed in filename edges: " ' . $ filename . '" ' );
363- }
364-
365- return $ cleanFilename ;
366- }
367-
368323 /**
369324 * @param array{only?: list<string>, exclude?: list<string>} $composerPackages
370325 */
@@ -442,44 +397,6 @@ private function loadComposerNamespaces(ClassLoader $composer, array $composerPa
442397 $ this ->addNamespace ($ newPaths );
443398 }
444399
445- /**
446- * Locates autoload information from Composer, if available.
447- *
448- * @deprecated No longer used.
449- *
450- * @return void
451- */
452- protected function discoverComposerNamespaces ()
453- {
454- if (! is_file (COMPOSER_PATH )) {
455- return ;
456- }
457-
458- /**
459- * @var ClassLoader $composer
460- */
461- $ composer = include COMPOSER_PATH ;
462- $ paths = $ composer ->getPrefixesPsr4 ();
463- $ classes = $ composer ->getClassMap ();
464-
465- unset($ composer );
466-
467- // Get rid of CodeIgniter so we don't have duplicates
468- if (isset ($ paths ['CodeIgniter \\' ])) {
469- unset($ paths ['CodeIgniter \\' ]);
470- }
471-
472- $ newPaths = [];
473-
474- foreach ($ paths as $ key => $ value ) {
475- // Composer stores namespaces with trailing slash. We don't.
476- $ newPaths [rtrim ($ key , '\\ ' )] = $ value ;
477- }
478-
479- $ this ->prefixes = array_merge ($ this ->prefixes , $ newPaths );
480- $ this ->classmap = array_merge ($ this ->classmap , $ classes );
481- }
482-
483400 /**
484401 * Loads helpers
485402 */
0 commit comments