ID:               48290
 User updated by:  kexianbin at diyism dot com
-Summary:          provide a function to get caller scope variables
 Reported By:      kexianbin at diyism dot com
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Irrelevant
 PHP Version:      5.3.1
 New Comment:

I've changed the summary of the request.


Previous Comments:
------------------------------------------------------------------------

[2009-08-10 12:26:41] kexianbin at diyism dot com

For the most convenience of we php programmers,
maybe we should make a patch to the variable parsing module of double
quoted strings in the php engine,
to parse variables, while add slashes to them for such formats:
"{#variable_name}",

for example:
<?
$name="myname";
$value="my'value";
echo "insert into z_test (name, value) values ('{$name}',
'{#value}')";
?>
we should get:
insert into z_test (name, value) values ('myname', 'my\'value')

------------------------------------------------------------------------

[2009-08-10 12:18:22] kexianbin at diyism dot com

Or i could write like this:

$_='addslashes';

$sql="insert into z_test (name, value) values ('{$name}',
'{$_($value)}')";
mysql_query($sql);

------------------------------------------------------------------------

[2009-08-10 11:26:11] kexianbin at diyism dot com

Maybe currently i could write like this:

$sql=eval(safe(
     "insert into z_test (name, value) values ('{$name}', '{#value}')"
     ));
mysql_query($sql);

------------------------------------------------------------------------

[2009-08-10 11:25:26] kexianbin at diyism dot com

Maybe&nbsp;currently&nbsp;i&nbsp;could&nbsp;write&nbsp;like&nbsp;this:

$sql=eval(safe(
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"insert&nbsp;into&nbsp;z_test&nbsp;(name,&nbsp;value)&nbsp;values&nbsp;('{$name}',&nbsp;'{#value}')"
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;));
mysql_query($sql);

------------------------------------------------------------------------

[2009-08-03 05:24:58] kexianbin at diyism dot com

Sigh, few people noticed this.

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/48290

-- 
Edit this bug report at http://bugs.php.net/?id=48290&edit=1

Reply via email to