# E-Mail als Datei speichern create\_function deprecated (PHP 7.2)

**URL:** https://forum.shopware.com/t/e-mail-als-datei-speichern-create-function-deprecated-php-7-2/57274
**Category:** Programmierung
**Created:** [4. Januar 2019 um 07:15 UTC](https://forum.shopware.com/t/e-mail-als-datei-speichern-create-function-deprecated-php-7-2/57274 "2019-01-04T07:15:42Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![DerChris](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@DerChris](https://forum.shopware.com/u/DerChris)
#### Post date: [4. Januar 2019 um 07:15 UTC](https://forum.shopware.com/t/e-mail-als-datei-speichern-create-function-deprecated-php-7-2/57274/1 "2019-01-04T07:15:42Z")

</div>

Hi,

ich versuche für mein Test-System die gesendeten E-Mails als Datei abzulegen. In der Doku bin ich auch fündig geworden ([https://docs.shopware.com/de/shopware-5-de/einstellungen/e-mails#mailversand-als-file](https://docs.shopware.com/de/shopware-5-de/einstellungen/e-mails#mailversand-als-file)) aber der Befehl create\_function ist in PHP 7.2 deprecated.

Dann dachte ich mir, gut, machste ne anonymous function draus. Leider bekam ich dann diese Meldung:

> [04-Jan-2019 08:04:07 Europe/Berlin] PHP Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\RuntimeException: Unable to dump a service container if a parameter is an object or a resource.

&nbsp;

Hier ist der Ausschnitt aus meiner config.php:

```
    'mail' => array(
        'type' => 'file',
        'path' => $this->DocPath('mails'),
        'callback' => function ($transport) {
            return "ShopwareMail_" . sha1($transport->body) . "_" . str_replace("@", "[at]", $transport->recipients) . ".eml";
        },
    ),

```

&nbsp;

---

<div class="post-metadata">

### Author: ![wontfix](https://avatars.discourse-cdn.com/v4/letter/w/b19c9b/32.png) [@wontfix](https://forum.shopware.com/u/wontfix)
#### Post date: [4. Januar 2019 um 09:29 UTC](https://forum.shopware.com/t/e-mail-als-datei-speichern-create-function-deprecated-php-7-2/57274/2 "2019-01-04T09:29:59Z")

</div>

hab noch nie vorher von “callback” wert gehört, und zumindest wir brauchen es nicht in shopware 5.4.6:

```
'mail' => [
    'type' => 'file',
    'path' => 'var/log'
],

```

das schreibt bei uns datein wie zbs. `var/log/ZendMail_1545395107_1175411388.tmp` und in console kann man mit `qprint -d var/log/ZendMail_1545395107_1175411388.tmp` es decoden.

ist diese “callback” eine shopware 5.5 monstrosität?  
könnte jemand es bitte besser dokumentieren in [config.php settings](https://developers.shopware.com/developers-guide/shopware-config/)

---

<div class="post-metadata">

### Author: ![wontfix](https://avatars.discourse-cdn.com/v4/letter/w/b19c9b/32.png) [@wontfix](https://forum.shopware.com/u/wontfix)
#### Post date: [4. Januar 2019 um 09:31 UTC](https://forum.shopware.com/t/e-mail-als-datei-speichern-create-function-deprecated-php-7-2/57274/3 "2019-01-04T09:31:25Z")

</div>

oh, und braucht nicht auch shopware 5.5 maximal php 7.0?

---

<div class="post-metadata">

### Author: ![shyim](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/shyim/32/7681_2.png) [@shyim](https://forum.shopware.com/u/shyim)
#### Post date: [4. Januar 2019 um 15:28 UTC](https://forum.shopware.com/t/e-mail-als-datei-speichern-create-function-deprecated-php-7-2/57274/4 "2019-01-04T15:28:00Z")

</div>

callback ist veraltet und man braucht es seit ewigkeiten nicht mehr. Einfach weglassen
