Make WordPress Core

Opened 20 years ago

Closed 20 years ago

Last modified 6 years ago

#185 closed defect (bug) (fixed)

wp-login.php segfaults Apache with PHP5.0.1-dev

Reported by: jonathan-stanley's profile Jonathan Stanley Owned by: matt's profile matt
Milestone: Priority: normal
Severity: critical Version:
Component: General Keywords:
Focuses: Cc:


When using the current WP 1.3-CVS under PHP5.0.1-dev with Apache-SSL1.3.29, wp-login.php is non-functional as discussed here:

Upon further digging, the Apache process will actually crash (other processes remain OK however) but there is nothing regarding what PHP error was actually encountered.

The function appears to be broken in both the login and logout context as the quirk exists in both situations.

Attachments (2)

0000185-wp-login.php (10.6 KB) - added by Jonathan Stanley 19 years ago.
0000185-wp-login.php.diff (3.3 KB) - added by Jonathan Stanley 19 years ago.

Download all attachments as: .zip

Change History (32)

#1 @Jonathan Stanley
20 years ago

Either attempt a login or logout. The majority of cases will just see the last page being reloaded again.

#2 @lucidix
20 years ago

Finally! Someone who can confirm the same problem.

A little foreword: My company is developing a rather complicated web application. Several tiers of abstraction, a lot of dynamic includes, plenty of singleton and factory design patterns. With PHP5 being released we wanted to "port" our app to it. The exceptions alone make it worth it for us. One of our developers started testing the app on a Win XP, Apache 2.0.50, MySQL 4.0.20, PHP5.0.0. It worked flawlessly.

Then we upgraded our Linux dev server and all hell broke loose. Tons of seg faults, especially when we used header() to redirect. if we replaced the header with an echo() followed by an exit(); it would actually work. sometimes.

Our problem was that we couldn't show our code to anybody (it is proprietary, after all), but it seemed nobody else's code showed the same symptoms. Everything else we tried to put on the server ran fine. from phpbb to coppermine photo album.

Until I decided to post in my (mostly useless and ugly to look at) personal blog. I wanted to log in, and whaddayaknow. The same problem. An unhandled exception.

So I turned on debugging, and ran apache through gdb (i couldn't get it to dump core).

Here's the problem with wp-login.php:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 14262)]
0x40754cf4 in _zval_ptr_dtor (zval_ptr=0x82bf7f8,

zend_filename=0x407e0e20 "/usr/local/src/php-5.0.0/Zend/zend_execute.c", zend_lineno=207)
at /usr/local/src/php-5.0.0/Zend/zend_execute_API.c:389

389 (*zval_ptr)->refcount--;

(gdb) bt

#0 0x40754cf4 in _zval_ptr_dtor (zval_ptr=0x82bf7f8,

zend_filename=0x407e0e20 "/usr/local/src/php-5.0.0/Zend/zend_execute.c", zend_lineno=207)
at /usr/local/src/php-5.0.0/Zend/zend_execute_API.c:389

#1 0x40794901 in zend_switch_free (opline=0x83dea80, Ts=0x82bf1dc)

at /usr/local/src/php-5.0.0/Zend/zend_execute.c:207

#2 0x40790729 in zend_switch_free_handler (execute_data=0xbfffd300, opline=0x83dea80,

op_array=0x82bf130) at /usr/local/src/php-5.0.0/Zend/zend_execute.c:3227

#3 0x4078acc4 in execute (op_array=0x82bf130) at /usr/local/src/php-5.0.0/Zend/zend_execute.c:1391
#4 0x4078edd5 in zend_do_fcall_common_helper (execute_data=0xbfffd3f0, opline=0x83a6174,

op_array=0x8323a64) at /usr/local/src/php-5.0.0/Zend/zend_execute.c:2728

#5 0x4078f2ef in zend_do_fcall_by_name_handler (execute_data=0xbfffd3f0, opline=0x83a6174,

op_array=0x8323a64) at /usr/local/src/php-5.0.0/Zend/zend_execute.c:2810

#6 0x4078acc4 in execute (op_array=0x8323a64) at /usr/local/src/php-5.0.0/Zend/zend_execute.c:1391
#7 0x407636df in zend_execute_scripts (type=8, retval=0x0, file_count=3)

at /usr/local/src/php-5.0.0/Zend/zend.c:1061

#8 0x40716310 in php_execute_script (primary_file=0xbffff780)

at /usr/local/src/php-5.0.0/main/main.c:1627

#9 0x40797c1e in apache_php_module_main (r=0x815c834, display_source_mode=0)

at /usr/local/src/php-5.0.0/sapi/apache/sapi_apache.c:54

#10 0x40798c85 in send_php (r=0x815c834, display_source_mode=0,

filename=0x815e444 "/home/marcus/public_html/")
at /usr/local/src/php-5.0.0/sapi/apache/mod_php5.c:622

#11 0x40798d0a in send_parsed_php (r=0x815c834)

at /usr/local/src/php-5.0.0/sapi/apache/mod_php5.c:637

#12 0x08053ab4 in ap_invoke_handler ()
#13 0x0806342c in ap_some_auth_required ()
#14 0x08063488 in ap_process_request ()
#15 0x0805cc6b in ap_child_terminate ()
#16 0x0805cdfc in ap_child_terminate ()
#17 0x0805cf19 in ap_child_terminate ()
#18 0x0805d3f5 in ap_child_terminate ()
#19 0x0805dafd in main ()
#20 0x400f4da6 in libc_start_main () from /lib/

What does all that mean? Well, I'm not sure. My guess is, it's got something to do with the reference counting mechanism in php5.

Our web application dies on the same (389 (*zval_ptr)->refcount--;) line. Among a few others.

Again, oddly enough, our web application works without a hitch on WinXP. I have not yet tried WordPress on WinXP. Would be great if someone could report on that.

#3 @lucidix
20 years ago

Just checked with the latest CVS snapshot from an hour ago. Wordpress' logging in functionality works now. All fixed.

Wish I could say the same for our company's app.

#4 @Jonathan Stanley
20 years ago

I just checked out 1.3-CVS, still broken for me.

#5 @lucidix
20 years ago

I apologize, my previous note was not very clear at all. I was referring to the latest CVS of PHP, not Wordpress.

#6 @Jonathan Stanley
20 years ago

Oh right... hmm, just tried both PHP5.1.0-dev and PHP5.0.1-dev from CVS and login is still broken.

#7 @lucidix
20 years ago

I used php5-200407242230.tar.bz2. Are you running it on Windows or Linux?

#8 @Jonathan Stanley
20 years ago

As per original report, Debian 3.0r2, kernel 2.4.x

Incidently, the snaphots from for 5.x appears to have switched to 5.1.0-dev, so for now till they update the snapshots site, getting 5.0.x-dev will have to be gotten via CVS manually.

#9 @anonymousbugger
20 years ago

I can confirm this. The 2004-07-28 Wordpress Nightly Snapshot crashes Apache running PHP5.0.0-final on Windows XP when calling wp-login.php

edited on: 07-29-04 08:06

#10 @Jonathan Stanley
20 years ago

Updated from CVS for both PHP5.0.x and WP1.3.x as of today (4th Aug) and the seg-fault issues appears to have gone for now...

Would be nice if others can confirm what I'm seeing?

#11 @Brak
20 years ago


However, it's on the PHP end, not the the Wordpress end.

I first upgraded to Wordpress current (4th august) and it still segfaulted. Then I upgraded to PHP 5.0.x-dev (6th august) and it's now working.

#12 @jeffiel
20 years ago

I can still confirm the existence of this bug. My details are:

PHP 5.0.1 release (not CVS)
wordpress-2004-08-26 (nightly build)

There seem to be a lot of conflicting reports about how this bug is eliminated (nightly here, cvs there, etc.) If anybody has some clarity, I'd love to hear it. Thanks!


edited on: 08-29-04 23:29

#13 @anonymousbugger
20 years ago

I can confirm the bug.

I use:
Apache/2.0.50 (Gentoo/Linux)
WordPress 30-08-2004

#14 @anonymousbugger
20 years ago

This problem also occurs with PHP5.0.1 running on Windows 2003. However, it states that there is an access violation. Reloading the pages, produces a different access violation, and further reloading sometimes works. Running 09-08 nightly build of WP 1.3.

#15 @anonymousbugger
20 years ago

Same problem in Wordpress CVS 2004-09-15 with PHP 5.0.1 and Apache 2.0.51

#16 @skithund
20 years ago

FYI, I stripped down the wp-login.php code to a minimum and opened a PHP bug for it.

Edit: And it seemed to be a duplicate of another bug ;)

edited on: 09-18-04 16:46

#17 @Jonathan Stanley
20 years ago

Just, seems to be a duplicate of and apparently fixed in PHP5.1.x-dev... so with a bit of luck, will get backported to 5.0.x soon.

#18 @skithund
20 years ago

Added wp-login.php.diff, which moves login() and checklogin() functions out of switch(). This patch works for me (PHP 5.0.1).

#19 @anonymousbugger
20 years ago

I have the most recent nightly download of WP ( 09.18 ) I am running windows 2003, iis6, PHP 5.01 and MySQL 4.0.13. I can confirm the login and logout problem. I can also confirm that at times other errors. Below is a list of error I experience and posted over at WP:

Fatal error: Cannot redeclare shutdown_action_hook() (previously declared in D:\web.sites\beach\www\wp-settings.php:86) in D:\web.sites\beach\www\wp-settings.php on line 87

when I go to http://www.beachblog - if I refresh a few times..

PHP has encountered an Access Violation at 01765C29
Fatal error: Cannot redeclare shutdown_action_hook() (previously declared in D:\web.sites\beach\www\wp-settings.php:86) in D:\web.sites\beach\www\wp-settings.php on line 87
PHP has encountered an Access Violation at 0176B0B7

I just wanted to add my 2cents.

Kind regards,

#20 @anonymousbugger
20 years ago

Haaaa, moving the functions out of the switch structure fixed it, thank you skithund :) [Apache 2.0.50, PHP 5.0.1, Windows 2000 Professional]

#21 @cvk
20 years ago

I'm running wordpress-2004-09-14 on Apache 2.0.50/PHP 5.0.1/RHL9. I got the segfaults too, so I moved the login() and checklogin() function declarations to the top of wp-login.php as skithund suggested. All is well now; there are no segfaults anymore.

#22 @anonymousbugger
20 years ago

Seems as though there are more answers here then on WP itself. Any suggestions for IIS? What exactly was the change? I tried moving the login case section above the logout case section. Nothing changed. Can someone please provide more specific details for a tryable fix?

Kind regards,

edited on: 09-21-04 16:25

#23 @cvk
20 years ago

There are two functions declared in a switch statement in wp-login.php. Moving those two function declarations out of the switch statement and to the top of the file (or bottom, or other places) will prevent the segfault for PHP 5.0.1.

(These line numbers refer to the nightly build in wordpress-2004-09-19.tar.gz. Yours might be on different lines.)

The first function, login(), is declared on lines 77-111.

The second, checklogin(), is declared on lines 243-253.

Those two chunks of code should be moved to the top of wp-login.php. I'll include my edited file for reference: wp-login.php, 10,877 bytes.

#24 @anonymousbugger
20 years ago


I see what you did now, thanks.. I actually pulled the case login as explained above. Well, I implemented those changes and what do you know.. it works.. it actually works.. ( at first glance ) Nice Troubleshooting!!!

Since I cannot seem to get any answers from WP forums on this might someone check this out:

Seems as though no one has really come up with a solid answer as if this is a problem or... suggest a solution or some insight as to why it is happening. If there is a bug post somewhere here.. please let me know.

Kind regards,

#25 @cvk
20 years ago

Glad it's working for you now!

This is a problem with PHP 5.0.x, not with WordPress. The next stable release of PHP (5.1.x?) won't crash on conditional functions, according to this post in the PHP bugtracking system:

For now, this workaround fits the bill, but I don't think it should become a part of the WordPress code since WordPress isn't broken.

Thanks, skithund, for discovering a fix.

#26 @anonymousbugger
20 years ago

Here with php 5.0.2 the problem isn't fixed :(

#27 @Jonathan Stanley
20 years ago

Please read the previous comments. It's fixed (or rather appears to have been a non-issue) in PHP 5.1.x-dev, but given the various timeframes for freezing of PHP 5.0.x(-dev), it's unlikely that the PHP bug will be fixed till at least PHP 5.0.3.

But in the meantime, if this bug affects/affected you, then vote for the bug to get PHP fixed...

#28 @anonymousbugger
20 years ago

This should be fixed now. Try out the latest nightly.

#29 @matt
20 years ago

  • Owner changed from anonymous to matt
  • Resolution changed from 10 to 20
  • Status changed from new to closed

Checked on 5.0 and 5.01. Closing.

This ticket was mentioned in Slack in #core-editor by essamamdani. View the logs.

6 years ago

Note: See TracTickets for help on using tickets.