"Kaşık yok"

1 Cevap

Ben aşağıda listelenen, bazı PHP kodu var. Ben veri giriş kodu testlerinin herhangi uymuyor eğer bana söyler bir tuzak var ("kaşık yok", diyor. Zeki, ha?).

O I görebilirsiniz, ve bu konuda, bu tuzak hayatta diğer veriler tamamen benzer olduğunu herhangi bir şekilde olağandışı değil - - Veri zaman sorun geldiğini does maç testlerden biri nasılsa yine aracılığıyla yapar. Ve elbette, "beklenmeyen hata" hata sadece emin olmak için, giriş oldu verileri verir. Bildiğim kadarıyla söyleyebilirim, bu veri girişi onunla yanlış bir şey vardır.

İlk olarak, anlamak için işler biraz daha kolay yapmak olabilir çıkış var:

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

Ve, kodu ile:

// 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 Cevap

Ben oldukça değişkenlerin içeriğini görüntülemek yerine baskı var_dump() kullanmak istiyorum. Belki kaçırdığımız bir sondaki / lider boşluk var.

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;
}