php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14999 apache_lookup_uri returning array for apache2 instead of object
Submitted: 2002-01-11 12:59 UTC Modified: 2002-05-17 02:32 UTC
From: pete at ana dot sk Assigned:
Status: Closed Package: Apache2 related
PHP Version: 4.2.1 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pete at ana dot sk
New email:
PHP Version: OS:

 

 [2002-01-11 12:59 UTC] pete at ana dot sk
this is simple: apache_lookup_uri is returning array on apache2 instead of object (as it is doing on apache 1.3 and as it is written in documentation). the array is filled good with right keys and values, only problem is that it is array and not object

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-23 17:36 UTC] manu@php.net
The Apache request_rec struct has many change between version 1.3 and 2.0. perhaps we should rename this fonction in apache2_lookup_uri

for example the byterange has desapear

here is the patch to be more compatible with apache 1.3 version  

PHP_FUNCTION(apache_lookup_uri)
{
        pval **filename;
        request_rec *rr=NULL;

        rr = php_apache_lookup_uri(INTERNAL_FUNCTION_PARAM_PASSTHRU);
        if (!rr)
                WRONG_PARAM_COUNT;

        object_init(return_value);
        add_property_long(return_value,"status", rr->status);
        if (rr->the_request) {
                add_property_string(return_value,"the_request", rr->the_request, 1);
        }
        if (rr->status_line) {
                add_property_string(return_value,"status_line", (char *)rr->status_line, 1);            
        }
        if (rr->method) {
                add_property_string(return_value,"method", (char *)rr->method, 1);              
        }
        if (rr->content_type) {
                add_property_string(return_value,"content_type", (char *)rr->content_type, 1);
        }
        if (rr->handler) {
                add_property_string(return_value,"handler", (char *)rr->handler, 1);            
        }
        if (rr->uri) {
                add_property_string(return_value,"uri", rr->uri, 1);
        }
        if (rr->filename) {
                add_property_string(return_value,"filename", rr->filename, 1);
        }
        if (rr->path_info) {
                add_property_string(return_value,"path_info", rr->path_info, 1);
        }
        if (rr->args) {
                add_property_string(return_value,"args", rr->args, 1);
        }
        if (rr->range) {
                add_property_string(return_value,"range",(char *)rr->range, 1);
        }
        if (rr->boundary) {
                add_property_string(return_value,"boundary",(char *)rr->boundary, 1);
        }
        add_property_long(return_value,"no_cache", rr->no_cache);
        add_property_long(return_value,"no_local_copy", rr->no_local_copy);
        add_property_long(return_value,"allowed", rr->allowed);
        add_property_long(return_value,"sent_bodyct", rr->sent_bodyct);
        add_property_long(return_value,"bytes_sent", rr->bytes_sent);
        add_property_long(return_value,"clength", rr->clength);

#if MODULE_MAGIC_NUMBER >= 19980324
        if (rr->unparsed_uri) {
                add_property_string(return_value,"unparsed_uri", rr->unparsed_uri, 1);
        }
        if(rr->mtime) {
                add_property_long(return_value,"mtime", rr->mtime);
        }
#endif
        if(rr->request_time) {
                add_property_long(return_value,"request_time", rr->request_time);
        }
        ap_destroy_sub_req(rr);
}
















 [2002-02-18 12:49 UTC] manu@php.net
What about this patch ?
has someone try it ?
what is the way of apache2 fonction ? 
keep the maximum of backwards compatibility ?

 [2002-05-17 02:32 UTC] jwoolley@php.net
This bug has been fixed in CVS. You can grab a snapshot of the
CVS version at http://snaps.php.net/. In case this was a documentation 
problem, the fix will show up soon at http://www.php.net/manual/.
In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites.
Thank you for the report, and for helping us make PHP better.

I committed a variant of your patch.  Same idea, just done with the existing macros to reduce diff (and code) verbosity.  I had to account for the fact that rr->request_time and rr->mtime are apr_time_t's (microseconds) now rather than time_t's (seconds) as well.  It should now be the case that the only difference between apache 2.0's apache_lookup_uri() and apache 1.3's are the missing byterange and boundary fields (boundary just now disappeared as of 2.0.37).  Is it worth having those in there with wrong (zero) values?  Or should we just leave them out and document that they're gone?  Send me an email if you have an opinion on the matter.  Thanks!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 08:01:28 2024 UTC