# @todo add env setup scripts for windows
run: |
chmod 755 ./tests/ci/setup/*.sh
+ sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/install_packages.sh
sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_perl.sh
sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_apache.sh
sudo --preserve-env=GITHUB_ACTIONS ./tests/ci/setup/setup_privoxy.sh
import xmlrpc.client
import base64
-#import sys
+import sys
server = xmlrpc.client.ServerProxy("http://localhost/demo/server/server.php")
print("A fault occurred")
print("Fault code: %d" % err.faultCode)
print("Fault string: %s" % err.faultString)
+
+ # let the test suite know that here was a fault
+ sys.exit(err.faultCode)
}
}
}
+ if (isset($_GET['FORCE_REDIRECT'])) {
+ header('HTTP/1.0 302 Found');
+ unset($_GET['FORCE_REDIRECT']);
+ header('Location: ' . $_SERVER['REQUEST_URI'] . (count($_GET) ? '?' . http_build_query($_GET) : ''));
+ die();
+ }
}
$s->service();
// NB: this simple checks helps a lot sanitizing input, i.e. no security problems around here
// Note the non-strict type check: it will allow ' 1 '
/// @todo feature-creep: use a flexible regexp, the same as we do with int, double and datetime.
- /// Note that using a regexp would also make this test less sensitive to phpunit shenanigans
+ /// Note that using a regexp would also make this test less sensitive to phpunit shenanigans, and
+ /// to changes in the way php compares strings (since 8.0, leading and trailing newlines are
+ /// accepted when deciding if a string numeric...)
if ($this->_xh['ac'] == '1' || strcasecmp($this->_xh['ac'], 'true') === 0) {
$this->_xh['value'] = true;
} else {
// log if receiving something strange, even though we set the value to false anyway
- /// @todo to be consistent with the other types, we should use a value outside the good-value domain, e.g. NULL
+ /// @todo to be consistent with the other types, we should return a value outside the good-value domain, e.g. NULL
if ($this->_xh['ac'] != '0' && strcasecmp($this->_xh['ac'], 'false') !== 0) {
$this->getLogger()->errorLog('XML-RPC: ' . __METHOD__ . ': invalid data received in BOOLEAN value: ' . $this->_xh['ac']);
if ($this->current_parsing_options['xmlrpc_reject_invalid_values'])
<member>
<name>bool</name>
<value><boolean>
-1
+yes
</boolean></value>
</member>
<member>
}
}
+ /**
+ * @dataProvider getSingleHttpTestMethods
+ * @param string $method
+ */
+ public function testRedirects($method)
+ {
+ if (!function_exists('curl_init'))
+ {
+ $this->markTestSkipped('CURL missing: cannot test redirects');
+ return;
+ }
+
+ $this->client->setUseCurl(\PhpXmlRpc\Client::USE_CURL_ALWAYS);
+ $this->client->setCurlOptions(array(CURLOPT_FOLLOWLOCATION => true, CURLOPT_POSTREDIR => 3));
+
+ $this->$method();
+ }
+
public function testAcceptCharset()
{
if (version_compare(PHP_VERSION, '5.6.0', '<'))
/**
* Tests for php files in the 'demo' directory.
+ *
+ * @todo add execution of perl and python demos via usage of 'exec'
*/
class DemoFilesTest extends PhpXmlRpc_WebTestCase
{
cd /root/setup && \
./install_packages.sh && \
./create_user.sh && \
+ ./setup_perl.sh && \
./setup_apache.sh && \
./setup_privoxy.sh && \
./setup_php.sh "${PHP_VERSION}" && \