3 include_once __DIR__ . '/../lib/xmlrpc.inc';
4 include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc';
6 include_once __DIR__ . '/parse_args.php';
8 class LocalhostTest extends PHPUnit_Framework_TestCase
10 /** @var xmlrpc_client $client */
11 protected $client = null;
12 protected $method = 'http';
13 protected $timeout = 10;
14 protected $request_compression = null;
15 protected $accepted_compression = '';
16 protected $args = array();
18 protected static $failed_tests = array();
21 /** @var boolean $collectCodeCoverageInformation */
22 protected $collectCodeCoverageInformation;
23 protected $coverageScriptUrl;
25 public static function fail($message = '')
27 // save in a static var that this particular test has failed
28 // (but only if not called from subclass objects / multitests)
29 if (function_exists('debug_backtrace') && strtolower(get_called_class()) == 'localhosttests') {
30 $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
31 for ($i = 0; $i < count($trace); $i++) {
32 if (strpos($trace[$i]['function'], 'test') === 0) {
33 self::$failed_tests[$trace[$i]['function']] = true;
39 parent::fail($message);
43 * Reimplemented to allow us to collect code coverage info from the target server.
44 * Code taken from PHPUnit_Extensions_Selenium2TestCase
46 * @param PHPUnit_Framework_TestResult $result
47 * @return PHPUnit_Framework_TestResult
50 public function run(PHPUnit_Framework_TestResult $result = NULL)
52 $this->testId = get_class($this) . '__' . $this->getName();
54 if ($result === NULL) {
55 $result = $this->createResult();
58 $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation();
62 if ($this->collectCodeCoverageInformation) {
63 $coverage = new PHPUnit_Extensions_SeleniumCommon_RemoteCoverage(
64 $this->coverageScriptUrl,
67 $result->getCodeCoverage()->append(
68 $coverage->get(), $this
72 // do not call this before to give the time to the Listeners to run
73 //$this->getStrategy()->endOfTest($this->session);
78 public function setUp()
80 $this->args = argParser::getArgs();
82 $server = explode(':', $this->args['LOCALSERVER']);
83 if (count($server) > 1) {
84 $this->client = new xmlrpc_client($this->args['URI'], $server[0], $server[1]);
86 $this->client = new xmlrpc_client($this->args['URI'], $this->args['LOCALSERVER']);
89 $this->client->setDebug($this->args['DEBUG']);
90 $this->client->request_compression = $this->request_compression;
91 $this->client->accepted_compression = $this->accepted_compression;
93 $this->coverageScriptUrl = 'http://' . $this->args['LOCALSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI'] );
95 if ($this->args['DEBUG'] == 1)
99 protected function tearDown()
101 if ($this->args['DEBUG'] != 1)
103 $out = ob_get_clean();
104 $status = $this->getStatus();
105 if ($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR
106 || $status == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
111 protected function send($msg, $errorCode = 0, $returnResponse = false)
113 if ($this->collectCodeCoverageInformation) {
114 $this->client->setCookie('PHPUNIT_SELENIUM_TEST_ID', $this->testId);
117 $r = $this->client->send($msg, $this->timeout, $this->method);
118 // for multicall, return directly array of responses
122 if (is_array($errorCode)) {
123 $this->assertContains($r->faultCode(), $errorCode, 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
125 $this->assertEquals($errorCode, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
127 if (!$r->faultCode()) {
128 if ($returnResponse) {
138 public function testString()
140 $sendString = "here are 3 \"entities\": < > & " .
141 "and here's a dollar sign: \$pretendvarname and a backslash too: " . chr(92) .
142 " - isn't that great? \\\"hackery\\\" at it's best " .
143 " also don't want to miss out on \$item[0]. " .
144 "The real weird stuff follows: CRLF here" . chr(13) . chr(10) .
145 "a simple CR here" . chr(13) .
146 "a simple LF here" . chr(10) .
147 "and then LFCR" . chr(10) . chr(13) .
148 "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne, and an xml comment closing tag: -->";
149 $f = new xmlrpcmsg('examples.stringecho', array(
150 new xmlrpcval($sendString, 'string'),
152 $v = $this->send($f);
154 // when sending/receiving non-US-ASCII encoded strings, XML says cr-lf can be normalized.
155 // so we relax our tests...
156 $l1 = strlen($sendString);
157 $l2 = strlen($v->scalarval());
159 $this->assertEquals($sendString, $v->scalarval());
161 $this->assertEquals(str_replace(array("\r\n", "\r"), array("\n", "\n"), $sendString), $v->scalarval());
166 public function testLatin1String()
169 "last but not least weird names: G" . chr(252) . "nter, El" . chr(232) . "ne";
170 $f = '<?xml version="1.0" encoding="ISO-8859-1"?><methodCall><methodName>examples.stringecho</methodName><params><param><value>'.
172 '</value></param></params></methodCall>';
173 $v = $this->send($f);
175 $this->assertEquals($sendString, $v->scalarval());
179 /*public function testLatin1Method()
181 $f = new xmlrpcmsg("tests.iso88591methodname." . chr(224) . chr(252) . chr(232), array(
182 new xmlrpcval('hello')
184 $v = $this->send($f);
186 $this->assertEquals('hello', $v->scalarval());
190 public function testUtf8Method()
192 PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8';
193 $f = new xmlrpcmsg("tests.utf8methodname." . 'κόσμε', array(
194 new xmlrpcval('hello')
196 $v = $this->send($f);
198 $this->assertEquals('hello', $v->scalarval());
200 PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'ISO-8859-1';
203 public function testAddingDoubles()
205 // note that rounding errors mean we
206 // keep precision to sensible levels here ;-)
209 $f = new xmlrpcmsg('examples.addtwodouble', array(
210 new xmlrpcval($a, 'double'),
211 new xmlrpcval($b, 'double'),
213 $v = $this->send($f);
215 $this->assertEquals($a + $b, $v->scalarval());
219 public function testAdding()
221 $f = new xmlrpcmsg('examples.addtwo', array(
222 new xmlrpcval(12, 'int'),
223 new xmlrpcval(-23, 'int'),
225 $v = $this->send($f);
227 $this->assertEquals(12 - 23, $v->scalarval());
231 public function testInvalidNumber()
233 $f = new xmlrpcmsg('examples.addtwo', array(
234 new xmlrpcval('fred', 'int'),
235 new xmlrpcval("\"; exec('ls')", 'int'),
237 $v = $this->send($f);
238 /// @todo a fault condition should be generated here
239 /// by the server, which we pick up on
241 $this->assertEquals(0, $v->scalarval());
245 public function testBoolean()
247 $f = new xmlrpcmsg('examples.invertBooleans', array(
249 new xmlrpcval(true, 'boolean'),
250 new xmlrpcval(false, 'boolean'),
251 new xmlrpcval(1, 'boolean'),
252 new xmlrpcval(0, 'boolean')
257 $v = $this->send($f);
259 $sz = $v->arraysize();
261 for ($i = 0; $i < $sz; $i++) {
262 $b = $v->arraymem($i);
263 if ($b->scalarval()) {
269 $this->assertEquals($answer, $got);
273 public function testBase64()
275 $sendString = 'Mary had a little lamb,
276 Whose fleece was white as snow,
277 And everywhere that Mary went
278 the lamb was sure to go.
280 Mary had a little lamb
281 She tied it to a pylon
282 Ten thousand volts went down its back
283 And turned it into nylon';
284 $f = new xmlrpcmsg('examples.decode64', array(
285 new xmlrpcval($sendString, 'base64'),
287 $v = $this->send($f);
289 if (strlen($sendString) == strlen($v->scalarval())) {
290 $this->assertEquals($sendString, $v->scalarval());
292 $this->assertEquals(str_replace(array("\r\n", "\r"), array("\n", "\n"), $sendString), $v->scalarval());
297 public function testDateTime()
300 $t1 = new xmlrpcval($time, 'dateTime.iso8601');
301 $t2 = new xmlrpcval(iso8601_encode($time), 'dateTime.iso8601');
302 $this->assertEquals($t1->serialize(), $t2->serialize());
303 if (class_exists('DateTime')) {
304 $datetime = new DateTime();
305 // skip this test for php 5.2. It is a bit harder there to build a DateTime from unix timestamp with proper TZ info
306 if (is_callable(array($datetime, 'setTimestamp'))) {
307 $t3 = new xmlrpcval($datetime->setTimestamp($time), 'dateTime.iso8601');
308 $this->assertEquals($t1->serialize(), $t3->serialize());
313 public function testCountEntities()
315 $sendString = "h'fd>onc>>l>>rw&bpu>q>e<v&gxs<ytjzkami<";
316 $f = new xmlrpcmsg('validator1.countTheEntities', array(
317 new xmlrpcval($sendString, 'string'),
319 $v = $this->send($f);
323 $expect_array = array('ctLeftAngleBrackets', 'ctRightAngleBrackets', 'ctAmpersands', 'ctApostrophes', 'ctQuotes');
324 while (list(, $val) = each($expect_array)) {
325 $b = $v->structmem($val);
326 $got .= $b->me['int'];
328 $this->assertEquals($expected, $got);
332 public function _multicall_msg($method, $params)
334 $struct['methodName'] = new xmlrpcval($method, 'string');
335 $struct['params'] = new xmlrpcval($params, 'array');
337 return new xmlrpcval($struct, 'struct');
340 public function testServerMulticall()
342 // We manually construct a system.multicall() call to ensure
343 // that the server supports it.
345 // NB: This test will NOT pass if server does not support system.multicall.
347 // Based on http://xmlrpc-c.sourceforge.net/hacks/test_multicall.py
348 $good1 = $this->_multicall_msg(
350 array(php_xmlrpc_encode('system.listMethods')));
351 $bad = $this->_multicall_msg(
353 array(php_xmlrpc_encode(1), php_xmlrpc_encode(2)));
354 $recursive = $this->_multicall_msg(
356 array(new xmlrpcval(array(), 'array')));
357 $good2 = $this->_multicall_msg(
358 'system.methodSignature',
359 array(php_xmlrpc_encode('system.listMethods')));
360 $arg = new xmlrpcval(
361 array($good1, $bad, $recursive, $good2),
365 $f = new xmlrpcmsg('system.multicall', array($arg));
366 $v = $this->send($f);
368 //$this->assertTrue($r->faultCode() == 0, "fault from system.multicall");
369 $this->assertTrue($v->arraysize() == 4, "bad number of return values");
371 $r1 = $v->arraymem(0);
373 $r1->kindOf() == 'array' && $r1->arraysize() == 1,
374 "did not get array of size 1 from good1"
377 $r2 = $v->arraymem(1);
379 $r2->kindOf() == 'struct',
383 $r3 = $v->arraymem(2);
385 $r3->kindOf() == 'struct',
386 "recursive system.multicall did not fail"
389 $r4 = $v->arraymem(3);
391 $r4->kindOf() == 'array' && $r4->arraysize() == 1,
392 "did not get array of size 1 from good2"
397 public function testClientMulticall1()
399 // NB: This test will NOT pass if server does not support system.multicall.
401 $this->client->no_multicall = false;
403 $good1 = new xmlrpcmsg('system.methodHelp',
404 array(php_xmlrpc_encode('system.listMethods')));
405 $bad = new xmlrpcmsg('test.nosuch',
406 array(php_xmlrpc_encode(1), php_xmlrpc_encode(2)));
407 $recursive = new xmlrpcmsg('system.multicall',
408 array(new xmlrpcval(array(), 'array')));
409 $good2 = new xmlrpcmsg('system.methodSignature',
410 array(php_xmlrpc_encode('system.listMethods'))
413 $r = $this->send(array($good1, $bad, $recursive, $good2));
415 $this->assertTrue(count($r) == 4, "wrong number of return values");
418 $this->assertTrue($r[0]->faultCode() == 0, "fault from good1");
419 if (!$r[0]->faultCode()) {
420 $val = $r[0]->value();
422 $val->kindOf() == 'scalar' && $val->scalartyp() == 'string',
423 "good1 did not return string"
426 $this->assertTrue($r[1]->faultCode() != 0, "no fault from bad");
427 $this->assertTrue($r[2]->faultCode() != 0, "no fault from recursive system.multicall");
428 $this->assertTrue($r[3]->faultCode() == 0, "fault from good2");
429 if (!$r[3]->faultCode()) {
430 $val = $r[3]->value();
431 $this->assertTrue($val->kindOf() == 'array', "good2 did not return array");
433 // This is the only assert in this test which should fail
434 // if the test server does not support system.multicall.
435 $this->assertTrue($this->client->no_multicall == false,
436 "server does not support system.multicall"
440 public function testClientMulticall2()
442 // NB: This test will NOT pass if server does not support system.multicall.
444 $this->client->no_multicall = true;
446 $good1 = new xmlrpcmsg('system.methodHelp',
447 array(php_xmlrpc_encode('system.listMethods')));
448 $bad = new xmlrpcmsg('test.nosuch',
449 array(php_xmlrpc_encode(1), php_xmlrpc_encode(2)));
450 $recursive = new xmlrpcmsg('system.multicall',
451 array(new xmlrpcval(array(), 'array')));
452 $good2 = new xmlrpcmsg('system.methodSignature',
453 array(php_xmlrpc_encode('system.listMethods'))
456 $r = $this->send(array($good1, $bad, $recursive, $good2));
458 $this->assertTrue(count($r) == 4, "wrong number of return values");
461 $this->assertTrue($r[0]->faultCode() == 0, "fault from good1");
462 if (!$r[0]->faultCode()) {
463 $val = $r[0]->value();
465 $val->kindOf() == 'scalar' && $val->scalartyp() == 'string',
466 "good1 did not return string");
468 $this->assertTrue($r[1]->faultCode() != 0, "no fault from bad");
469 $this->assertTrue($r[2]->faultCode() == 0, "fault from (non recursive) system.multicall");
470 $this->assertTrue($r[3]->faultCode() == 0, "fault from good2");
471 if (!$r[3]->faultCode()) {
472 $val = $r[3]->value();
473 $this->assertTrue($val->kindOf() == 'array', "good2 did not return array");
477 public function testClientMulticall3()
479 // NB: This test will NOT pass if server does not support system.multicall.
481 $this->client->return_type = 'phpvals';
482 $this->client->no_multicall = false;
484 $good1 = new xmlrpcmsg('system.methodHelp',
485 array(php_xmlrpc_encode('system.listMethods')));
486 $bad = new xmlrpcmsg('test.nosuch',
487 array(php_xmlrpc_encode(1), php_xmlrpc_encode(2)));
488 $recursive = new xmlrpcmsg('system.multicall',
489 array(new xmlrpcval(array(), 'array')));
490 $good2 = new xmlrpcmsg('system.methodSignature',
491 array(php_xmlrpc_encode('system.listMethods'))
494 $r = $this->send(array($good1, $bad, $recursive, $good2));
496 $this->assertTrue(count($r) == 4, "wrong number of return values");
498 $this->assertTrue($r[0]->faultCode() == 0, "fault from good1");
499 if (!$r[0]->faultCode()) {
500 $val = $r[0]->value();
502 is_string($val), "good1 did not return string");
504 $this->assertTrue($r[1]->faultCode() != 0, "no fault from bad");
505 $this->assertTrue($r[2]->faultCode() != 0, "no fault from recursive system.multicall");
506 $this->assertTrue($r[3]->faultCode() == 0, "fault from good2");
507 if (!$r[3]->faultCode()) {
508 $val = $r[3]->value();
509 $this->assertTrue(is_array($val), "good2 did not return array");
511 $this->client->return_type = 'xmlrpcvals';
514 public function testCatchWarnings()
516 $f = new xmlrpcmsg('tests.generatePHPWarning', array(
517 new xmlrpcval('whatever', 'string'),
519 $v = $this->send($f);
521 $this->assertEquals(true, $v->scalarval());
525 public function testCatchExceptions()
527 $f = new xmlrpcmsg('tests.raiseException', array(
528 new xmlrpcval('whatever', 'string'),
530 $v = $this->send($f, $GLOBALS['xmlrpcerr']['server_error']);
531 $this->client->path = $this->args['URI'] . '?EXCEPTION_HANDLING=1';
532 $v = $this->send($f, 1);
533 $this->client->path = $this->args['URI'] . '?EXCEPTION_HANDLING=2';
534 // depending on whether display_errors is ON or OFF on the server, we will get back a different error here,
535 // as php will generate an http status code of either 200 or 500...
536 $v = $this->send($f, array($GLOBALS['xmlrpcerr']['invalid_return'], $GLOBALS['xmlrpcerr']['http_error']));
539 public function testZeroParams()
541 $f = new xmlrpcmsg('system.listMethods');
542 $v = $this->send($f);
545 public function testCodeInjectionServerSide()
547 $f = new xmlrpcmsg('system.MethodHelp');
548 $f->payload = "<?xml version=\"1.0\"?><methodCall><methodName>validator1.echoStructTest</methodName><params><param><value><struct><member><name>','')); echo('gotcha!'); die(); //</name></member></struct></value></param></params></methodCall>";
549 $v = $this->send($f);
551 $this->assertEquals(0, $v->structsize());
555 public function testAutoRegisteredFunction()
557 $f = new xmlrpcmsg('tests.getStateName.2', array(
558 new xmlrpcval(23, 'int'),
560 $v = $this->send($f);
561 $this->assertEquals('Michigan', $v->scalarval());
564 public function testAutoRegisteredFunction2()
566 $f = new xmlrpcmsg('tests.getStateName.6', array(
567 new xmlrpcval(23, 'int'),
569 $v = $this->send($f);
570 $this->assertEquals('Michigan', $v->scalarval());
573 public function testAutoRegisteredMethods()
575 $f = new xmlrpcmsg('tests.getStateName.3', array(
576 new xmlrpcval(23, 'int'),
578 $v = $this->send($f);
579 $this->assertEquals('Michigan', $v->scalarval());
581 $f = new xmlrpcmsg('tests.getStateName.4', array(
582 new xmlrpcval(23, 'int'),
584 $v = $this->send($f);
585 $this->assertEquals('Michigan', $v->scalarval());
587 $f = new xmlrpcmsg('tests.getStateName.5', array(
588 new xmlrpcval(23, 'int'),
590 $v = $this->send($f);
591 $this->assertEquals('Michigan', $v->scalarval());
593 $f = new xmlrpcmsg('tests.getStateName.7', array(
594 new xmlrpcval(23, 'int'),
596 $v = $this->send($f);
597 $this->assertEquals('Michigan', $v->scalarval());
599 $f = new xmlrpcmsg('tests.getStateName.8', array(
600 new xmlrpcval(23, 'int'),
602 $v = $this->send($f);
603 $this->assertEquals('Michigan', $v->scalarval());
605 $f = new xmlrpcmsg('tests.getStateName.9', array(
606 new xmlrpcval(23, 'int'),
608 $v = $this->send($f);
609 $this->assertEquals('Michigan', $v->scalarval());
612 public function testAutoRegisteredMethods2()
614 $f = new xmlrpcmsg('tests.getStateName.7', array(
615 new xmlrpcval(23, 'int'),
617 $v = $this->send($f);
618 $this->assertEquals('Michigan', $v->scalarval());
620 $f = new xmlrpcmsg('tests.getStateName.8', array(
621 new xmlrpcval(23, 'int'),
623 $v = $this->send($f);
624 $this->assertEquals('Michigan', $v->scalarval());
626 $f = new xmlrpcmsg('tests.getStateName.9', array(
627 new xmlrpcval(23, 'int'),
629 $v = $this->send($f);
630 $this->assertEquals('Michigan', $v->scalarval());
633 public function testAutoRegisteredClosure()
635 $f = new xmlrpcmsg('tests.getStateName.10', array(
636 new xmlrpcval(23, 'int'),
638 $v = $this->send($f);
639 $this->assertEquals('Michigan', $v->scalarval());
642 public function testAutoRegisteredClass()
644 $f = new xmlrpcmsg('tests.xmlrpcServerMethodsContainer.findState', array(
645 new xmlrpcval(23, 'int'),
647 $v = $this->send($f);
648 $this->assertEquals('Michigan', $v->scalarval());
651 public function testWrappedMethod()
653 // make a 'deep client copy' as the original one might have many properties set
654 $func = wrap_xmlrpc_method($this->client, 'examples.getStateName', array('simple_client_copy' => 1));
656 $this->fail('Registration of examples.getStateName failed');
659 // work around bug in current version of phpunit
661 $v = var_export($v, true);
663 $this->assertEquals('Michigan', $v);
667 public function testWrappedClass()
669 // make a 'deep client copy' as the original one might have many properties set
670 $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 1));
672 $this->fail('Registration of remote server failed');
675 $v = $obj->examples_getStateName(23);
676 // work around bug in current version of phpunit
678 $v = var_export($v, true);
680 $this->assertEquals('Michigan', $v);
684 public function testGetCookies()
686 // let server set to us some cookies we tell it
689 'c2' => array('value' => 'c2'),
690 'c3' => array('value' => 'c3', 'expires' => time() + 60 * 60 * 24 * 30),
691 'c4' => array('value' => 'c4', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/'),
692 'c5' => array('value' => 'c5', 'expires' => time() + 60 * 60 * 24 * 30, 'path' => '/', 'domain' => 'localhost'),
694 $cookiesval = php_xmlrpc_encode($cookies);
695 $f = new xmlrpcmsg('examples.setcookies', array($cookiesval));
696 $r = $this->send($f, 0, true);
699 $this->assertEquals(1, $v->scalarval());
700 // now check if we decoded the cookies as we had set them
701 $rcookies = $r->cookies();
702 // remove extra cookies which might have been set by proxies
703 foreach ($rcookies as $c => $v) {
704 if (!in_array($c, array('c2', 'c3', 'c4', 'c5'))) {
705 unset($rcookies[$c]);
707 // Seems like we get this when using php-fpm and php 5.5+ ...
708 if (isset($rcookies[$c]['Max-Age'])) {
709 unset($rcookies[$c]['Max-Age']);
712 foreach ($cookies as $c => $v) {
713 // format for date string in cookies: 'Mon, 31 Oct 2005 13:50:56 GMT'
714 // but PHP versions differ on that, some use 'Mon, 31-Oct-2005 13:50:56 GMT'...
715 if (isset($v['expires'])) {
716 if (isset($rcookies[$c]['expires']) && strpos($rcookies[$c]['expires'], '-')) {
717 $cookies[$c]['expires'] = gmdate('D, d\-M\-Y H:i:s \G\M\T', $cookies[$c]['expires']);
719 $cookies[$c]['expires'] = gmdate('D, d M Y H:i:s \G\M\T', $cookies[$c]['expires']);
724 $this->assertEquals($cookies, $rcookies);
728 public function testSetCookies()
730 // let server set to us some cookies we tell it
735 'c3' => '!@#$%^&*()_+|}{":?><,./\';[]\\=-',
737 $f = new xmlrpcmsg('examples.getcookies', array());
738 foreach ($cookies as $cookie => $val) {
739 $this->client->setCookie($cookie, $val);
740 $cookies[$cookie] = (string)$cookies[$cookie];
742 $r = $this->client->send($f, $this->timeout, $this->method);
743 $this->assertEquals(0, $r->faultCode(), 'Error ' . $r->faultCode() . ' connecting to server: ' . $r->faultString());
744 if (!$r->faultCode()) {
746 $v = php_xmlrpc_decode($v);
748 // take care for the extra cookie used for coverage collection
749 if (isset($v['PHPUNIT_SELENIUM_TEST_ID'])) {
750 unset($v['PHPUNIT_SELENIUM_TEST_ID']);
753 // on IIS and Apache getallheaders returns something slightly different...
754 $this->assertEquals($cookies, $v);
758 public function testSendTwiceSameMsg()
760 $f = new xmlrpcmsg('examples.stringecho', array(
761 new xmlrpcval('hello world', 'string'),
763 $v1 = $this->send($f);
764 $v2 = $this->send($f);
766 $this->assertEquals($v1, $v2);