PHP Crash in file_get_contents

PHP Crash in file_get_contents

am 27.08.2009 20:50:29 von Seth Hill

--001636b2aea29cece10472240a04
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Hello all,
I'm experiencing a curious error that I'm hoping someone can help with.

I am using file_get_contents() with Google Maps Geocoding to retrieve
information about an address. The URL that I'm requesting looks like:
http://maps.google.com/maps/geo?q=[Search Subject]&key=[google maps
key]&sensor=false&output=json&oe=utf8

If I pass a space (0x20) in the search subject, I get a 400 error back (as
it should be). However, the next request to the site crashes PHP.

I can reproduce it as part of my whole site (which runs a custom framework),
but I've been unable to come up with a single PHP file that will duplicate
the problem.

I am running PHP under IIS6 on a Windows 2003 Web Edition server. I have
seen this with PHP 5.1.1 and PHP 5.2.5 using the ISAPI dll. Thinking that it
was a known bug, I upgraded, but I still see it on PHP 5.2.10 with
FastCGI. With ISAPI I get a "PHP Access Violation" message until I recycle
the app pool, with FastCGI I get an equivalent message (except with FastCGI
I don't have to manually restart anything).

This is the stack trace:

Function Arg 1 Arg 2 Arg 3 Source
php5!_zend_mm_realloc_int+357 00223ea0 0274ab98 00000008
php5!_erealloc+2e 0274ab98 00000008 00000000
php5!php_stream_wrapper_log_error+49 1044b458 00000004 10333244
php5!php_stream_url_wrap_http_ex+1f17 1044b458 027a2bb8
102a3780 php5!php_stream_url_wrap_http+27 1044b458 027a2bb8
102a3780 php5!_php_stream_open_wrapper_ex+aa 027a2bb8 102a3780
00000000 php5!zif_file_get_contents+e2 00000001 0274a9e8
00000000 php5!zend_do_fcall_common_helper_SPEC+6d7 00c0a45c
00c0a2e8 0000000c php5!ZEND_DO_FCALL_SPEC_CONST_HANDLER+df
00c0a45c 027492a4 0274912c php5!execute+12e 02749af8
00c0a518 00000028 php5!zend_do_fcall_common_helper_SPEC+796
00c0aa64 10018e9e 00c0aa64
php5!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER+10 00c0aa64 027a2cbc
0274a9bc php5!execute+12e 0178e668 00c0ab40 00000030
php5!ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER+332 0178e668 0178e3b4
0178e53c php5!execute+12e 0178b368 00c0cba8 00000000
php5!ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER+2d1 0178b368 00c0cbac
00000000 php5!execute+12e 0178b100 00000000 00c0fee0
php5!zend_execute_scripts+c8 00000008 00000000 00000003
php5!php_execute_script+1c0 00c0fee0 00000000 00000000
php_cgi!main+b2f 00000001 00223c90 00222928
php_cgi!mainCRTStartup+e3 00000000 00000000 7ffd8000
kernel32!BaseProcessStart+23 00405cd6 00000000 00000000

I guess I'm asking for some pointers on how to narrow this down a bit, or if
anyone has seen this problem before. I didn't find anything on the PHP bugs
list.



Regards,

Seth Hill

--001636b2aea29cece10472240a04--

Re: PHP Crash in file_get_contents

am 29.08.2009 21:35:11 von Ralph Deffke

on a regulary base I read the docs even on functions I know, I just read
about the funstion u use and the doc says this:
Note: If you're opening a URI with special characters, such as spaces, you
need to encode the URI with urlencode().

did u try to avoid the problem by using urlencode ?

just a thought

ralph_deffke@yahoo.de


"Seth Hill" wrote in message
news:a90c87ed0908271150x18202147n1717d24daf141cd2@mail.gmail .com...
> Hello all,
> I'm experiencing a curious error that I'm hoping someone can help with.
>
> I am using file_get_contents() with Google Maps Geocoding to retrieve
> information about an address. The URL that I'm requesting looks like:
> http://maps.google.com/maps/geo?q=[Search Subject]&key=[google maps
> key]&sensor=false&output=json&oe=utf8
>
> If I pass a space (0x20) in the search subject, I get a 400 error back (as
> it should be). However, the next request to the site crashes PHP.
>
> I can reproduce it as part of my whole site (which runs a custom
framework),
> but I've been unable to come up with a single PHP file that will duplicate
> the problem.
>
> I am running PHP under IIS6 on a Windows 2003 Web Edition server. I have
> seen this with PHP 5.1.1 and PHP 5.2.5 using the ISAPI dll. Thinking that
it
> was a known bug, I upgraded, but I still see it on PHP 5.2.10 with
> FastCGI. With ISAPI I get a "PHP Access Violation" message until I recycle
> the app pool, with FastCGI I get an equivalent message (except with
FastCGI
> I don't have to manually restart anything).
>
> This is the stack trace:
>
> Function Arg 1 Arg 2 Arg 3 Source
> php5!_zend_mm_realloc_int+357 00223ea0 0274ab98 00000008
> php5!_erealloc+2e 0274ab98 00000008 00000000
> php5!php_stream_wrapper_log_error+49 1044b458 00000004
10333244
> php5!php_stream_url_wrap_http_ex+1f17 1044b458 027a2bb8
> 102a3780 php5!php_stream_url_wrap_http+27 1044b458 027a2bb8
> 102a3780 php5!_php_stream_open_wrapper_ex+aa 027a2bb8 102a3780
> 00000000 php5!zif_file_get_contents+e2 00000001 0274a9e8
> 00000000 php5!zend_do_fcall_common_helper_SPEC+6d7 00c0a45c
> 00c0a2e8 0000000c php5!ZEND_DO_FCALL_SPEC_CONST_HANDLER+df
> 00c0a45c 027492a4 0274912c php5!execute+12e 02749af8
> 00c0a518 00000028 php5!zend_do_fcall_common_helper_SPEC+796
> 00c0aa64 10018e9e 00c0aa64
> php5!ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER+10 00c0aa64 027a2cbc
> 0274a9bc php5!execute+12e 0178e668 00c0ab40 00000030
> php5!ZEND_INCLUDE_OR_EVAL_SPEC_CV_HANDLER+332 0178e668 0178e3b4
> 0178e53c php5!execute+12e 0178b368 00c0cba8 00000000
> php5!ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER+2d1 0178b368 00c0cbac
> 00000000 php5!execute+12e 0178b100 00000000 00c0fee0
> php5!zend_execute_scripts+c8 00000008 00000000 00000003
> php5!php_execute_script+1c0 00c0fee0 00000000 00000000
> php_cgi!main+b2f 00000001 00223c90 00222928
> php_cgi!mainCRTStartup+e3 00000000 00000000 7ffd8000
> kernel32!BaseProcessStart+23 00405cd6 00000000 00000000
>
> I guess I'm asking for some pointers on how to narrow this down a bit, or
if
> anyone has seen this problem before. I didn't find anything on the PHP
bugs
> list.
>
>
>
> Regards,
>
> Seth Hill
>



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