downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | conferences | my php.net

search for in the

Phar::isWritable> <Phar::isFileFormat
[edit] Last updated: Fri, 07 Jun 2013

view this page in

Phar::isValidPharFilename

(PHP >= 5.3.0, PECL phar >= 1.2.0)

Phar::isValidPharFilenameDevolver si el nombre de fichero dado es un nombre de fichero phar válido

Descripción

bool Phar::isValidPharFilename ( string $filename [, bool $executable = true ] )

Devuelve si el nombre de fichero dado es un nombre de fichero phar válido que será reconocido como un archivo phar por la extensión phar. Este método se puede usar para comprobar un nombre sin tener que instanciar un archivo phar y capturar la inevitable excepción que será lanzada si se especifica un nombre no válido.

Parámetros

filename

El nombre o la ruta completa al archivo phar aún no creado

executable

Este parámetro determina si el nombre de fichero debería ser tratado como un archivo phar ejecutable o un archivo de datos no ejecutable

Valores devueltos

Devuelve TRUE si el nombre de fichero es válido, FALSE si no.



add a note add a note User Contributed Notes Phar::isValidPharFilename - [1 notes]
up
0
sebastian dot krebs dot berlin at googlemail dot com
1 year ago
Note, that this method accepts _everything_ (=> returns 'true'), when $executable is 'false' as long as the filename contains at least a dot

var_dump(\PharData::isValidPharFilename('randomstring.y', false));
bool(true)

This is not wrong at all, because I can name an archive like I want, but it makes the method completely useless (when $executable == false).

 
show source | credits | stats | sitemap | contact | advertising | mirror sites