Annotation of embedaddon/php/ext/curl/tests/curl_multi_getcontent_error4.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Curl_multi_getcontent() error test with undefined handle
! 3: --CREDITS--
! 4: Rein Velt (rein@velt.org)
! 5: #TestFest Utrecht 20090509
! 6: --SKIPIF--
! 7: <?php
! 8: if (!extension_loaded('curl')) print 'skip';
! 9: ?>
! 10: --FILE--
! 11: <?php
! 12: //CURL_MULTI_GETCONTENT TEST
! 13:
! 14: //CREATE RESOURCES
! 15: //$ch1=undefined;
! 16: $ch2=curl_init();
! 17:
! 18: //SET URL AND OTHER OPTIONS
! 19: curl_setopt($ch1, CURLOPT_URL, "file://".dirname(__FILE__). DIRECTORY_SEPARATOR . "curl_testdata1.txt");
! 20: curl_setopt($ch2, CURLOPT_URL, "file://".dirname(__FILE__). DIRECTORY_SEPARATOR . "curl_testdata2.txt");
! 21: curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);
! 22: curl_setopt($ch2, CURLOPT_RETURNTRANSFER, true);
! 23:
! 24: //CREATE MULTIPLE CURL HANDLE
! 25: $mh=curl_multi_init();
! 26:
! 27: //ADD THE 2 HANDLES
! 28: curl_multi_add_handle($mh,$ch1);
! 29: curl_multi_add_handle($mh,$ch2);
! 30:
! 31: //EXECUTE
! 32: $running=0;
! 33: do {
! 34: curl_multi_exec($mh,$running);
! 35: } while ($running>0);
! 36:
! 37:
! 38: $results1=curl_multi_getcontent($ch1); //incorrect parameter type
! 39: $results2=curl_multi_getcontent($ch2);
! 40:
! 41: //CLOSE
! 42: //curl_multi_remove_handle($mh,$ch1);
! 43: curl_multi_remove_handle($mh,$ch2);
! 44: curl_multi_close($mh);
! 45:
! 46: echo $results1;
! 47: echo $results2;
! 48:
! 49: ?>
! 50: --EXPECTF--
! 51: Notice: Undefined variable: ch1 in %s on line %d
! 52:
! 53: Warning: curl_setopt() expects parameter 1 to be resource, null given in %s on line %d
! 54:
! 55: Notice: Undefined variable: ch1 in %s on line %d
! 56:
! 57: Warning: curl_setopt() expects parameter 1 to be resource, null given in %s on line %d
! 58:
! 59: Notice: Undefined variable: ch1 in %s on line %d
! 60:
! 61: Warning: curl_multi_add_handle() expects parameter 2 to be resource, null given in %s on line %d
! 62:
! 63: Notice: Undefined variable: ch1 in %s on line %d
! 64:
! 65: Warning: curl_multi_getcontent() expects parameter 1 to be resource, null given in %s on line %d
! 66: CURL2
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>