From: jr at terragate dot net
Operating system: x86 linux
PHP version: 5.0.3
PHP Bug Type: Reproducible crash
Bug description: WebDAV stream wrapper crashes PHP
Description:
------------
PEAR's HTTP_WebDAV_Client causes PHP 5 to trow a deprecated warning as
Exception:
Fatal error: Uncaught exception 'Exception' with message 'is_a():
Deprecated. Please use the instanceof operator' in
/usr/lib/php/PEAR.php:248
Stack trace:
#0 /usr/lib/php/PEAR.php(248): is_a(true, 'PEAR_Error')
#1 /usr/lib/php/HTTP/Request.php(591): HTTP_Request->isError(true)
#2 /usr/lib/php/HTTP/WebDAV/Client/Stream.php(796):
HTTP_Request->sendRequest()
#3 /usr/lib/php/HTTP/WebDAV/Client/Stream.php(446):
HTTP_WebDAV_Client_Stream->_check_options()
#4 /var/www/localhost/htdocs/crash.php(5):
HTTP_WebDAV_Client_Stream->dir_opendir('webdav://test:t...', 4)
#5 /var/www/localhost/htdocs/crash.php(5):
DirectoryIterator->__construct('webdav://test:t...')
#6 {main}
thrown in /usr/lib/php/PEAR.php on line 248
Is this a bug or a feature (deprecation messages thrown as Exceptions)?
Changing the is_a in PEAR.php to instanceof causes a segfault.
Reproduce code:
---------------
<?php
require_once('HTTP/WebDAV/Client.php');
$it = new DirectoryIterator('webdav://test:[EMAIL PROTECTED]/');
echo 'Done';
?>
for the 'deprecation exception' and a additional change for the segfault:
PEAR.php ~line 248:
if ($data instanceof PEAR_Error) {
instead of:
if (is_a($data, 'PEAR_Error')) {
This requires a valid webdav URL (I can provide one if necessary).
Expected result:
----------------
Clean shutdown
Actual result:
--------------
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 22648)]
Done
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 22648)]
0x00000019 in ?? ()
#0 0x00000019 in ?? ()
#1 0x0829ca06 in _php_stream_free (stream=0x8652714, close_options=3)
at
/var/tmp/portage/php-5.0.3/work/php-5.0.3/main/streams/streams.c:351
#2 0x081b0d74 in spl_ce_dir_object_free_storage (object=0x85e067c)
at
/var/tmp/portage/php-5.0.3/work/php-5.0.3/ext/spl/spl_directory.c:66
#3 0x082e939d in zend_objects_store_del_ref (zobject=0x85f4430)
at
/var/tmp/portage/php-5.0.3/work/php-5.0.3/Zend/zend_objects_API.c:159
#4 0x082cc90f in _zval_dtor (zvalue=0x85da6ac,
__zend_filename=0x84a0800
"/var/tmp/portage/php-5.0.3/work/php-5.0.3/Zend/zend_execute_API.c",
__zend_lineno=392)
at /var/tmp/portage/php-5.0.3/work/php-5.0.3/Zend/zend_variables.c:61
#5 0x082c19cb in _zval_ptr_dtor (zval_ptr=0x85ddda8,
__zend_filename=0x85f4430 "xA_\b\uffff\001^\b",
__zend_lineno=140461104)
at
/var/tmp/portage/php-5.0.3/work/php-5.0.3/Zend/zend_execute_API.c:392
#6 0x082ccce2 in _zval_ptr_dtor_wrapper (zval_ptr=0x85f4430)
at
/var/tmp/portage/php-5.0.3/work/php-5.0.3/Zend/zend_variables.c:193
#7 0x082d976f in zend_hash_apply_deleter (ht=0x85131b0, p=0x85ddd9c)
at /var/tmp/portage/php-5.0.3/work/php-5.0.3/Zend/zend_hash.c:574
#8 0x082d707c in zend_hash_graceful_reverse_destroy (ht=0x85131b0)
at /var/tmp/portage/php-5.0.3/work/php-5.0.3/Zend/zend_hash.c:640
#9 0x082c123a in shutdown_executor ()
at
/var/tmp/portage/php-5.0.3/work/php-5.0.3/Zend/zend_execute_API.c:208
#10 0x082cddde in zend_deactivate ()
at /var/tmp/portage/php-5.0.3/work/php-5.0.3/Zend/zend.c:818
#11 0x08288352 in php_request_shutdown (dummy=0x0)
at /var/tmp/portage/php-5.0.3/work/php-5.0.3/main/main.c:1212
#12 0x083111b7 in main (argc=2, argv=0xbffff844)
at /var/tmp/portage/php-5.0.3/work/php-5.0.3/sapi/cli/php_cli.c:1046
--
Edit bug report at http://bugs.php.net/?id=32171&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=32171&r=trysnapshot4
Try a CVS snapshot (php5.0):
http://bugs.php.net/fix.php?id=32171&r=trysnapshot50
Try a CVS snapshot (php5.1):
http://bugs.php.net/fix.php?id=32171&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=32171&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=32171&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=32171&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=32171&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=32171&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=32171&r=support
Expected behavior: http://bugs.php.net/fix.php?id=32171&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=32171&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=32171&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=32171&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=32171&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=32171&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=32171&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=32171&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=32171&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=32171&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=32171&r=mysqlcfg