Skip to content
This repository was archived by the owner on Apr 28, 2020. It is now read-only.

Commit 25ddb64

Browse files
committed
Merge branch 'master' into acceptHandling
Conflicts: library/Zend/Http/Header/AbstractAccept.php library/Zend/Http/Header/AcceptEncoding.php library/Zend/Http/Header/AcceptLanguage.php tests/Zend/Http/Header/AcceptCharsetTest.php tests/Zend/Http/Header/AcceptEncodingTest.php tests/Zend/Http/Header/AcceptLanguageTest.php tests/Zend/Http/Header/AcceptTest.php
6 parents 204ae95 + 24b691f + b2ba0b2 + 3df4d2a + d37df59 + 7f0c1ad commit 25ddb64

16 files changed

+59
-46
lines changed

src/AbstractValue.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,7 @@ protected static function _phpVarToNativeXmlRpc($value)
290290
}
291291
}
292292

293-
switch (self::getXmlRpcTypeByValue($value))
294-
{
293+
switch (self::getXmlRpcTypeByValue($value)) {
295294
case self::XMLRPC_TYPE_DATETIME:
296295
return new Value\DateTime($value);
297296

src/Generator/AbstractGenerator.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function __construct($encoding = 'UTF-8')
3636

3737
/**
3838
* Initialize internal objects
39-
*
39+
*
4040
* @return void
4141
*/
4242
abstract protected function _init();
@@ -45,7 +45,7 @@ abstract protected function _init();
4545
* Start XML element
4646
*
4747
* Method opens a new XML element with an element name and an optional value
48-
*
48+
*
4949
* @param string $name XML tag name
5050
* @param string $value Optional value of the XML tag
5151
* @return AbstractGenerator Fluent interface
@@ -77,7 +77,7 @@ public function closeElement($name)
7777

7878
/**
7979
* Return encoding
80-
*
80+
*
8181
* @return string
8282
*/
8383
public function getEncoding()
@@ -87,8 +87,8 @@ public function getEncoding()
8787

8888
/**
8989
* Set XML encoding
90-
*
91-
* @param string $encoding
90+
*
91+
* @param string $encoding
9292
* @return AbstractGenerator
9393
*/
9494
public function setEncoding($encoding)
@@ -146,7 +146,7 @@ abstract protected function _writeTextData($text);
146146

147147
/**
148148
* End XML element
149-
*
149+
*
150150
* @param string $name
151151
*/
152152
abstract protected function _closeElement($name);

src/Server.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
namespace Zend\XmlRpc;
1212

13+
use ReflectionClass;
1314
use Zend\Server\AbstractServer;
1415
use Zend\Server\Definition;
1516
use Zend\Server\Reflection;
16-
use Zend\Stdlib\SubClass;
1717

1818
/**
1919
* An XML-RPC server implementation
@@ -439,7 +439,7 @@ public function getResponse()
439439
*/
440440
public function setResponseClass($class)
441441
{
442-
if (!class_exists($class) || !SubClass::isSubclassOf($class, 'Zend\XmlRpc\Response')) {
442+
if (!class_exists($class) || !self::isSubclassOf($class, 'Zend\XmlRpc\Response')) {
443443
throw new Server\Exception\InvalidArgumentException('Invalid response class');
444444

445445
}
@@ -588,4 +588,28 @@ protected function registerSystemMethods()
588588
$this->_system = $system;
589589
$this->setClass($system, 'system');
590590
}
591+
592+
/**
593+
* Checks if the object has this class as one of its parents
594+
*
595+
* @see https://bugs.php.net/bug.php?id=53727
596+
* @see https://github.com/zendframework/zf2/pull/1807
597+
*
598+
* @param string $className
599+
* @param string $type
600+
*/
601+
protected static function isSubclassOf($className, $type)
602+
{
603+
if (is_subclass_of($className, $type)) {
604+
return true;
605+
}
606+
if (version_compare(PHP_VERSION, '5.3.7', '>=')) {
607+
return false;
608+
}
609+
if (!interface_exists($type)) {
610+
return false;
611+
}
612+
$r = new ReflectionClass($className);
613+
return $r->implementsInterface($type);
614+
}
591615
}

src/Value/DateTime.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
namespace Zend\XmlRpc\Value;
12+
1213
use Zend\XmlRpc\Exception;
1314

1415
/**

src/Value/Integer.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010

1111
namespace Zend\XmlRpc\Value;
12+
1213
use Zend\XmlRpc\Exception;
1314

1415
/**

test/BigIntegerValueTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@
99
*/
1010

1111
namespace ZendTest\XmlRpc;
12+
1213
use Zend\XmlRpc\AbstractValue;
1314
use Zend\XmlRpc\Value\BigInteger;
1415
use Zend\XmlRpc\Exception;
1516
use Zend\XmlRpc\Generator\GeneratorInterface as Generator;
1617
use Zend\Math\BigInteger as MathBigInteger;
1718

1819
/**
19-
* Test case for Zend_XmlRpc_Value
20-
*
2120
* @category Zend
2221
* @package Zend_XmlRpc
2322
* @subpackage UnitTests

test/ClientTest.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
use Zend\XmlRpc;
2121

2222
/**
23-
* Test case for Zend\XmlRpc\Client
24-
*
2523
* @category Zend
2624
* @package Zend_XmlRpc
2725
* @subpackage UnitTests
@@ -651,13 +649,13 @@ public function testHandlesLeadingOrTrailingWhitespaceInChunkedResponseProperly(
651649
$baseUri = "http://foo:80";
652650
$this->httpAdapter = new Adapter\Test();
653651
$this->httpClient = new Http\Client(null, array('adapter' => $this->httpAdapter));
654-
652+
655653
$respBody = file_get_contents(dirname(__FILE__) . "/_files/ZF1897-response-chunked.txt");
656654
$this->httpAdapter->setResponse($respBody);
657655

658656
$this->xmlrpcClient = new Client($baseUri);
659657
$this->xmlrpcClient->setHttpClient($this->httpClient);
660-
658+
661659
$this->assertEquals('FOO', $this->xmlrpcClient->call('foo'));
662660
}
663661

@@ -715,8 +713,10 @@ public function mockHttpClient()
715713
}
716714

717715
/** related to ZF-8478 */
718-
class PythonSimpleXMLRPCServerWithUnsupportedIntrospection extends Client\ServerProxy {
719-
public function __call($method, $args) {
716+
class PythonSimpleXMLRPCServerWithUnsupportedIntrospection extends Client\ServerProxy
717+
{
718+
public function __call($method, $args)
719+
{
720720
if ($method == 'methodSignature') {
721721
return 'signatures not supported';
722722
}
@@ -725,8 +725,10 @@ public function __call($method, $args) {
725725
}
726726

727727
/** related to ZF-8478 */
728-
class TestClient extends Client {
729-
public function getProxy($namespace = '') {
728+
class TestClient extends Client
729+
{
730+
public function getProxy($namespace = '')
731+
{
730732
if (empty($this->_proxyCache[$namespace])) {
731733
$this->_proxyCache[$namespace] = new PythonSimpleXMLRPCServerWithUnsupportedIntrospection($this, $namespace);
732734
}

test/FaultTest.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
use Zend\XmlRpc;
1515

1616
/**
17-
* Test case for Zend_XmlRpc_Fault
18-
*
1917
* @category Zend
2018
* @package Zend_XmlRpc
2119
* @subpackage UnitTests
@@ -161,19 +159,19 @@ public function testLoadXmlThrowsExceptionOnInvalidInput2()
161159
$this->setExpectedException('Zend\XmlRpc\Exception\InvalidArgumentException', 'Invalid fault structure');
162160
$this->assertFalse($this->_fault->loadXml('<methodResponse><fault/></methodResponse>'));
163161
}
164-
162+
165163
public function testLoadXmlThrowsExceptionOnInvalidInput3()
166164
{
167165
$this->setExpectedException('Zend\XmlRpc\Exception\InvalidArgumentException', 'Invalid fault structure');
168166
$this->_fault->loadXml('<methodResponse><fault/></methodResponse>');
169167
}
170-
168+
171169
public function testLoadXmlThrowsExceptionOnInvalidInput4()
172170
{
173171
$this->setExpectedException('Zend\XmlRpc\Exception\InvalidArgumentException', 'Fault code and string required');
174172
$this->_fault->loadXml('<methodResponse><fault><value><struct/></value></fault></methodResponse>');
175173
}
176-
174+
177175
/**
178176
* Zend_XmlRpc_Fault::isFault() test
179177
*/

test/GeneratorTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
use Zend\XmlRpc\Generator\GeneratorInterface as Generator;
1414

1515
/**
16-
* Test case for Zend_XmlRpc_Generator_*
17-
*
1816
* @category Zend
1917
* @package Zend_XmlRpc
2018
* @subpackage UnitTests

test/Request/HttpTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
use ZendTest\AllTests\StreamWrapper\PHPInput;
1515

1616
/**
17-
* Test case for Zend\XmlRpc\Request\Http
18-
*
1917
* @category Zend
2018
* @package Zend_XmlRpc
2119
* @subpackage UnitTests

0 commit comments

Comments
 (0)