Php MinkXML处理不符合预期,在提要中添加反斜杠

Php MinkXML处理不符合预期,在提要中添加反斜杠,php,xml,behat,mink,goutte,Php,Xml,Behat,Mink,Goutte,我正在使用Mink和Goutte webdriver,试图用XML提要替换网站中表单的内容 我用以下方法编码: public function replaceField($field) { $baseText = '<?xml version="1.0" encoding="UTF-8"?> <RiskAssessmentReply xmlns="http://test.com" > <!-- ExternalId of the Or

我正在使用Mink和Goutte webdriver,试图用XML提要替换网站中表单的内容

我用以下方法编码:

public function replaceField($field)
    {
        $baseText = '<?xml version="1.0" encoding="UTF-8"?>
<RiskAssessmentReply xmlns="http://test.com" >
    <!-- ExternalId of the Order --> 
    <OrderId>TO_REPLACE</OrderId>
    <RiskInfo>
        <Actions>
            <SystemAction>SystemAction</SystemAction>
            <FinalAction>FinalAction</FinalAction>
        </Actions>
        <Score SystemScore="0"/>
    </RiskInfo>
    <!-- One of Accept, Manual_Accept, Reject, Cancel, or Ignore --> 
    <ResponseCode>Accept</ResponseCode>
    <StoreId>TESTSTORE</StoreId>
</RiskAssessmentReply>';

        $textWithOrderId = preg_replace('/TO_REPLACE/', $GLOBALS['ORDER_ID'], $baseText);
        $this->getSession()->getPage()->fillField($field, $textWithOrderId);
    }
因此,当我尝试提交XML提要时,网站显示以下错误:

|  Fatal error: Uncaught exception 'ErrorException' with message 'SimpleXMLElement::__construct(): Entity: line 1: parser error : String not started expecting ' or "'
我曾尝试使用PHP中的
stripslashes
方法,但它不起作用,好像我在添加订单ID后尝试了一个echo,它会显示原始XML而不带斜杠,所以我猜在使用
fillField
时会调用其他函数,该函数确实会将反斜杠添加到我的文本中,但是我还没有找到它的来源

有人知道从
\”
的转换是在哪里进行的,以避免这种情况吗


谢谢

请确保在PHP中禁用Magic Quotes设置,尤其是在您提交的服务器上。从PHP5.4.0开始,它们将被删除


请确保您在接收表单的页面中使用的是StripCslash而不是StripSlash。

魔法引号已打开,我对此无能为力,但谢谢。这是我尝试的第一件事,正是我遇到的问题。谢谢
|  Fatal error: Uncaught exception 'ErrorException' with message 'SimpleXMLElement::__construct(): Entity: line 1: parser error : String not started expecting ' or "'