php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39144 curl session non-existing file:// corrupts php session
Submitted: 2006-10-13 10:08 UTC Modified: 2006-10-23 01:00 UTC
Votes:2
Avg. Score:3.0 ± 2.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: troelskn at gmail dot com Assigned:
Status: No Feedback Package: cURL related
PHP Version: 5.1.6 OS: windows xp
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-10-13 10:08 UTC] troelskn at gmail dot com
Description:
------------
Opening a curl session to non-existing file over the file:// protocol corrupts php's session handler.

Reproduce code:
---------------
<?php
session_start();
$ch = curl_init("file://C:/filedoesntexist.txt");
if ($ch != NULL) {
  $data = curl_exec($ch);
  curl_close($ch);
}
session_write_close();
exit;

Expected result:
----------------
nothing

Actual result:
--------------
Warning: session_write_close() [function.session-write-close]: write failed: Bad file descriptor (9) in C:\apache\htdocs\curltest.php on line 8
Call Stack
#	Function	Location
1	{main}()	C:\apache\htdocs\curltest.php:0
2	session_write_close ()	C:\apache\htdocs\curltest.php:8

Warning: session_write_close() [function.session-write-close]: Failed to write session data (files). Please verify that the current setting of session.save_path is correct (C:\Programmer\nusphere\phped\php5\sessions) in C:\apache\htdocs\curltest.php on line 8
Call Stack
#	Function	Location
1	{main}()	C:\apache\htdocs\curltest.php:0
2	session_write_close ()	C:\apache\htdocs\curltest.php:8


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-13 10:26 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip


 [2006-10-13 14:45 UTC] troelskn at gmail dot com
Same.
You have to hit refresh a single time to trigger the error.
 [2006-10-13 14:57 UTC] tony2001@php.net
This code doesn't produce any errors here.
In fact, it doesn't produce anything at all.
 [2006-10-14 13:01 UTC] troelskn at gmail dot com
You have to reload the page one time to trigger the error. It doesn't happen on first load.
 [2006-10-14 13:09 UTC] tony2001@php.net
That's what I did.
 [2006-10-15 09:46 UTC] troelskn at gmail dot com
My bad. I didn't update the extensions dir string in php.ini, so it still used my old php_curl.dll. I tried changing this to use the ext dir of the snapshot, and I disabled all other extensions. Now I get the following error (in apache error log) :

PHP Warning:  PHP Startup: curl: Unable to initialize module\nModule compiled with module API=20060613, debug=0, thread-safety=1\nPHP    compiled with module API=20050922, debug=0, thread-safety=1\nThese options need to match\n in Unknown on line 0

As I couldn't get the snapshot to work with php5apache2.dll, I replaced it with php5apache2_2.dll. Maybe this is the reason why curl fails ?
I'm using apache 2.2.2
 [2006-10-15 10:04 UTC] tony2001@php.net
Please make sure you've removed all .dll's from the previous PHP installation, including php5ts.dll and reinstall PHP once again.
The error message means that you're trying to load a newly compiled module with old PHP (php5ts.dll).
 [2006-10-15 10:27 UTC] troelskn at gmail dot com
I tried removing the old installation of php - still the same error.

My old installation of apache/php has the following line in httpd.conf :
LoadModule php5_module c:/apache/php5/php5apache2.dll

This doesn't work with the snapshot. I replaced it with :
LoadModule php5_module c:/apache/php5/php5apache2_2.dll

Does this make any difference ?
 [2006-10-15 10:42 UTC] tony2001@php.net
>I tried removing the old installation of php - still the same error.
Which one of the two?

>This doesn't work with the snapshot. 
"doesn't work"? I don't think I understand this..

>Does this make any difference ?
Of course it does, Apache 2.0.x and Apache 2.2.x are two different Apache versions.
 [2006-10-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 18:01:29 2024 UTC