php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15267 "declare" makes apacke crashes under Windows.
Submitted: 2002-01-28 22:44 UTC Modified: 2004-01-20 08:47 UTC
Votes:4
Avg. Score:3.2 ± 0.4
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:3 (75.0%)
From: ferguson at becon dot org Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.2.3 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ferguson at becon dot org
New email:
PHP Version: OS:

 

 [2002-01-28 22:44 UTC] ferguson at becon dot org
Apache crashes, burns and dies when i copy and paste the first ?declare? example in the php documentation....

dont ask me why it is happening. I am having troubles learning how to use declare and ticks. may be declare or ticks is not causing the problem.... beats the heck out of me.

php4.0.6 did the same thing with apache 1.3.20, but when i upgraded to apache 1.3.22, it caused and internal server error. After i updated my php to the current version, apache decided it liked to crash and burn better.

It might be good idea to update the documentation to a different example, one that does not crash.... just a thought. I know it might not be possible.

The source code is as follows:

<pre>
<?php
// A function that records the time when it is called
function profile ($dump = FALSE)
{
    static $profile;

    // Return the times stored in profile, then erase it
    if ($dump) {
        $temp = $profile;
        unset ($profile);
        return ($temp);
    }

    $profile[] = microtime ();
}

// Set up a tick handler
register_tick_function("profile");

// Initialize the function before the declare block
profile ();

// Run a block of code, throw a tick every 2nd statement
declare (ticks=2) {
    for ($x = 1; $x < 50; ++$x) {
        echo similar_text (md5($x), md5($x*$x)), "&lt;br&gt;";
    }
}

// Display the data stored in the profiler
print_r (profile (TRUE));
?>
</pre>

good luck...

Brendan

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-28 23:02 UTC] yohgaki@php.net
It seems this is fixed. 
Your script does not crash on my Linux

Please reopen if you still have problem with 4.2.0-dev.
(It may be win spcific problem?)
 [2002-01-29 08:54 UTC] ferguson at becon dot org
It most defiantly does crash and burn! Unlike planes, apache does not like to stay down. It tries to start itself back up, but is shot time crashes again. After many tries, Apache eventually gets tired of this and decides not to display the page.

It most defiantly does crash and burn! Unlike planes, apache does not like to stay down. It tries to start itself back up, but is shot time crashes again. After many tries, Apache eventually gets tired of this and decides not to display the page.

Php 4.06 -apache 1.3.20 cashes 
php 4.06 -apache 1.3.22 internal server error
php 4.1.1-apache 1.3.22 crashes
everything else         dont know

I am not sure if it matters, but i am using php as an sapi.

Brendan
 [2002-01-29 20:46 UTC] yohgaki@php.net
It seems windows have this problem while linux does not.
reopenned.

Apache 1.3.22
PHP 4.1.1/Apache SAPI
 [2002-05-28 12:01 UTC] edink@php.net
Confirmed bug is alive and well:

Apache 1.3.24
PHP 4.2.1
 [2002-08-25 18:14 UTC] edink@php.net
The bug is still there. And 4.2.1 is hardly too old.
 [2002-08-28 15:09 UTC] ferguson at knightsweb dot net
b/c i dont know how to use ticks i am not exactly sure what the problem is but i think i have narrowed it down to something with declare or register_tick_function. when one of them is commented out, it does not crash but when they are both there, it does crash.

Something to keep in mind is when the contents of registered tick function or the contents of declare are completely removed, the crash does not occur. with declare even the brackets cant be there.

Knight
 [2002-09-03 12:24 UTC] kevin at hatry dot com
same bug with php 4.2.2 on Windows XP Professionnal running apache and php as a module : the code in the php documentation crashes apache unless i comment either the register_tick_function line or the whole code in the declare statement. it does the same with a simpler code (echo $x) in the declare statement as well. Commenting only the code in the function 'profile' doesn't stop apache from crashing though.
it's a pity because i wanted to try it looks nice to use ...
 [2002-09-26 19:21 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2002-11-13 01:04 UTC] fredchou at free dot fr
I installed PHP Version 4.2.4-dev.

This bug has not been fixed yet ! I should perhaps update my Apache version ? (1.3.24)
 [2002-11-18 13:47 UTC] junkie at overdoos dot org
having the same problem.. 
tried it on combinations of win2k with apache 1.3.22 and php as sapi with versions 4.2.2 , 4.2.3 and 4.4.0-dev 
and tried it with apache 2.0.43 with 4.4.0-dev too

crashes an apache thread (probably) with a memory fault .. couldnt read from address 0x0etc . server does keep running though.

when commenting //register_tick_function() it works fine. 
even leaving declare(ticks=1) {......} in tact.

Vincent.
 [2004-01-20 02:47 UTC] neophitostheodorou at hotmail dot com
The same problem  occures when using php 5.0.0b3 with apache server 2.0.48 under Windows XP. It seems that the problem is caused by the declare statement. Propably it's not a problem of the documentation example because I used a similar example found in a book and the same error occured.
 [2004-01-20 08:47 UTC] ferguson at becon dot org
Should the documentation not mention that for months (if not years) this problem has existed and if you are trying to use declare on windows95/98/me/xp you WILL fail? At the very least the documentation should say that the declare on windows is flaky. This however, would be an outright lie because it is not flaky, it does not work period! Not only does it not work, it causes apache to crash a lot of the time. It also causes fatal errors.

Why has is been closed when the problem is still existent and plaguing PHP? Please re-open.

As another note, it may not be declare. register_tick_function also causes it to crash in the same manor.

Brendan
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 16:01:27 2024 UTC