PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Serveur - Sécurité et techniques > alt.apache.configuration > Infinite PHP function stack crashes Apache in Vista - Fixable?
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
alt.apache.configuration Apache web server configuration issues.

Infinite PHP function stack crashes Apache in Vista - Fixable?

Réponse
 
LinkBack Outils de la discussion
Vieux 09/02/2008, 15h59   #1
PHPBABY3
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Infinite PHP function stack crashes Apache in Vista - Fixable?


The following PHP code causes Apache to crash and PHP to suspend:

a() ; function a(){return a();}

This is running EasyPHP under Vista.

How to fix?

Thanks,

P.
  Réponse avec citation
Vieux 09/02/2008, 16h23   #2
Luuk
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

PHPBABY3 schreef:
> The following PHP code causes Apache to crash and PHP to suspend:
>
> a() ; function a(){return a();}
>



what do you expect this code to do?

--
Luuk
  Réponse avec citation
Vieux 09/02/2008, 17h13   #3
ed
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

PHPBABY3 wrote:
> The following PHP code causes Apache to crash and PHP to suspend:
>
> a() ; function a(){return a();}
>
> This is running EasyPHP under Vista.
>
> How to fix?
>
> Thanks,
>
> P.


The code is recursive.

The function a has to call a to get it's return value.

It will never return.

- --
The T3 to Qwicky Mart is wigging because of burned out dilithium crystals.
The T1000 is blaming George Lucas.
:: http://www.s5h.net/ :: http://www.s5h.net/gpg.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHrd+M4dyr7s6PRYgRAgfNAJ9wvLjLO/MyOsOOJv82u9Vr82oVfQCfbirI
6GZduUj/3cOxzodp1ddIxMo=
=6HFh
-----END PGP SIGNATURE-----
  Réponse avec citation
Vieux 09/02/2008, 20h14   #4
Kees Nuyt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On Sat, 9 Feb 2008 07:59:51 -0800 (PST), PHPBABY3
<shymathguy@gmail.com> wrote:

>
>The following PHP code causes Apache to crash and PHP to suspend:
>
>a() ; function a(){return a();}


Any language would either crash on this (stack overflow),
or never finish (auto-optimized recursion to iteration).

>This is running EasyPHP under Vista.
>
>How to fix?


Add an end condition to function a() which stops the
recursion, so the nesting is limited.

It shouldn't crash Apache, it should only crash the PHP
script. The only reason I can think of is a too high
memory limit in php.ini
But that's more a comp.lang.php question.
Cross-posted to comp.lang.php and followup-to set.

>Thanks,
>
>P.

--
( Kees
)
c[_] I have a rock garden. 3 of them died last week. (#176)
  Réponse avec citation
Vieux 09/02/2008, 20h17   #5
phantom
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

"PHPBABY3" <shymathguy@gmail.com> wrote in message
news:8879c1fe-4041-40af-93ff-56b2b9036747@u10g2000prn.googlegroups.com...
>
> The following PHP code causes Apache to crash and PHP to suspend:
>
> a() ; function a(){return a();}
>
> This is running EasyPHP under Vista.
>
> How to fix?
>


Assuming your code snippet is complete, rather than a cut down (missing any
relevant detail)...
put two slashes at the start of the line -
//a() ; function a(){return a();}

or delete the line completely.


  Réponse avec citation
Vieux 09/02/2008, 22h07   #6
PHPBABY3
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On Feb 9, 3:17pm, "phantom" <nob...@blueyonder.invalid> wrote:
> "PHPBABY3" <shymath...@gmail.com> wrote in message
>
> news:8879c1fe-4041-40af-93ff-56b2b9036747@u10g2000prn.googlegroups.com...
>
>
>
> > The following PHP code causes Apache to crash and PHP to suspend:

>
> > a() ; function a(){return a();}

>
> > This is running EasyPHP under Vista.

>
> > How to fix?

>
> Assuming your code snippet is complete, rather than a cut down (missing any
> relevant detail)...
> put two slashes at the start of the line -
> //a() ; function a(){return a();}
>
> or delete the line completely.


But what about my experiment in Computability Theory?

P.



  Réponse avec citation
Vieux 10/02/2008, 10h39   #7
Kees Nuyt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On Sat, 9 Feb 2008 14:07:45 -0800 (PST), PHPBABY3
<shymathguy@gmail.com> wrote:

>On Feb 9, 3:17pm, "phantom" <nob...@blueyonder.invalid> wrote:
>> "PHPBABY3" <shymath...@gmail.com> wrote in message
>>
>> news:8879c1fe-4041-40af-93ff-56b2b9036747@u10g2000prn.googlegroups.com...
>>
>> > The following PHP code causes Apache to crash and PHP to suspend:

>>
>> > a() ; function a(){return a();}

>>
>> > This is running EasyPHP under Vista.

>>
>> > How to fix?

>>
>> Assuming your code snippet is complete, rather than a cut down (missing any
>> relevant detail)...
>> put two slashes at the start of the line -
>> //a() ; function a(){return a();}
>>
>> or delete the line completely.

>
>But what about my experiment in Computability Theory?
>
>P.


Off topic in alt.apache.configuration, but it succeeded.
You already stated the function will never return, so
there is no computable result ("mathematical proof").

What's more, you showed that PHP doesn't optimize
a() ; function a(){return a();}
out of the program.

In C the compiler should optimize it out, because
a();
isn't used anywhere.
--
( Kees
)
c[_] The amount of time between slipping on the peel and
landing on the pavement is precisely one bananosecond. (#72)
  Réponse avec citation
Vieux 10/02/2008, 14h52   #8
PHPBABY3
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On Feb 10, 5:39am, Kees Nuyt <k.n...@nospam.demon.nl> wrote:
> On Sat, 9 Feb 2008 14:07:45 -0800 (PST), PHPBABY3
>
>
>
>
>
> <shymath...@gmail.com> wrote:
> >On Feb 9, 3:17pm, "phantom" <nob...@blueyonder.invalid> wrote:
> >> "PHPBABY3" <shymath...@gmail.com> wrote in message

>
> >>news:8879c1fe-4041-40af-93ff-56b2b9036747@u10g2000prn.googlegroups.com....

>
> >> > The following PHP code causes Apache to crash and PHP to suspend:

>
> >> > a() ; function a(){return a();}

>
> >> > This is running EasyPHP under Vista.

>
> >> > How to fix?

>
> >> Assuming your code snippet is complete, rather than a cut down (missingany
> >> relevant detail)...
> >> put two slashes at the start of the line -
> >> //a() ; function a(){return a();}

>
> >> or delete the line completely.

>
> >But what about my experiment in Computability Theory?

>
> >P.

>
> Off topic in alt.apache.configuration,


How is one to know if there is a solution involving the
configuration? Maybe disable a non-essential feature and it runs into
a protected memory error instead of overwriting its own code and
crashing?

> but it succeeded.
> You already stated the function will never return, so
> there is no computable result ("mathematical proof").


To remove that possibility (a function gets in an infinite loop), you
would have to have a program tell you if your program is in an
infinite loop. Turing proved that impossible in 1937 (although PHP
wasn't that popular then.)

P.

> What's more, you showed that PHP doesn't optimize
> a() ; function a(){return a();}
> out of the program.
>
> In C the compiler should optimize it out, because
> a();
> isn't used anywhere.
> --
> ( Kees
> )
> c[_] The amount of time between slipping on the peel and
> landing on the pavement is precisely one bananosecond. (#72)- Hide quoted text -
>
> - Show quoted text -


  Réponse avec citation
Vieux 10/02/2008, 20h27   #9
Kees Nuyt
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

On Sun, 10 Feb 2008 06:52:29 -0800 (PST), PHPBABY3
<shymathguy@gmail.com> wrote:

>On Feb 10, 5:39am, Kees Nuyt <k.n...@nospam.demon.nl> wrote:
>> On Sat, 9 Feb 2008 14:07:45 -0800 (PST), PHPBABY3
>>
>> Off topic in alt.apache.configuration,

>
>How is one to know if there is a solution involving the
>configuration? Maybe disable a non-essential feature and it runs into
>a protected memory error instead of overwriting its own code and
>crashing?


I don't know of any configuration options in Apache to
limit the privileges of a program other than the userID in
which CGIs are launched and what the operating system
offers.

PHP does have some options (memory usage, timeout), but
that's off topic here.

>> but it succeeded.
>> You already stated the function will never return, so
>> there is no computable result ("mathematical proof").

>
>To remove that possibility (a function gets in an infinite loop), you
>would have to have a program tell you if your program is in an
>infinite loop. Turing proved that impossible in 1937 (although PHP
>wasn't that popular then.)


I double qouted "mathematical proof" on purpose.
Turings proof is probably meant in the general case of an
unknown program. In this case you carefully crafted an
infinite recursion on purpose. And you apparently
succeeded.

I don't think a detailed discussion on Turing etc. is on
topic in alt.apache.configuration.

As I said before, I don't know of any way to prevent
Apache crashing on this in httpd.conf, so this will
probably be my last contribution to this thread.
--
( Kees
)
c[_] Crime does not pay...as well as politics. (#356)
  Réponse avec citation
Vieux 17/04/2008, 01h19   #10
fwahdlyhq
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut fwahdlyhq

V0wwqD <a href="http://rfdcxmqlkbiu.com/">rfdcxmqlkbiu</a>,
cgpsylopjgec,
[link=http://micjvehohqci.com/]micjvehohqci[/link],
http://voaswcsnbmnx.com/

  Réponse avec citation
Vieux 24/04/2008, 17h53   #11
trdcilgmvx
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut trdcilgmvx

28xZHq <a href="http://ltfqfruojlwf.com/">ltfqfruojlwf</a>,
ckaglmyqkswz,
[link=http://zoqksorqomtk.com/]zoqksorqomtk[/link],
http://aezkyoboigpb.com/

  Réponse avec citation
Vieux 19/05/2008, 13h29   #12
vabflx
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut vabflx

uNiScV <a href="http://yscyxzspnusq.com/">yscyxzspnusq</a>,
zrpofxgriqyg,
[link=http://golmjeoryvwq.com/]golmjeoryvwq[/link],
http://lggzovtqdltn.com/

  Réponse avec citation
Vieux 20/05/2008, 02h02   #13
D. Stussy
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Infinite PHP function stack crashes Apache in Vista - Fixable?

"PHPBABY3" <shymathguy@gmail.com> wrote in message
news:8879c1fe-4041-40af-93ff-56b2b9036747@u10g2000prn.googlegroups.com...
>
> The following PHP code causes Apache to crash and PHP to suspend:
>
> a() ; function a(){return a();}
>
> This is running EasyPHP under Vista.
>
> How to fix?


You don't. Vista crashes Vista - there is no hope.


  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 09h56.


Édité par : vBulletin® version 3.7.3
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 ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,20890 seconds with 21 queries