Why dummy callback used in ob_start?

3 years ago

Slava.Aurim
Member | 14
+
0
-

I'm learning Nette source and often see such code:
ob_start(function () {}) (for example, in Latte\Runtime\Template::capture() )

Why this dummy callback used for ob_start? What problem this solves? Why not ob_start(null)?

3 years ago

David Grudl
Nette Core | 6864
+
0
-

3 years ago

Slava.Aurim
Member | 14
+
0
-

@DavidGrudl, thank you very much – for this safety tip! Unfortunately, this information is not available in the php documentation or it comments. And I checked it – indeed, such an approach prevents the printing of messages about php errors.