View Issue Details

IDProjectCategoryView StatusLast Update
0001648OXID eShop (all versions)1.02. Price calculations (discounts, coupons, additional costs etc.)public2012-12-10 13:27
Reporterandreas_ziethen 
PriorityimmediateSeverityblockReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version4.5.0_beta3 
Summary0001648: Missing catch of warnings - especially on online-vat-id-check
DescriptionToday we got a call by a shop-owner: customers wrote him that the order process does not work any longer. One customer put this error messages in his email:
---------------------------------------
Warning: SoapClient::SoapClient(http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl) [soapclient.soapclient]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /htdocs/www.voipango.de/core/oxonlinevatidcheck.php on line 137

Warning: SoapClient::SoapClient() [soapclient.soapclient]: I/O warning : failed to load external entity "http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl" in /htdocs/www.voipango.de/core/oxonlinevatidcheck.php on line 137

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/www.voipango.de/core/oxonlinevatidcheck.php:137) in /htdocs/www.voipango.de/core/oxutils.php on line 817

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/www.voipango.de/core/oxonlinevatidcheck.php:137) in /htdocs/www.voipango.de/core/oxutils.php on line 818

Warning: Cannot modify header information - headers already sent by (output started at /htdocs/www.voipango.de/core/oxonlinevatidcheck.php:137) in /htdocs/www.voipango.de/core/oxutils.php on line 819
---------------------------------------

So no orders could be made if a customer used his VAT ID and company name.
The warning is not catched so we should have a special handling vor warnings cause oxshopcontrol::_runonce() sets the error-handling to E_ALL ^ E_NOTICE if the server config logs errors.

So I suggest to implement something like this into the whole exception handling stuff:

set_error_handler("oxWarningHandler", E_WARNING);

function oxWarningHandler($errno, $errstr) {
    // do something sensefull ...
        // and put it to EXCEPTION.log
}
TagsVAT
Theme
BrowserAll
PHP Versionany
Database Versionany

Relationships

related to 0001687 resolvedarvydas_vapsva Online VAT-ID check not available anymore 

Activities

dainius.bigelis

2010-02-05 13:56

reporter   ~0002340

Looks like the service over this wsdl http://ec.europa.eu/taxation_customs/vies/api/checkVatPort?wsdl does not work any more. Need to investigate ASAP - which link should be used for this service.
@Developers: please write some temporary workaround here if possible (i.e. disabling VAT ID check in source code), to allow order processing.

2010-02-05 14:32

 

oxmodonlinevatidcheck.php (441 bytes)

arvydas_vapsva

2010-02-05 14:34

reporter   ~0002342

given url does not work at the moment, so i made a module (attached), which disables soap call and marks Vat ID as valid. On urgent cases this may be helpful.

To enable it add this to modules config:

oxonlinevatidcheck => oxmodonlinevatidcheck

andreas_ziethen

2010-02-05 14:46

reporter   ~0002343

URL does work now again ... - but as I said: we do need a proper handling for warnings here so that they do not hinder order processing

arvydas_vapsva

2010-02-05 15:00

reporter   ~0002344

Last edited: 2010-02-05 15:00

we're working on that. Bad thing is that SOAP connection exception cant be cought by standard try/catch block.

arvydas_vapsva

2010-02-09 16:28

reporter   ~0002349

fixed

arvydas_vapsva

2010-02-09 16:32

reporter   ~0002350

in case you need ASAP fix just make a module for oxonlinevatidcheck class:

class module extends module_parent
{
    /**
     * Catches soap warning which is usually thrown due to setvice problems.
     * Return true and allows to continue process
     *
     * @param int $iErrNo error type number
     * @param string $sErrStr error message
     * @param string $sErrFile error file
     * @param int $iErrLine error line
     *
     * @return bool
     */
    public function catchWarning( $iErrNo, $sErrStr, $sErrFile, $iErrLine )
    {
        // message to write to exception log
        $sLogMessage = "Warning: $sErrStr in $sErrFile on line $iErrLine";

        // fetching exception log file name
        $oEx = new oxException();
        $sLogFileName = $oEx->getLogFileName();

        // logs error message
        return oxUtils::getInstance()->writeToLog( $sLogMessage, $sLogFileName );
    }

     /**
     * Checks online if USt.ID number is valid.
     * Returns true on success. On error sets error value.
     *
     * @param object $oCheckVat vat object
     *
     * @return bool
     */
    protected function _checkOnline( $oCheckVat )
    {
        // setting local error handler to catch possible soap errors
        set_error_handler( array( $this, 'catchWarning' ), E_WARNING );

        $blReturn = parent::_checkOnline( $oCheckVat );

        // restoring previous error handler
        restore_error_handler();

        return $blReturn;
    }
}