php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #51627 script path not correctly evaluated
Submitted: 2010-04-21 23:28 UTC Modified: 2010-04-22 00:22 UTC
From: russell dot tempero at rightnow dot com Assigned: felipe (profile)
Status: Closed Package: CGI/CLI related
PHP Version: 5.3.2 OS: Linux
Private report: No CVE-ID: None
 [2010-04-21 23:28 UTC] russell dot tempero at rightnow dot com
Description:
------------
Using PHP as CGI (not FastCGI).

Pertinent php.ini values:
include_path="/home/httpd/cgi-bin/rcttrunk1.cfg/scripts:."
doc_root="/home/httpd/cgi-bin/rcttrunk1.cfg/scripts"

Path to file:
/home/httpd/cgi-bin/rcttrunk1.cfg/scripts/admin/launch.php

When I hit the following URL, I get a "file not found" error:
http://<server_name>/cgi-bin/rcttrunk1.cfg/php/admin/launch.php


Please see my patch below to fix the issue. The problem is that length is evaluating to 1, rather than string length, because of operator precedence. The solution is to wrap (length = strlen(...)) in its own set of parentheses.

Test script:
---------------
Happens for any script.

Expected result:
----------------
The page loads.

Actual result:
--------------
"File not found." Error

Patches

fopen_wrappers.c.diff (last revision 2010-04-21 21:29 UTC by russell dot tempero at rightnow dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-04-22 00:22 UTC] felipe@php.net
Automatic comment from SVN on behalf of felipe
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=298277
Log: - Fixed bug #51627 (script path not correctly evaluated)
  Patch by: russell dot tempero at rightnow dot com
 [2010-04-22 00:22 UTC] felipe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: felipe
 [2010-04-22 00:22 UTC] felipe@php.net
This bug has been fixed in SVN.

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/.
 
Thank you for the report, and for helping us make PHP better.

Thanks for the patch!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 08:01:29 2024 UTC