闭包序列化失败:在抽象语法树中找不到闭包

时间:2016-02-05 13:01:11

标签: laravel serialization laravel-5.1 homestead

我在生产中收到此错误,但未在本地测试中收到:

  

闭包序列化失败:在抽象语法树中找不到闭包。

我在我的本地机器上使用Homestead / Vagrant来确保环境与生产类似,我无法追踪为什么我在生产中开始接收这个,因为我在本地测试中根本没有收到它。

下面是代码片段,非常感谢任何想法。

$selecttable = mysql_query("SELECT * FROM $tablename WHERE (preis_bis <= '$price_upper' AND preis_bis > '$price_lower') LIMIT 1");
for ($i = 0; $i < mysql_num_fields($selecttable); $i++) {
  $field_info = mysql_fetch_field($selecttable, $i);

  // not WORKING
  while($rowvalue = mysql_fetch_row($selecttable)) {
    echo "<tr><td>Price: ".$rowvalue[$i]."</td></tr>";
  }

  echo "<tr><td style='border:1px solid #c0c0c0;padding:10px;'><!-- {$field_info->name} -->";
  // get Logo and provider name
  $select_getlogo = mysql_query("SELECT * FROM rrv_anbieter WHERE aid = '$field_info->name' LIMIT 1");
  while($row_logo = mysql_fetch_object($select_getlogo)){
    echo $row_logo->name.'<br><img src="images/'.$row_logo->logo.'" style="max-width: 200px;">';
  }      
  #while($rowvalues2 = mysql_fetch_row($selecttable)) {        
  #  foreach($rowvalues2 as $_column) {
  #    echo "<td>{$_column}</td>";
  #  }      
  #}      
  echo "</td></tr>";       
}

生产环境

foreach ($notifications as $notification) {
    $data = array('eventInfo' => $eventInfo, 'bowlerInfo' => $bowlerInfo, 'bowlerSchoolInfo' => $bowlerSchoolInfo,
        'matchInfo' => $match, 'notificationInfo' => $notification);

    Mail::queue('emails.matchEventAddedNotification', $data, function ($message) use ($notification, $bowlerInfo) {

        $dataHeader['category'] = 'Match Event Notification';
        $dataHeader['unique_args']['message'] = 'Email related to a new match event notification.';
        $dataHeader['unique_args']['bowler_id'] = $bowlerInfo['id'];
        $dataHeader['unique_args']['matchevents_notify_id'] = $notification['id'];
        $header = json_encode($dataHeader);
        $message->getSwiftMessage()->getHeaders()->addTextHeader('X-SMTPAPI', $header);
        $message->subject('New Score Added For' . ' ' . $bowlerInfo['first_name'] . ' ' . $bowlerInfo['last_name']);
        $message->to($notification['email']);
    });

    $matcheventNotify = Matchevent_Notify::find($notification['id']);
    $matcheventNotify->last_sent = Carbon::now();
    $matcheventNotify->save();
}

1 个答案:

答案 0 :(得分:0)

我能够追踪这个问题。问题是我在生产中使用的队列工作者。我正在使用守护程序队列工作程序,但我无法重新启动队列工作程序,因此它无法识别我的新代码。 Laravel文档中的相关信息:

php artisan queue:restart

Deploying With Daemon Queue Listeners