📄 bug34066.phpt
字号:
--TEST--Bug #34066 (recursive array_walk causes segfault)--FILE--<?php $order = array( "DocID" => "1", "DocDate" => "19.09.06", "ReSubmissionDate" => "", "DocTyp" => "Stapelauftrag", "CustID" => "00000", "CustomerAddress" => array( array( "Name1" => 'name1', "Name2" => 'name2', "Name3" => "", "City" => 'city', "Street" => 'street', "Postal" => 'postcode', "IATA" => "90", "Country" => "Deutschland", "ShortName" => 'short', "ContactKey" => "", "EMail" => 'email@example.com', ) ), "Text1" => "", "Text2" => "", "Wildcard1" => "", "Wildcard2" => "", "Dispatch" => "Paketdienst", "Weight" => "0,0", "BillingCustID" => "4300200000", "ExtDocNr" => "00000000003", "AnalysisLock" => "", "PrintFlag" => "", "FormType" => "0", "Curr" => "EUR", "ExChangeRate" => "1,0000", "WIRRate" => "0", "OneTimeCustomer" => array( array( "BankCode" => "", "BankAccount" => "" ) ), "Language" => "0", "PriceGroup" => "1", "PrFlag" => "0", "SalesTaxKey" => "1", "ProceedKey" => "0", "CustDiscountGroup" => "0", "Discount" => array( array( "FinDisc1" => "0,00", "Disc1Base" => "145,72", "Disc1Value" => "0,00", "FinDisc2" => "0,00", "Disc2Base" => "145,72", "Disc2Value" => "0,00", "FinDisc3" => "0,00", "Disc3Base" => "145,72", "Disc3Value" => "0,00", "ValueSummary" => "0,00" ) ), "Contact" => array( array( "Repr" => "999", "Region" => "99", "Commission" => "0,00", "Agent" => "000000" ) ), "Booking" => array( array( "CostUnit" => "0000000000", "CostCentre" => "0000000000", "AccountingArea"=> "01" ) ), "InvoiceCycleKey" => "0", "AnalysisKey" => "", "OrderNumber" => "", "OrderDate" => "", "OrderCode" => "", "DocItems" => array( "DocItem" => array( "PosType" => "1", "ItemRef" => "1002", "CRef" => "", "Desc1" => "Pr�sentation Niederlande per", "Desc2" => "", "ArticleGroup" => "102", "PosTypeVersion" => "E", "Delivery" => array( array( "DelWeek" => "", "DelDay" => "", "DelTime" => "" ) ), "PricePu" => "145,72", "PriceUnit" => "0", "PriceCalculation" => "0", "ItemVal" => "145,72", "InputKey" => "0", "AveragePurchasePrice" => "0", "Tax" => array( array( "TaxCode" => "00", "TaxBra" => "000", "TaxBraAccess" => "0", "TaxSumIndex" => "0" ) ), "DiscountArticle" => array( array( "DiscPC" => "0,00", "DiscKey" => "1" ) ), "ProceedKeyArticle" => "01", "ActionKey" => "00", "ContactCommissionArticle"=> "0,00", "QuantDependantPriceKey"=> "", "Quant" => "1", "QuantUnit" => "", "Meas" => array( array( "Count" => "1", "Length" => "0,000", "Width" => "0,000", "Height" => "0,000" ) ), "DecimalPlace" => "0", "MultiplierQuant" => "1,000000", "DifferingQuantUnit" => "", "DecimalPlaceConversion"=> "0", "WeightArticle" => array( array( "Amount" => "0", "Unit" => "0" ) ), "Wreath" => "0,000", "Stock" => "1", "CostUnitArticle" => "", "SerialNbKey" => "0", "TextComplementKey" => "0", "PartsListPrintKey" => "", "Prod" => "0000000000" ) ), "Payment" => array( "PaymentKey" => "0", "ReminderKey" => "00", "PayTerms" => array( array( "PayTerm" => "1", "PayDays" => "000", "CashDiscDays1" => "000", "CashDiscDays2" => "000", "CashDiscPer1" => "0,00", "CashDiscPer2" => "0,00" ), array( "PayTerm" => "2", "PayDays" => "000", "CashDiscDays1" => "000", "CashDiscDays2" => "000", "CashDiscPer1" => "0,00", "CashDiscPer2" => "0,00" ) ) ), "NetAmountByTurnOverTax" => array( array( "TurnOverTaxFree" => "145,72", "TurnOverTax1" => "0,00", "TurnOverTax2" => "0,00", "TurnOverTax3" => "0,00", "TurnOverTax4" => "0,00", "TurnOverTax5" => "0,00", "TurnOverTax6" => "0,00", "TurnOverTax7" => "0,00", "TurnOverTax8" => "0,00" ), ), "GrossAmount" => "145,72", "ProceedAmount" => "145,72", "NetAmountByPayTerm2" => array( array( "Sum0" => "0,00", "Sum1" => "0,00", "Sum2" => "0,00", "Sum3" => "0,00", "Sum4" => "0,00", "Sum5" => "0,00", "Sum6" => "0,00", "Sum7" => "0,00", "Sum8" => "0,00" ), ), "TaxCodes" => array( array( "TaxCode1" => "0", "TaxCode2" => "0", "TaxCode3" => "0", "TaxCode4" => "0", "TaxCode5" => "0", "TaxCode6" => "0", "TaxCode7" => "0", "TaxCode8" => "0" ) ) ); $docs = array( array( "Version" => "1.0", "ProducerName" => "xxxxxxxx", "ProductName" => "Classic Line", "xmlns" => "x-schema:CL310_DezABFSchema.XML" ), "Company" => array( array( "MandateNumber" => "111", "MandateName" => "xxx xxxxxxx-xxxxx xxxxxxx", "MandateCurr" => "EUR" ), ), "Doc" => $order ); dump2xml($docs);function dump2xml($array) { // output of this goes through 2xml array_walk(&$array, "gen_xml", "/Docs/");}function gen_xml($val, $key, $prefix){ global $xml_fd; print "gen_xml(prefix=$prefix)\n"; if (is_array($val)) { if (preg_match('/^\d+$/', $key)) { if ($key == 1) { print substr($prefix, 0, -1) . "\n"; } array_walk(&$val, "gen_xml", "$prefix@"); } else { array_walk(&$val, "gen_xml", "$prefix$key/"); } } else { if (strlen($val) > 0) print "$prefix$key=$val\n"; else print "$prefix$key\n"; } print "gen_xml(prefix=$prefix) end\n";}echo "Done\n";?>--EXPECTF-- gen_xml(prefix=/Docs/)gen_xml(prefix=/Docs/@)/Docs/@Version=1.0gen_xml(prefix=/Docs/@) endgen_xml(prefix=/Docs/@)/Docs/@ProducerName=xxxxxxxxgen_xml(prefix=/Docs/@) endgen_xml(prefix=/Docs/@)/Docs/@ProductName=Classic Linegen_xml(prefix=/Docs/@) endgen_xml(prefix=/Docs/@)/Docs/@xmlns=x-schema:CL310_DezABFSchema.XMLgen_xml(prefix=/Docs/@) endgen_xml(prefix=/Docs/) endgen_xml(prefix=/Docs/)gen_xml(prefix=/Docs/Company/)gen_xml(prefix=/Docs/Company/@)/Docs/Company/@MandateNumber=111gen_xml(prefix=/Docs/Company/@) endgen_xml(prefix=/Docs/Company/@)/Docs/Company/@MandateName=xxx xxxxxxx-xxxxx xxxxxxxgen_xml(prefix=/Docs/Company/@) endgen_xml(prefix=/Docs/Company/@)/Docs/Company/@MandateCurr=EURgen_xml(prefix=/Docs/Company/@) endgen_xml(prefix=/Docs/Company/) endgen_xml(prefix=/Docs/) endgen_xml(prefix=/Docs/)gen_xml(prefix=/Docs/Doc/)/Docs/Doc/DocID=1gen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/DocDate=19.09.06gen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/ReSubmissionDategen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/DocTyp=Stapelauftraggen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/CustID=00000gen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)gen_xml(prefix=/Docs/Doc/CustomerAddress/)gen_xml(prefix=/Docs/Doc/CustomerAddress/@)/Docs/Doc/CustomerAddress/@Name1=name1gen_xml(prefix=/Docs/Doc/CustomerAddress/@) endgen_xml(prefix=/Docs/Doc/CustomerAddress/@)/Docs/Doc/CustomerAddress/@Name2=name2gen_xml(prefix=/Docs/Doc/CustomerAddress/@) endgen_xml(prefix=/Docs/Doc/CustomerAddress/@)/Docs/Doc/CustomerAddress/@Name3gen_xml(prefix=/Docs/Doc/CustomerAddress/@) endgen_xml(prefix=/Docs/Doc/CustomerAddress/@)/Docs/Doc/CustomerAddress/@City=citygen_xml(prefix=/Docs/Doc/CustomerAddress/@) endgen_xml(prefix=/Docs/Doc/CustomerAddress/@)/Docs/Doc/CustomerAddress/@Street=streetgen_xml(prefix=/Docs/Doc/CustomerAddress/@) endgen_xml(prefix=/Docs/Doc/CustomerAddress/@)/Docs/Doc/CustomerAddress/@Postal=postcodegen_xml(prefix=/Docs/Doc/CustomerAddress/@) endgen_xml(prefix=/Docs/Doc/CustomerAddress/@)/Docs/Doc/CustomerAddress/@IATA=90gen_xml(prefix=/Docs/Doc/CustomerAddress/@) endgen_xml(prefix=/Docs/Doc/CustomerAddress/@)/Docs/Doc/CustomerAddress/@Country=Deutschlandgen_xml(prefix=/Docs/Doc/CustomerAddress/@) endgen_xml(prefix=/Docs/Doc/CustomerAddress/@)/Docs/Doc/CustomerAddress/@ShortName=shortgen_xml(prefix=/Docs/Doc/CustomerAddress/@) endgen_xml(prefix=/Docs/Doc/CustomerAddress/@)/Docs/Doc/CustomerAddress/@ContactKeygen_xml(prefix=/Docs/Doc/CustomerAddress/@) endgen_xml(prefix=/Docs/Doc/CustomerAddress/@)/Docs/Doc/CustomerAddress/@EMail=email@example.comgen_xml(prefix=/Docs/Doc/CustomerAddress/@) endgen_xml(prefix=/Docs/Doc/CustomerAddress/) endgen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/Text1gen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/Text2gen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/Wildcard1gen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/Wildcard2gen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/Dispatch=Paketdienstgen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/Weight=0,0gen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/BillingCustID=4300200000gen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/ExtDocNr=00000000003gen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/AnalysisLockgen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/PrintFlaggen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/FormType=0gen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/Curr=EURgen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/ExChangeRate=1,0000gen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/WIRRate=0gen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)gen_xml(prefix=/Docs/Doc/OneTimeCustomer/)gen_xml(prefix=/Docs/Doc/OneTimeCustomer/@)/Docs/Doc/OneTimeCustomer/@BankCodegen_xml(prefix=/Docs/Doc/OneTimeCustomer/@) endgen_xml(prefix=/Docs/Doc/OneTimeCustomer/@)/Docs/Doc/OneTimeCustomer/@BankAccountgen_xml(prefix=/Docs/Doc/OneTimeCustomer/@) endgen_xml(prefix=/Docs/Doc/OneTimeCustomer/) endgen_xml(prefix=/Docs/Doc/) endgen_xml(prefix=/Docs/Doc/)/Docs/Doc/Language=0gen_xml(prefix=/Docs/Doc/) end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -