“没有勺子”或:PHP中出现意外错误0xdeadbeef

时间:2010-02-01 18:33:15

标签: php

我有一些PHP代码,如下所示。我有一个陷阱告诉我数据输入是否与代码中的任何测试都不匹配(“没有勺子”,它说。聪明,嗯?)。

当数据出现时出现问题 - 可以看到的任何方式并不罕见,并且就此而言,与此陷阱中幸存的其他数据完全相似 - 无论如何都会以某种方式匹配其中一项测试。当然,“意外错误”错误输出输入的数据,只是为了确保。据我所知,输入数据没有任何问题。

首先,有输出,这可能会使事情更容易理解:

Customer XXXXXXXXXXXX, DID XXXXX2515  has been billed already for 2010-01.
Deleting last billing from database before continuing.
This DID is a Toll Free Number.
Trunkrate is therefore: 0.05
Starting billing for DID XXXXXX2515
Trunkrate: 0.05 Type: TFN

2010-01-22 15:45:15: billsecs: 22 billMin: 1 Source: XXXXXX0808 Destination: XXXXXX2515
Error 34: There is no spoon.
Source: XXXXXX0808 Destination: XXXXXX2515 Did: XXXXXX2515  Type: TFN

2010-01-12 14:49:41: billsecs: 55 billMin: 1 Source: 0000000000 Destination: XXXXXX2515
Error 34: There is no spoon.
Source: 0000000000 Destination: XXXXXX2515 Did: XXXXXX2515  Type: TFN

2010-01-12 11:46:45: billsecs: 6 billMin: 1 Source: XXXXXX8689 Destination: XXXXXX2515
Error 34: There is no spoon.
Source: XXXXXX8689 Destination: XXXXXX2515 Did: XXXXXX2515  Type: TFN

2010-01-08 12:56:57: billsecs: 610 billMin: 11 Source: XXXXXX2515 Destination: 1XXXXXX0798
Error 34: There is no spoon.
Source: XXXXXX2515 Destination: 1XXXXXX0798 Did: XXXXXX2515  Type: TFN

2010-01-07 11:01:49: billsecs: 17 billMin: 1 Source: XXXXXX2515 Destination: 011XXXXXXX41022
Error 34: There is no spoon.
Source: XXXXXX2515 Destination: 011XXXXXXX41022 Did: XXXXXX2515  Type: TFN

2010-01-05 11:20:24: billsecs: 7 billMin: 1 Source: XXXXXX0928 Destination: XXXXXX2515
Error 34: There is no spoon.
Source: XXXXXX0928 Destination: XXXXXX2515 Did: XXXXXX2515  Type: TFN

并使用代码:

// If the call is incoming, just charge the trunk rate.
if ($thisCall['dst'] == $did && $type == "IAX") {
    $ldrate = 0;
    $location = "British Columbia";
    $calltype = "NALD";

if ($debug) print "Incoming call to IAX trunk.\n";

// Incoming calls to TFNs
} elseif ($thisCall['dst'] == $did && $type == "TFN") {

    $ldrate = 0;
    $location = "Toll-Free";
    $calltype = "NALD";

// If the call is outgoing, check to see if it's local
} elseif ($thisCall['src'] == $did) {

    // If the outgoing call is local, just charge the trunk rate
    // In this case, src is our customer, dst is remote end
    if (callIsLocal($thisCall['src'], $thisCall['dst'])) {
        $ldrate = 0;
        $location = "British Columbia";
        $calltype = "NALD";
    }

    // If the outgoing call is long distance, get the rate from the database
    else {
        $ratearr = getRate($thisCall['dst']);

        $ldrate = $ratearr['ldrate'];
        $location = $ratearr['location'];
        $calltype = $ratearr['calltype'];

        if ($debug) print "LDrate: $ldrate, Location: $location, Calltype: $calltype\n";
    }
} else {
    print "Error 34: There is no spoon.\n";
    print "Source: " . $thisCall['src'] . " Destination: " . $thisCall['dst'];
    print " Did: $did Type: $type\n ";
    continue;
}

1 个答案:

答案 0 :(得分:2)

我宁愿使用var_dump()而不是print来显示变量的内容。也许你错过了一个领先/尾随的空白。

else {
  print "Error 34: There is no spoon.\n";
  print "Source="; var_dump($thisCall['src']);
  print "Destination="; var_dump($thisCall['dst']);
  print "did="; var_dump($did);
  print "Type="; var_dump($type);
  continue;
}
相关问题