# fopen bug (fwd)

- Thread: https://externals.io/message/2060
- Original archive: https://news-web.php.net/php.internals/2060
- Started by ohp@pyrenet.fr on 2003-05-28T13:35:46+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #2060 — ohp@pyrenet.fr — 2003-05-28T13:35:46+00:00

URL: https://externals.io/message/2060#2060

This a resent of my yesterday message (can't remember if I got it myself)
Could one of the developpers help me with this patch I'm not so sure
about.

I'm willing to help on this long standing bug.

Regards,

-- 
Olivier PRENANT         	Tel:	+33-5-61-50-97-00 (Work)
Quartier d'Harraud Turrou           +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                      +33-6-07-63-80-64 (GSM)
FRANCE                      Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)

---------- Forwarded message ----------
Date: Tue, 27 May 2003 16:52:11 +0200 (MET DST)
From: ohp@pyrenet.fr
To: PHP developpers <internals@lists.php.net>
Subject: fopen bug

Hi everey one.

I've been hit by the fopen bug 21958 very badly so I decided to have a
look and came with this pch against 4.3.2RC4 safe_mode.c

Problem is no matter the permissions, you can't create a file with fopen
uner safe_mode on
My system is unixware 7.3.1 and php is an apache 1.3.27 module.

Can someone review this and tell me if it's ok. (it works for me)

*** main/safe_mode.c.orig	lun mrs 17 14:50:23 2003
--- main/safe_mode.c	mar mai 27 15:06:30 2003
***************
*** 66,71 ****
--- 66,72 ----
  			mode = CHECKUID_DISALLOW_FILE_NOT_EXISTS;
  		} else {
  			mode = CHECKUID_CHECK_FILE_AND_DIR;
+ 			flags=1;
  		}
  	}

***************
*** 81,86 ****
--- 82,88 ----
  	 * If that fails, passthrough and check directory...
  	 */
  	if (mode != CHECKUID_ALLOW_ONLY_DIR) {
+ 		strcpy(path,filename);
  		VCWD_REALPATH(filename, path);
  		ret = VCWD_STAT(path, &sb);
  		if (ret < 0) {

TIA
-- 
Olivier PRENANT         	Tel:	+33-5-61-50-97-00 (Work)
Quartier d'Harraud Turrou           +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                      +33-6-07-63-80-64 (GSM)
FRANCE                      Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)

---

## #2066 — Wez Furlong — 2003-05-28T14:01:28+00:00

URL: https://externals.io/message/2060#2066 · In reply to: #2060

Please paste the patch into your bug report and someone will look at
including it in 4.3.3 or 4.4 or whatever the next release will be (too
late for this to be in 4.3.2).

--Wez.



> This a resent of my yesterday message (can't remember if I got it myself)
> Could one of the developpers help me with this patch I'm not so sure
> about.
>
> I'm willing to help on this long standing bug.
>
> Regards,
>
> --
> Olivier PRENANT         	Tel:	+33-5-61-50-97-00 (Work)
> Quartier d'Harraud Turrou           +33-5-61-50-97-01 (Fax)
> 31190 AUTERIVE                      +33-6-07-63-80-64 (GSM)
> FRANCE                      Email: ohp@pyrenet.fr
> ------------------------------------------------------------------------------
> Make your life a dream, make your dream a reality. (St Exupery)
>
> ---------- Forwarded message ----------
> Date: Tue, 27 May 2003 16:52:11 +0200 (MET DST)
> From: ohp@pyrenet.fr
> To: PHP developpers <internals@lists.php.net>
> Subject: fopen bug
>
> Hi everey one.
>
> I've been hit by the fopen bug 21958 very badly so I decided to have a
> look and came with this pch against 4.3.2RC4 safe_mode.c
>
> Problem is no matter the permissions, you can't create a file with fopen
> uner safe_mode on
> My system is unixware 7.3.1 and php is an apache 1.3.27 module.
>
> Can someone review this and tell me if it's ok. (it works for me)
>
> *** main/safe_mode.c.orig	lun mrs 17 14:50:23 2003
> --- main/safe_mode.c	mar mai 27 15:06:30 2003
> ***************
> *** 66,71 ****
> --- 66,72 ----
>   			mode = CHECKUID_DISALLOW_FILE_NOT_EXISTS;
>   		} else {
>   			mode = CHECKUID_CHECK_FILE_AND_DIR;
> + 			flags=1;
>   		}
>   	}
>
> ***************
> *** 81,86 ****
> --- 82,88 ----
>   	 * If that fails, passthrough and check directory...
>   	 */
>   	if (mode != CHECKUID_ALLOW_ONLY_DIR) {
> + 		strcpy(path,filename);
>   		VCWD_REALPATH(filename, path);
>   		ret = VCWD_STAT(path, &sb);
>   		if (ret < 0) {
>
> TIA
> --
> Olivier PRENANT         	Tel:	+33-5-61-50-97-00 (Work)
> Quartier d'Harraud Turrou           +33-5-61-50-97-01 (Fax)
> 31190 AUTERIVE                      +33-6-07-63-80-64 (GSM)
> FRANCE                      Email: ohp@pyrenet.fr
> ------------------------------------------------------------------------------
> Make your life a dream, make your dream a reality. (St Exupery)

---

## #2070 — ohp@pyrenet.fr — 2003-05-28T17:29:50+00:00

URL: https://externals.io/message/2060#2070 · In reply to: #2066

Done,

Hope someone will have a look.

Regards


> Date: Wed, 28 May 2003 15:01:28 +0100 (BST)
> From: Wez Furlong <wez@thebrainroom.com>
> To: ohp@pyrenet.fr
> Cc: PHP developpers <internals@lists.php.net>
> Subject: Re: [PHP-DEV] fopen bug (fwd)
>
> Please paste the patch into your bug report and someone will look at
> including it in 4.3.3 or 4.4 or whatever the next release will be (too
> late for this to be in 4.3.2).
>
> --Wez.
>
> 
>
> > […]
>

-- 
Olivier PRENANT         	Tel:	+33-5-61-50-97-00 (Work)
Quartier d'Harraud Turrou           +33-5-61-50-97-01 (Fax)
31190 AUTERIVE                      +33-6-07-63-80-64 (GSM)
FRANCE                      Email: ohp@pyrenet.fr
------------------------------------------------------------------------------
Make your life a dream, make your dream a reality. (St Exupery)
