Skip to content

Commit

Permalink
add fclose to decrease memory consumption, use a new variable to allo…
Browse files Browse the repository at this point in the history
…w fclose function
  • Loading branch information
JoMessina committed Nov 19, 2024
1 parent 8bd9897 commit de9bdbd
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions src/Builder/Capacity/Lookup/Download.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,23 @@ public function getNode(): Node
),
),
),
new Node\Stmt\Expression(
expr: new Node\Expr\Assign(
var: new Node\Expr\Variable('imageFromAkeneo'),
expr: new Node\Expr\MethodCall(
var: new Node\Expr\MethodCall(
var: new Node\Expr\Variable('data'),
name: new Node\Identifier('getBody')
),
name: new Node\Identifier('detach')
)
),
),
new Node\Stmt\Expression(
expr: new Node\Expr\FuncCall(
name: new Node\Name('stream_copy_to_stream'),
args: [
new Node\Arg(
new Node\Expr\MethodCall(
var: new Node\Expr\MethodCall(
var: new Node\Expr\Variable('data'),
name: new Node\Identifier('getBody')
),
name: new Node\Identifier('detach')
)
),
new Node\Arg(new Node\Expr\Variable('imageFromAkeneo')),
new Node\Arg(new Node\Expr\Variable('image')),
]
),
Expand Down Expand Up @@ -163,6 +167,14 @@ public function getNode(): Node
],
]
),
new Node\Stmt\Expression(
expr: new Node\Expr\FuncCall(
name: new Node\Name('fclose'),
args: [
new Node\Arg(new Node\Expr\Variable('imageFromAkeneo')),
]
),
),
],
catches: [
new Node\Stmt\Catch_(
Expand Down

0 comments on commit de9bdbd

Please sign in to comment.