PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > php.general > file_exists, is_readable & effective UID/GID
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
file_exists, is_readable & effective UID/GID

Réponse
 
LinkBack Outils de la discussion
Vieux 24/10/2007, 18h16   #1
Manuel Vacelet
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut file_exists, is_readable & effective UID/GID

Hi all,

file_exists and is_readable perfom there test with real UID/GID.
Is there any functions that tests file existance with effective UID/GID ?

Note: stat is not an option because it raises an E_WARNING if the file
is not readable.

Thanks,
Manuel
  Réponse avec citation
Vieux 24/10/2007, 18h24   #2
Daniel Brown
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] file_exists, is_readable & effective UID/GID

On 10/24/07, Manuel Vacelet <manuel.vacelet@gmail.com> wrote:
> Hi all,
>
> file_exists and is_readable perfom there test with real UID/GID.
> Is there any functions that tests file existance with effective UID/GID ?
>
> Note: stat is not an option because it raises an E_WARNING if the file
> is not readable.
>
> Thanks,
> Manuel
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


That's what you have things like <? ini_set("display_errors", "off"); ?>

--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107

Give a man a fish, he'll eat for a day. Then you'll find out he was
allergic and is hospitalized. See? No good deed goes unpunished....
  Réponse avec citation
Vieux 24/10/2007, 22h41   #3
Jim Lucas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] file_exists, is_readable & effective UID/GID

Daniel Brown wrote:
> On 10/24/07, Manuel Vacelet <manuel.vacelet@gmail.com> wrote:
>> Hi all,
>>
>> file_exists and is_readable perfom there test with real UID/GID.
>> Is there any functions that tests file existance with effective UID/GID ?
>>
>> Note: stat is not an option because it raises an E_WARNING if the file
>> is not readable.
>>
>> Thanks,
>> Manuel
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>

>
> That's what you have things like <? ini_set("display_errors", "off"); ?>
>


what about doing it like this?

<?php

$filename = __FILE__;

$stat_info = @stat($filename);

if ( $stat_info ) {
// do something...
}

The '@' will suppress the E_WARNING notice
if stat fails the condition will fail.

--
Jim Lucas

"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."

Twelfth Night, Act II, Scene V
by William Shakespeare
  Réponse avec citation
Vieux 25/10/2007, 07h42   #4
Manuel Vacelet
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: [PHP] file_exists, is_readable & effective UID/GID

On 10/24/07, Jim Lucas <lists@cmsws.com> wrote:
> Daniel Brown wrote:
> > On 10/24/07, Manuel Vacelet <manuel.vacelet@gmail.com> wrote:
> >> Hi all,
> >>
> >> file_exists and is_readable perfom there test with real UID/GID.
> >> Is there any functions that tests file existance with effective UID/GID ?
> >>
> >> Note: stat is not an option because it raises an E_WARNING if the file
> >> is not readable.
> >>
> >> Thanks,
> >> Manuel
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>

> >
> > That's what you have things like <? ini_set("display_errors", "off"); ?>
> >

>
> what about doing it like this?
>
> <?php
>
> $filename = __FILE__;
>
> $stat_info = @stat($filename);
>
> if ( $stat_info ) {
> // do something...
> }
>
> The '@' will suppress the E_WARNING notice
> if stat fails the condition will fail.


I much prefer the second solution (Jim's one) even if I find that php
limitation amazing !

Thank you for your .
Cheers,
Manuel
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 22h16.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,10833 seconds with 12 queries