php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9466 Eval With return doesn't work
Submitted: 2001-02-26 13:32 UTC Modified: 2001-02-26 14:05 UTC
From: pvzweden at caiw dot nl Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: 4.0.3pl1 OS: Linux
Private report: No CVE-ID: None
 [2001-02-26 13:32 UTC] pvzweden at caiw dot nl
When i create a piece of code with eval like :

eval = "if (!isset(\$$value)) {";
eval .= "  return 0; "
eval .= "}";
eval("$eval");

The return statement doesn't work.
It works with earlier versions of php. (php3).

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-02-26 14:05 UTC] cnewbill@php.net
It does work with a CVS snapshot.

<?php

$eval = "return 123;";

$e = eval("$eval");

var_dump($e);

?>

OUTPUT

int(123)

You also did not have a ";" terminating your return 0 line.  Fix your code and try again.  If the problem persists try a CVS snapshot from http://snaps.php.net and reopen this report.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 05 19:01:30 2024 UTC