Re: Change in 5.2.1 re. parsing of URL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, February 19, 2007 10:20 am, Lewis Kapell wrote:
> There seems to be a behavior change introduced in 5.2.1 and I would
> like
> to know if it was deliberate.
>
> A couple of years ago, PHP introduced functionality that made it
> possible to use a certain trick.  I don't know how to describe this
> trick in words, so I will illustrate with an example.
>
> http://www.mydomain.com/mypage.php/phonypage.pdf
>
> In this example there is a PHP script called mypage.php which serves
> up
> a PDF.  Putting the extra text at the end of the URL makes it appear
> to
> the user's browser that the URL ends with '.pdf' rather than '.php'.
> We
> introduced this hack at my company because a few users were unable to
> view pages containing PDF or RTF content, presumably because of some
> combination of browser and/or firewall settings.
>
> I find that version 5.2.1 breaks this behavior - attempting to visit a
> URL such as the above produces a 'page not found' error.  Presumably
> because it is trying to find the file 'phonypage.pdf' which doesn't
> exist.
>
> My question is, should this be regarded as a bug which might be fixed?
> Or is this a deliberate change of behavior?

It seems MUCH more likely to be a webserver configuration issue, as
PHP has no control over what you are describing, really.

The web server chooses to invoke PHP, or not, based on web server
configuration.

Not aware of any way to mess this one up, mind you, but there it is...

So check your httpd.conf (or whatever IIS uses) settings.

BTW:
There was at least ONE browser way back in time, where the trick you
are using never worked anyway.

While I doubt that anybody on the planet is still using said browser
(we're talking a version 4.x minor IE release, I believe...) you may
want to consider the second half of this rant:
http://richardlynch.blogspot.com

So your URLs will just look like:
http://example.com/mypage.pdf
and the browser cannot POSSIBLY mess up because as far as the browser
can tell, it's just a static PDF file it is getting [*].

For example, this PDF:
http://uncommonground.com/events.pdf
is generated by this code:
http://uncommonground.com/events_pdf.phps
and it is just as dynamic as the HTML calendar, from which it springs:
http://uncommonground.com/events.htm

Some day I plan on combining the two scripts into one, actually, as
they are really mostly the same...  But that's been on my "ToDo" list
for many years now, and is unlikely to get done RSN.

* To be pedantic, I should say that the browser cannot screw up any
more than it would for a static PDF, as it could still manage to screw
up quite a few things even with that... :-(

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux