php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #67393 Internal server error with DIRECTORY_SEPARATOR
Submitted: 2014-06-06 14:52 UTC Modified: 2014-12-30 10:42 UTC
From: sherif dot onion at gmail dot com Assigned:
Status: No Feedback Package: Reproducible crash
PHP Version: 5.6.0beta4 OS: Debian Linux
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: sherif dot onion at gmail dot com
New email:
PHP Version: OS:

 

 [2014-06-06 14:52 UTC] sherif dot onion at gmail dot com
Description:
------------
A class that has DIRECTORY_SEPARATOR listed in a declared array causes internal server error.

Actually version 5.6.0beta3 (no option in drop down for this - but cannot find similar issue reported/fixed, so assume still present in 5.6.0beta4.



Test script:
---------------
<?php
class e {
        protected $options = array(
                'separator'       => DIRECTORY_SEPARATOR
        );
}




Actual result:
--------------
The sample code will always produce an internal server error for me:
(Just including the file with this code in is enough).

Here's what the log looks like: 
[Fri Jun 06 15:30:54.040993 2014] [fcgid:warn] [pid 19647] (104)Connection reset by peer: [client x.x.x.x] mod_fcgid: error reading data from FastCGI server
[Fri Jun 06 15:30:54.041048 2014] [core:error] [pid 19647] [client x.x.x.x] End of script output before headers: test2.php

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-06-07 14:45 UTC] tyrael@php.net
I can't reproduce the issue, does it also happen when including the test script from cli, or only through the fastcgi/fpm sapi? (albeit I have no idea how could this be affected by the SAPI).
 [2014-06-07 14:45 UTC] tyrael@php.net
-Status: Open +Status: Feedback
 [2014-06-07 18:55 UTC] sherif dot onion at gmail dot com
-Status: Feedback +Status: Open
 [2014-06-07 18:55 UTC] sherif dot onion at gmail dot com
Should have said - this occurs under apache web-server (not cli):

apache2 version 2.4.9-1
architecture amd64

I have replicated on another Debian Testing system (that one is running PHP 5.5.12+dfsg), however after some fiddling new information has come to light: 
I was using ISP config to manage the hosting and that was creating the apache vhost configs with suexec/suphp.
If I simply create a 'vanilla' virtualhost without suexec and include the code in a file (i.e. test.php) and navigate to that URL it works, if I use a site created with ISPConfig I get 500 - Internal Server Error.
I should stress at this point that EVERYTHING else works fine on the ISPCOnfig generated site (I have been using the same site set up for over 3 years).

The difference between the site that errors and the one that does not is this (in the apache virtualhost config for the site):


    # suexec enabled
    <IfModule mod_suexec.c>
     SuexecUserGroup web1 client1
    </IfModule>
    # Clear PHP settings of this website
    <FilesMatch "\.ph(p3?|tml)$">
        SetHandler None
    </FilesMatch>
    # suphp enabled
    <Directory /var/www/test>
                <IfModule mod_suphp.c>
        suPHP_Engine on
        # suPHP_UserGroup web1 client1
        suPHP_ConfigPath /var/www/conf/web1
        AddHandler x-httpd-suphp .php .php3 .php4 .php5
        suPHP_AddHandler x-httpd-suphp
                </IfModule>
    </Directory>


I am not an expert on suexec - so not sure if there is something a bit flakey in the config - but the same config is running everything else fine (I mean a codebase with 1000's of files) the issue is only with the few lines of code (actually part of a 3rd party product elfinder).

As a workaround - I have patched the elfinder code from 
'separator'       => DIRECTORY_SEPARATOR
to
'separator'       => '/'
which stopped the errors.

Hope that helps....
 [2014-07-02 08:07 UTC] tyrael@php.net
-Status: Open +Status: Feedback
 [2014-07-02 08:07 UTC] tyrael@php.net
could you check that you have any relevant info in your apache/php error logs?
I can't really think anything which could cause an issue like this.
And given that the problem seems to happen with suexec/suphp, I start to think that maybe the problem is lies with them.

btw. the original author of suphp EOLed the project for a while now, so https://lists.marsching.com/pipermail/suphp/2013-May/002554.html and it seems that debian testing not provides the suphp packages: https://packages.debian.org/search?keywords=libapache2-mod-suphp
could you tell me what debian version where you using when reproducing the bug?
 [2014-12-30 10:42 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 09:01:26 2024 UTC