Skip to content

Commit 569b773

Browse files
committed
minor #16349 [VarExporter] Make example work (antalaron)
This PR was merged into the 4.4 branch. Discussion ---------- [VarExporter] Make example work The exported php file is not a valid php as it does not contain the opening tag and has no `return` and closing semicolon. So the require won't work as expected. Commits ------- 5832e22 Make example work
2 parents b9b8b0b + 5832e22 commit 569b773

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/var_exporter.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ PHP code, similar to PHP's :phpfunction:`var_export` function::
2828

2929
$exported = VarExporter::export($someVariable);
3030
// store the $exported data in some file or cache system for later reuse
31-
$data = file_put_contents('exported.php', $exported);
31+
$data = file_put_contents('exported.php', '<?php return '.$exported.';');
3232

3333
// later, regenerate the original variable when you need it
3434
$regeneratedVariable = require 'exported.php';

0 commit comments

Comments
 (0)