Annotation of embedaddon/php/ext/soap/tests/bugs/bug39815.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #39815 (to_zval_double() in ext/soap/php_encoding.c is not locale-independent)
! 3: --SKIPIF--
! 4: <?php
! 5: require_once('skipif.inc');
! 6: if (!function_exists('setlocale')) die('skip setlocale() not available');
! 7: if (!@setlocale(LC_ALL, 'sv_SE', 'sv_SE.ISO8859-1')) die('skip sv_SE locale not available');
! 8: if (!@setlocale(LC_ALL, 'en_US', 'en_US.ISO8859-1')) die('skip en_US locale not available');
! 9: ?>
! 10: --INI--
! 11: precision=14
! 12: soap.wsdl_cache_enabled=0
! 13: --FILE--
! 14: <?php
! 15: function test(){
! 16: return 123.456;
! 17: }
! 18: class LocalSoapClient extends SoapClient {
! 19:
! 20: function __construct($wsdl, $options) {
! 21: parent::__construct($wsdl, $options);
! 22: $this->server = new SoapServer($wsdl, $options);
! 23: $this->server->addFunction('test');
! 24: }
! 25:
! 26: function __doRequest($request, $location, $action, $version, $one_way = 0) {
! 27: ob_start();
! 28: $this->server->handle($request);
! 29: $response = ob_get_contents();
! 30: ob_end_clean();
! 31: return $response;
! 32: }
! 33:
! 34: }
! 35: $x = new LocalSoapClient(NULL,array('location'=>'test://',
! 36: 'uri'=>'http://testuri.org',
! 37: "trace"=>1));
! 38: setlocale(LC_ALL,"sv_SE","sv_SE.ISO8859-1");
! 39: var_dump($x->test());
! 40: echo $x->__getLastResponse();
! 41: setlocale(LC_ALL,"en_US","en_US.ISO8859-1");
! 42: var_dump($x->test());
! 43: echo $x->__getLastResponse();
! 44: --EXPECT--
! 45: float(123,456)
! 46: <?xml version="1.0" encoding="UTF-8"?>
! 47: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:testResponse><return xsi:type="xsd:float">123.456</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
! 48: float(123.456)
! 49: <?xml version="1.0" encoding="UTF-8"?>
! 50: <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://testuri.org" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:testResponse><return xsi:type="xsd:float">123.456</return></ns1:testResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>