Req #55617 [Com]: make array to support mode class

2011-09-21 Thread kexianbin at diyism dot com
Edit report at https://bugs.php.net/bug.php?id=55617edit=1

 ID: 55617
 Comment by: kexianbin at diyism dot com
 Reported by:kexianbin at diyism dot com
 Summary:make array to support mode class
 Status: Open
 Type:   Feature/Change Request
 Package:Class/Object related
 Operating System:   Irrelevant
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

It's easier to realize MyPHP(Mode Class PHP) based on quercus,
because you doesn't need to write a super GC or JIT to be fast(like in C), 
only a compiler.


Previous Comments:

[2011-09-06 07:52:08] kexianbin at diyism dot com

Description:

In my mind, we phper can thoroughly throw away the concept of Object(class 
instance), we only need Array and Mode Class:

All arrays in initial mode support any array function as it's method:

?php
$array1-array_flip(this);
?

Use -mode() to validate the minimal data set, and then switch mode class:

?php
$array1-mode('class1', $success);
?

Any mode class has no construct() in it, but has validate() to validate the 
minimal data set.

The array in a mode still could use array function as its method, but after 
using any of them the array will be switched back into basic array mode, and we 
need to use -mode('class1', $success); to switch mode back.

The radical thought is data-centric programming, we need seperate the 
data(array) and the activity(class method).

We could modify php engine, to get rid of parts of OO(object oriented), and 
support Mode Class, we could call it MyPHP.

For example: $array_man1 could be set into two modes:cls_normal_man and 
cls_crazy_man:

?php
$array_man1-mode('cls_normal_man')-normal_method1()-mode('cls_crazy_man')-crazy_method1();
?







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55617edit=1


[PHP-BUG] Req #55617 [NEW]: make array to support mode class

2011-09-06 Thread kexianbin at diyism dot com
From: 
Operating system: Irrelevant
PHP version:  Irrelevant
Package:  Class/Object related
Bug Type: Feature/Change Request
Bug description:make array to support mode class

Description:

In my mind, we phper can thoroughly throw away the concept of Object(class
instance), we only need Array and Mode Class:

All arrays in initial mode support any array function as it's method:

?php
$array1-array_flip(this);
?

Use -mode() to validate the minimal data set, and then switch mode
class:

?php
$array1-mode('class1', $success);
?

Any mode class has no construct() in it, but has validate() to validate
the minimal data set.

The array in a mode still could use array function as its method, but after
using any of them the array will be switched back into basic array mode,
and we need to use -mode('class1', $success); to switch mode back.

The radical thought is data-centric programming, we need seperate the
data(array) and the activity(class method).

We could modify php engine, to get rid of parts of OO(object oriented), and
support Mode Class, we could call it MyPHP.

For example: $array_man1 could be set into two modes:cls_normal_man and
cls_crazy_man:

?php
$array_man1-mode('cls_normal_man')-normal_method1()-mode('cls_crazy_man')-crazy_method1();
?


-- 
Edit bug report at https://bugs.php.net/bug.php?id=55617edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55617r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55617r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=55617r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55617r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55617r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55617r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=55617r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=55617r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=55617r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=55617r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=55617r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=55617r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=55617r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55617r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=55617r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=55617r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=55617r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=55617r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=55617r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=55617r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=55617r=mysqlcfg



Req #48290 [Bgs-Opn]: auto escape for variables in double quoted sql string

2010-03-22 Thread kexianbin at diyism dot com
Edit report at http://bugs.php.net/bug.php?id=48290edit=1

 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported by:  kexianbin at diyism dot com
 Summary:  auto escape for variables in double quoted sql string
-Status:   Bogus
+Status:   Open
 Type: Feature/Change Request
-Package:  Feature/Change Request
+Package:  *General Issues
 Operating System: Irrelevant
-PHP Version:  5.3.2
+PHP Version:  5.3.3

 New Comment:

,


Previous Comments:

[2009-12-16 10:41:10] der...@php.net

.


[2009-12-16 08:52:56] kexianbin at diyism dot com

I think to realize auto escape for double quoted strings is easier than
to inherit variables from parent scope.


[2009-11-27 01:53:32] kexianbin at diyism dot com

Rasmus,



Another way,



similar to reserved word 'global' to inherit variables from global
scope, why can't we add a reserved word 'inherit' to inherit varialbes
from parent scope?



I think it's very useful since it's a great advantage now aday in
javascript communities.



Malcolm


[2009-11-19 07:12:38] ras...@php.net

We did get rid of it.


[2009-11-19 07:12:06] kexianbin at diyism dot com

For matching preciseness,

we could only support the format: ...{#BatchId}...,

not to support this format: ...#BatchId




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/bug.php?id=48290


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


Req #48290 [Opn]: auto escape for variables in double quoted sql string

2010-03-22 Thread kexianbin at diyism dot com
Edit report at http://bugs.php.net/bug.php?id=48290edit=1

 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported by:  kexianbin at diyism dot com
 Summary:  auto escape for variables in double quoted sql string
 Status:   Open
 Type: Feature/Change Request
 Package:  *General Issues
 Operating System: Irrelevant
 PHP Version:  5.3.3

 New Comment:

,


Previous Comments:

[2010-03-22 10:29:52] kexianbin at diyism dot com

,


[2009-12-16 10:41:10] der...@php.net

.


[2009-12-16 08:52:56] kexianbin at diyism dot com

I think to realize auto escape for double quoted strings is easier than
to inherit variables from parent scope.


[2009-11-27 01:53:32] kexianbin at diyism dot com

Rasmus,



Another way,



similar to reserved word 'global' to inherit variables from global
scope, why can't we add a reserved word 'inherit' to inherit varialbes
from parent scope?



I think it's very useful since it's a great advantage now aday in
javascript communities.



Malcolm


[2009-11-19 07:12:38] ras...@php.net

We did get rid of it.




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/bug.php?id=48290


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


Req #48290 [Opn]: auto escape for variables in double quoted sql string

2010-03-22 Thread kexianbin at diyism dot com
Edit report at http://bugs.php.net/bug.php?id=48290edit=1

 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported by:  kexianbin at diyism dot com
 Summary:  auto escape for variables in double quoted sql string
 Status:   Open
 Type: Feature/Change Request
 Package:  *General Issues
 Operating System: Irrelevant
 PHP Version:  5.3.3

 New Comment:

,


Previous Comments:

[2010-03-22 10:30:07] kexianbin at diyism dot com

,


[2010-03-22 10:29:52] kexianbin at diyism dot com

,


[2009-12-16 10:41:10] der...@php.net

.


[2009-12-16 08:52:56] kexianbin at diyism dot com

I think to realize auto escape for double quoted strings is easier than
to inherit variables from parent scope.


[2009-11-27 01:53:32] kexianbin at diyism dot com

Rasmus,



Another way,



similar to reserved word 'global' to inherit variables from global
scope, why can't we add a reserved word 'inherit' to inherit varialbes
from parent scope?



I think it's very useful since it's a great advantage now aday in
javascript communities.



Malcolm




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/bug.php?id=48290


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


Req #48290 [Bgs]: auto escape for variables in double quoted sql string

2010-03-22 Thread kexianbin at diyism dot com
Edit report at http://bugs.php.net/bug.php?id=48290edit=1

 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported by:  kexianbin at diyism dot com
 Summary:  auto escape for variables in double quoted sql string
 Status:   Bogus
 Type: Feature/Change Request
 Package:  *General Issues
 Operating System: Irrelevant
 PHP Version:  5.3.3

 New Comment:

function safe_query($scope, $sql)

 {extract($scope);

  $sql=strtr($sql, array(''='\', '\\'=''));

  $sql=eval('return '.preg_replace(array('/\{#(.*?)\}/'),
array('.addslashes($\1).'), $sql).';');

  mysql_query($sql);

 }

safe_query(get_defined_vars(),

   insert into z_test (name, value) values ('{$name}',
'{#value}')

  );


Previous Comments:

[2010-03-22 10:39:42] johan...@php.net

As others told you: This feature won't be implemented.


[2010-03-22 10:30:18] kexianbin at diyism dot com

,


[2010-03-22 10:30:07] kexianbin at diyism dot com

,


[2010-03-22 10:29:52] kexianbin at diyism dot com

,


[2009-12-16 10:41:10] der...@php.net

.




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/bug.php?id=48290


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


#48290 [WFx-Opn]: auto escape for variables in double quoted sql string

2009-12-16 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
-Status:   Wont fix
+Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

I think to realize auto escape for double quoted strings is easier than
to inherit variables from parent scope.


Previous Comments:


[2009-11-27 01:53:32] kexianbin at diyism dot com

Rasmus,

Another way,

similar to reserved word 'global' to inherit variables from global
scope, why can't we add a reserved word 'inherit' to inherit varialbes
from parent scope?

I think it's very useful since it's a great advantage now aday in
javascript communities.

Malcolm



[2009-11-19 07:12:38] ras...@php.net

We did get rid of it.



[2009-11-19 07:12:06] kexianbin at diyism dot com

For matching preciseness,
we could only support the format: ...{#BatchId}...,
not to support this format: ...#BatchId



[2009-11-19 07:07:51] kexianbin at diyism dot com

Rasmus,

We really should to get rid of sql string auto escape in data of POST,
GET, COOKIE etc,
instead, we put off the sql string auto escape right before the sql
string to be executed.



[2009-11-11 01:52:04] kexianbin at diyism dot com

Derick,

The problem is right in prepared statements:
$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$Keyword,
':BatchNum'=$BatchNum,
':ApvChannelID_old'=$ApvChannelID_old,
':ApvCategoryID_old'=$ApvCategoryID_old
   )
 );
$data=$sql-fetch(PDO::FETCH_ASSOC);

We need not preparation similar to other languages,
we need immediate escape and parse for varialbles in query strings:
$rs=$pdo-query(select *
 from sem_SearchChangeShow
 where Keyword={#Keyword}
   and BatchNum={#BatchNum}
   and OldChannelID={#ApvChannelID_old}
   and OldCategoryID={#ApvCategoryID_old}
   );
$data=$rs-fetch(PDO::FETCH_ASSOC);



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=48290edit=1



#48290 [WFx]: auto escape for variables in double quoted sql string

2009-11-26 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Wont fix
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

Rasmus,

Another way,

similar to reserved word 'global' to inherit variables from global
scope, why can't we add a reserved word 'inherit' to inherit varialbes
from parent scope?

I think it's very useful since it's a great advantage now aday in
javascript communities.

Malcolm


Previous Comments:


[2009-11-19 07:12:38] ras...@php.net

We did get rid of it.



[2009-11-19 07:12:06] kexianbin at diyism dot com

For matching preciseness,
we could only support the format: ...{#BatchId}...,
not to support this format: ...#BatchId



[2009-11-19 07:07:51] kexianbin at diyism dot com

Rasmus,

We really should to get rid of sql string auto escape in data of POST,
GET, COOKIE etc,
instead, we put off the sql string auto escape right before the sql
string to be executed.



[2009-11-11 01:52:04] kexianbin at diyism dot com

Derick,

The problem is right in prepared statements:
$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$Keyword,
':BatchNum'=$BatchNum,
':ApvChannelID_old'=$ApvChannelID_old,
':ApvCategoryID_old'=$ApvCategoryID_old
   )
 );
$data=$sql-fetch(PDO::FETCH_ASSOC);

We need not preparation similar to other languages,
we need immediate escape and parse for varialbles in query strings:
$rs=$pdo-query(select *
 from sem_SearchChangeShow
 where Keyword={#Keyword}
   and BatchNum={#BatchNum}
   and OldChannelID={#ApvChannelID_old}
   and OldCategoryID={#ApvCategoryID_old}
   );
$data=$rs-fetch(PDO::FETCH_ASSOC);



[2009-11-10 10:21:09] der...@php.net

Stop spamming this bug system, you use prepared statements in this
case.



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=48290edit=1



#48290 [WFx]: auto escape for variables in double quoted sql string

2009-11-18 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Wont fix
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

Rasmus,

We really should to get rid of sql string auto escape in data of POST,
GET, COOKIE etc,
instead, we put off the sql string auto escape right before the sql
string to be executed.


Previous Comments:


[2009-11-11 01:52:04] kexianbin at diyism dot com

Derick,

The problem is right in prepared statements:
$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$Keyword,
':BatchNum'=$BatchNum,
':ApvChannelID_old'=$ApvChannelID_old,
':ApvCategoryID_old'=$ApvCategoryID_old
   )
 );
$data=$sql-fetch(PDO::FETCH_ASSOC);

We need not preparation similar to other languages,
we need immediate escape and parse for varialbles in query strings:
$rs=$pdo-query(select *
 from sem_SearchChangeShow
 where Keyword={#Keyword}
   and BatchNum={#BatchNum}
   and OldChannelID={#ApvChannelID_old}
   and OldCategoryID={#ApvCategoryID_old}
   );
$data=$rs-fetch(PDO::FETCH_ASSOC);



[2009-11-10 10:21:09] der...@php.net

Stop spamming this bug system, you use prepared statements in this
case.



[2009-11-10 09:54:32] kexianbin at diyism dot com

auto escape for variables in double quoted sql string



[2009-11-10 09:53:42] kexianbin at diyism dot com

Changed the title to auto escape for variables in double quotes sql
string.



[2009-11-10 09:51:53] kexianbin at diyism dot com

Changed the title.



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=48290edit=1



#48290 [WFx]: auto escape for variables in double quoted sql string

2009-11-18 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Wont fix
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

For matching preciseness,
we could only support the format: ...{#BatchId}...,
not to support this format: ...#BatchId


Previous Comments:


[2009-11-19 07:07:51] kexianbin at diyism dot com

Rasmus,

We really should to get rid of sql string auto escape in data of POST,
GET, COOKIE etc,
instead, we put off the sql string auto escape right before the sql
string to be executed.



[2009-11-11 01:52:04] kexianbin at diyism dot com

Derick,

The problem is right in prepared statements:
$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$Keyword,
':BatchNum'=$BatchNum,
':ApvChannelID_old'=$ApvChannelID_old,
':ApvCategoryID_old'=$ApvCategoryID_old
   )
 );
$data=$sql-fetch(PDO::FETCH_ASSOC);

We need not preparation similar to other languages,
we need immediate escape and parse for varialbles in query strings:
$rs=$pdo-query(select *
 from sem_SearchChangeShow
 where Keyword={#Keyword}
   and BatchNum={#BatchNum}
   and OldChannelID={#ApvChannelID_old}
   and OldCategoryID={#ApvCategoryID_old}
   );
$data=$rs-fetch(PDO::FETCH_ASSOC);



[2009-11-10 10:21:09] der...@php.net

Stop spamming this bug system, you use prepared statements in this
case.



[2009-11-10 09:54:32] kexianbin at diyism dot com

auto escape for variables in double quoted sql string



[2009-11-10 09:53:42] kexianbin at diyism dot com

Changed the title to auto escape for variables in double quotes sql
string.



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=48290edit=1



#48290 [WFx]: make a patch to the variable parsing module of double quoted strings

2009-11-10 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Wont fix
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

Must have a solution in the world.

If we can't build the auto escape for double quotes sql string,
we can build get_caller_vars to realize the simpler auto escape of
double quotes sql string.


Previous Comments:


[2009-11-10 07:45:21] ras...@php.net

We are trying to get rid of features like addslashes, not make more
similar ones.



[2009-11-10 07:18:53] kexianbin at diyism dot com

I still wanna reopen this request very much,

If anybody could realize this that will give PHP a special advantage
over other languages.



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

Rasmus,

Similar to this in php.ini file:

//Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off

we could add double_quotes_escape_for_db = mysql into php.ini.



[2009-11-10 05:35:33] kexianbin at diyism dot com

OK, maybe there is another solution.



[2009-11-10 05:33:02] ras...@php.net

Stop re-opening this please.  Escaping needs to be db-specific since
different dbs use different escape chars.  Therefore it cannot be done
generically at the language level.



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=48290edit=1



#48290 [WFx]: auto escape for double quotes sql string

2009-11-10 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
-Summary:  make a patch to the variable parsing module of double
   quoted strings
 Reported By:  kexianbin at diyism dot com
 Status:   Wont fix
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

Changed the title.


Previous Comments:


[2009-11-10 09:39:51] kexianbin at diyism dot com

Must have a solution in the world.

If we can't build the auto escape for double quotes sql string,
we can build get_caller_vars to realize the simpler auto escape of
double quotes sql string.



[2009-11-10 07:45:21] ras...@php.net

We are trying to get rid of features like addslashes, not make more
similar ones.



[2009-11-10 07:18:53] kexianbin at diyism dot com

I still wanna reopen this request very much,

If anybody could realize this that will give PHP a special advantage
over other languages.



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

Rasmus,

Similar to this in php.ini file:

//Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off

we could add double_quotes_escape_for_db = mysql into php.ini.



[2009-11-10 05:35:33] kexianbin at diyism dot com

OK, maybe there is another solution.



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=48290edit=1



#48290 [WFx]: auto escape for variables in double quotes sql string

2009-11-10 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
-Summary:  auto escape for double quotes sql string
 Reported By:  kexianbin at diyism dot com
 Status:   Wont fix
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

Changed the title to auto escape for variables in double quotes sql
string.


Previous Comments:


[2009-11-10 09:51:53] kexianbin at diyism dot com

Changed the title.



[2009-11-10 09:39:51] kexianbin at diyism dot com

Must have a solution in the world.

If we can't build the auto escape for double quotes sql string,
we can build get_caller_vars to realize the simpler auto escape of
double quotes sql string.



[2009-11-10 07:45:21] ras...@php.net

We are trying to get rid of features like addslashes, not make more
similar ones.



[2009-11-10 07:18:53] kexianbin at diyism dot com

I still wanna reopen this request very much,

If anybody could realize this that will give PHP a special advantage
over other languages.



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

Rasmus,

Similar to this in php.ini file:

//Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off

we could add double_quotes_escape_for_db = mysql into php.ini.



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=48290edit=1



#48290 [WFx]: auto escape for variables in double quoted sql string

2009-11-10 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
-Summary:  auto escape for variables in double quotes sql string
 Reported By:  kexianbin at diyism dot com
 Status:   Wont fix
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

auto escape for variables in double quoted sql string


Previous Comments:


[2009-11-10 09:53:42] kexianbin at diyism dot com

Changed the title to auto escape for variables in double quotes sql
string.



[2009-11-10 09:51:53] kexianbin at diyism dot com

Changed the title.



[2009-11-10 09:39:51] kexianbin at diyism dot com

Must have a solution in the world.

If we can't build the auto escape for double quotes sql string,
we can build get_caller_vars to realize the simpler auto escape of
double quotes sql string.



[2009-11-10 07:45:21] ras...@php.net

We are trying to get rid of features like addslashes, not make more
similar ones.



[2009-11-10 07:18:53] kexianbin at diyism dot com

I still wanna reopen this request very much,

If anybody could realize this that will give PHP a special advantage
over other languages.



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=48290edit=1



#48290 [WFx]: auto escape for variables in double quoted sql string

2009-11-10 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Wont fix
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

Derick,

The problem is right in prepared statements:
$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$Keyword,
':BatchNum'=$BatchNum,
':ApvChannelID_old'=$ApvChannelID_old,
':ApvCategoryID_old'=$ApvCategoryID_old
   )
 );
$data=$sql-fetch(PDO::FETCH_ASSOC);

We need not preparation similar to other languages,
we need immediate escape and parse for varialbles in query strings:
$rs=$pdo-query(select *
 from sem_SearchChangeShow
 where Keyword={#Keyword}
   and BatchNum={#BatchNum}
   and OldChannelID={#ApvChannelID_old}
   and OldCategoryID={#ApvCategoryID_old}
   );
$data=$rs-fetch(PDO::FETCH_ASSOC);


Previous Comments:


[2009-11-10 10:21:09] der...@php.net

Stop spamming this bug system, you use prepared statements in this
case.



[2009-11-10 09:54:32] kexianbin at diyism dot com

auto escape for variables in double quoted sql string



[2009-11-10 09:53:42] kexianbin at diyism dot com

Changed the title to auto escape for variables in double quotes sql
string.



[2009-11-10 09:51:53] kexianbin at diyism dot com

Changed the title.



[2009-11-10 09:39:51] kexianbin at diyism dot com

Must have a solution in the world.

If we can't build the auto escape for double quotes sql string,
we can build get_caller_vars to realize the simpler auto escape of
double quotes sql string.



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=48290edit=1



#47515 [Opn]: make create_function to execute immediately

2009-11-09 Thread kexianbin at diyism dot com
 ID:   47515
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: windows xp
-PHP Version:  5.3.0
+PHP Version:  5.3.1
 New Comment:

Any response?


Previous Comments:


[2009-08-07 08:30:22] kexianbin at diyism dot com

Any change?



[2009-05-15 05:21:49] kexianbin at diyism dot com

Currently in php 5.3.0RC3 2009.5.15:

$fun=function($v){echo $v;};
$fun('hello');

but can not do these:

function($v){echo $v;}('hello');
(function($v){echo $v;})('hello');
($fun=function($v){echo $v;})('hello');



[2009-05-15 05:20:56] kexianbin at diyism dot com

Currently in php 5.3.0RC3 2009.5.15:

$fun=function($v){echo $v;};
$fun('hello');

but can not do these:

function($v){echo $v;}('hello');
(function($v){echo $v;})('hello');
($fun=function($v){echo $v;})('hello');



[2009-02-27 01:49:34] kexianbin at diyism dot com

Description:

I submit a function request:
to make create_function to execute immediately like this:

When could we realize this in php?

create_function('$v', 'nowdoc'
echo $v;
nowdoc
)('hello');

I know i can type thus:
$f=create_function('$v', 'nowdoc'
echo $v;
nowdoc
);
$f('hello');

even thus:
${!${''}=create_function('$v', 'nowdoc'
echo $v;
nowdoc
)}('hello');

but both the 2nd and 3rd are ugly, i need the 1st style.

Expected result:

Show 'hello'

Actual result:
--
Show 'Parse error: parse error'





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



#23022 [Com]: Supported dereferencing array indeces on arbitrary expressions

2009-11-09 Thread kexianbin at diyism dot com
 ID:   23022
 Comment by:   kexianbin at diyism dot com
 Reported By:  mfisc...@php.net
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Any
 PHP Version:  5CVS-2003-04-02 (dev)
 New Comment:

For objects, you could hack like this:
class user
  {public $username='jack';
   public function __get($prop_name)
  {return $this-$prop_name();
  }
   private function degree()
   {return array('doctor', 'master');
   }
  }
$aUser=new user();
echo $aUser-degree[1];


Previous Comments:


[2009-11-05 05:43:34] glennwidener at gmail dot com

I found this lack of symmetry in array references really lame too.  If
an expression delivers an array, then you should be able to reference an
element of that array.  The only question is operator precedence and
grouping: recommend following the C rules - primary expressions group
left to right, parenthesis disambiguate.



[2009-02-26 08:44:45] kexianbin at diyism dot com

When could we realize this in php?

create_function('$v', 'fun_code'
echo $v;
fun_code
)('hello');



[2009-02-26 08:20:58] kexianbin at diyism dot com

When could we realize this in php?

create_function('$v', 'fun_code'
echo $v;
fun_code
')('hello');



[2009-02-09 03:13:11] Anatorian at gmail dot com

I think this feature is very important. It can make me happier in php
developing.



[2009-01-29 01:32:26] jim at akubo dot net

i wish you could use the * operator (like in c++) to derference
references, is there a way todo this in php? instead of writing a new
function like array_val



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/23022

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



#48290 [Bgs-Opn]: make a patch to the variable parsing module of double quoted strings

2009-11-09 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
-Status:   Bogus
+Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.1
 New Comment:

Try to reopen it.


Previous Comments:


[2009-08-11 02:41:41] kexianbin at diyism dot com

Why set this as bogus?

Why don't you realize that the advantage of PHP is right the incredible
convenience for web programmers?!

For example, 'substr' is of the best design in all these languages:
java, sql, javascript, python, ruby, etc,
...substr($aStr,index_start,length(=0)/index_after_end(0))...
that is just the right PHP tradition.

I know PDO and prepared statements is ok,
but those method is really trivial and by no means intuitive.

Why don't you just make a little change to the variable parsing
function of the double quoted strings to save we programmers a very
enormous time wasting?

In fact, we have no way to reduce the code if we adopt PDO and prepared
statements, obviously every variable name apears twice(even apears as a
question mark):
$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$v['Keyword'],
':BatchNum'=$v['BatchNum'],
':ApvChannelID_old'=$v['ApvChannelID_old'],
':ApvCategoryID_old'=$v['ApvCategoryID_old']
   )
 );
$tmp=$sql-fetch(PDO::FETCH_ASSOC);



[2009-08-10 13:15:25] j...@php.net

Or PDO.. :)



[2009-08-10 13:14:50] j...@php.net

Will never happen. You should start using MySQLi and prepared
statements.



[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);



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=48290edit=1



#48290 [Opn]: make a patch to the variable parsing module of double quoted strings

2009-11-09 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
-PHP Version:  5.3.1
+PHP Version:  5.3.2
 New Comment:

Update expected version to 5.3.2


Previous Comments:


[2009-11-10 04:12:30] kexianbin at diyism dot com

Try to reopen it.



[2009-08-11 02:41:41] kexianbin at diyism dot com

Why set this as bogus?

Why don't you realize that the advantage of PHP is right the incredible
convenience for web programmers?!

For example, 'substr' is of the best design in all these languages:
java, sql, javascript, python, ruby, etc,
...substr($aStr,index_start,length(=0)/index_after_end(0))...
that is just the right PHP tradition.

I know PDO and prepared statements is ok,
but those method is really trivial and by no means intuitive.

Why don't you just make a little change to the variable parsing
function of the double quoted strings to save we programmers a very
enormous time wasting?

In fact, we have no way to reduce the code if we adopt PDO and prepared
statements, obviously every variable name apears twice(even apears as a
question mark):
$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$v['Keyword'],
':BatchNum'=$v['BatchNum'],
':ApvChannelID_old'=$v['ApvChannelID_old'],
':ApvCategoryID_old'=$v['ApvCategoryID_old']
   )
 );
$tmp=$sql-fetch(PDO::FETCH_ASSOC);



[2009-08-10 13:15:25] j...@php.net

Or PDO.. :)



[2009-08-10 13:14:50] j...@php.net

Will never happen. You should start using MySQLi and prepared
statements.



[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')



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=48290edit=1



#48290 [WFx]: make a patch to the variable parsing module of double quoted strings

2009-11-09 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Wont fix
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

Rasmus,

Why not have a think about adding addslash function to double-quoted
strings?
That maybe the simplest solution for variables replacement in sql query
string.

With the addslash function in double-quoted strings, we could code like
this:
$rs=$pdo-query(select *
   from sem_SearchChangeShow
   where Keyword={#Keyword}
 and BatchNum={#BatchNum}
 and OldChannelID={#ApvChannelID_old}
 and OldCategoryID={#ApvCategoryID_old}
 );
$data=$rs-fetch(PDO::FETCH_ASSOC);

But, without it, we have to code like these:
$sql=$pdo-prepare(select *
   from sem_SearchChangeShow
   where Keyword=:Keyword
 and BatchNum=:BatchNum
 and OldChannelID=:ApvChannelID_old
 and OldCategoryID=:ApvCategoryID_old
 );
$sql-execute(array(':Keyword'=$Keyword,
   ':BatchNum'=$BatchNum,
   ':ApvChannelID_old'=$ApvChannelID_old,
   ':ApvCategoryID_old'=$ApvCategoryID_old
  )
);
$data=$sql-fetch(PDO::FETCH_ASSOC);

Please don't set the feature request to won't fix.


Previous Comments:


[2009-11-10 04:34:59] ras...@php.net

This is not going to happen.



[2009-11-10 04:23:10] kexianbin at diyism dot com

Update expected version to 5.3.2



[2009-11-10 04:12:30] kexianbin at diyism dot com

Try to reopen it.



[2009-08-11 02:41:41] kexianbin at diyism dot com

Why set this as bogus?

Why don't you realize that the advantage of PHP is right the incredible
convenience for web programmers?!

For example, 'substr' is of the best design in all these languages:
java, sql, javascript, python, ruby, etc,
...substr($aStr,index_start,length(=0)/index_after_end(0))...
that is just the right PHP tradition.

I know PDO and prepared statements is ok,
but those method is really trivial and by no means intuitive.

Why don't you just make a little change to the variable parsing
function of the double quoted strings to save we programmers a very
enormous time wasting?

In fact, we have no way to reduce the code if we adopt PDO and prepared
statements, obviously every variable name apears twice(even apears as a
question mark):
$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$v['Keyword'],
':BatchNum'=$v['BatchNum'],
':ApvChannelID_old'=$v['ApvChannelID_old'],
':ApvCategoryID_old'=$v['ApvCategoryID_old']
   )
 );
$tmp=$sql-fetch(PDO::FETCH_ASSOC);



[2009-08-10 13:15:25] j...@php.net

Or PDO.. :)



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=48290edit=1



#48290 [WFx-Opn]: make a patch to the variable parsing module of double quoted strings

2009-11-09 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
-Status:   Wont fix
+Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

Rasmus, I insist that the feature request should be reopen, leave it
here until some day somebody may make it realized.


Previous Comments:


[2009-11-10 05:10:29] kexianbin at diyism dot com

Rasmus,

Why not have a think about adding addslash function to double-quoted
strings?
That maybe the simplest solution for variables replacement in sql query
string.

With the addslash function in double-quoted strings, we could code like
this:
$rs=$pdo-query(select *
   from sem_SearchChangeShow
   where Keyword={#Keyword}
 and BatchNum={#BatchNum}
 and OldChannelID={#ApvChannelID_old}
 and OldCategoryID={#ApvCategoryID_old}
 );
$data=$rs-fetch(PDO::FETCH_ASSOC);

But, without it, we have to code like these:
$sql=$pdo-prepare(select *
   from sem_SearchChangeShow
   where Keyword=:Keyword
 and BatchNum=:BatchNum
 and OldChannelID=:ApvChannelID_old
 and OldCategoryID=:ApvCategoryID_old
 );
$sql-execute(array(':Keyword'=$Keyword,
   ':BatchNum'=$BatchNum,
   ':ApvChannelID_old'=$ApvChannelID_old,
   ':ApvCategoryID_old'=$ApvCategoryID_old
  )
);
$data=$sql-fetch(PDO::FETCH_ASSOC);

Please don't set the feature request to won't fix.



[2009-11-10 04:34:59] ras...@php.net

This is not going to happen.



[2009-11-10 04:23:10] kexianbin at diyism dot com

Update expected version to 5.3.2



[2009-11-10 04:12:30] kexianbin at diyism dot com

Try to reopen it.



[2009-08-11 02:41:41] kexianbin at diyism dot com

Why set this as bogus?

Why don't you realize that the advantage of PHP is right the incredible
convenience for web programmers?!

For example, 'substr' is of the best design in all these languages:
java, sql, javascript, python, ruby, etc,
...substr($aStr,index_start,length(=0)/index_after_end(0))...
that is just the right PHP tradition.

I know PDO and prepared statements is ok,
but those method is really trivial and by no means intuitive.

Why don't you just make a little change to the variable parsing
function of the double quoted strings to save we programmers a very
enormous time wasting?

In fact, we have no way to reduce the code if we adopt PDO and prepared
statements, obviously every variable name apears twice(even apears as a
question mark):
$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$v['Keyword'],
':BatchNum'=$v['BatchNum'],
':ApvChannelID_old'=$v['ApvChannelID_old'],
':ApvCategoryID_old'=$v['ApvCategoryID_old']
   )
 );
$tmp=$sql-fetch(PDO::FETCH_ASSOC);



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=48290edit=1



#48290 [WFx]: make a patch to the variable parsing module of double quoted strings

2009-11-09 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Wont fix
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

OK, maybe there is another solution.


Previous Comments:


[2009-11-10 05:33:02] ras...@php.net

Stop re-opening this please.  Escaping needs to be db-specific since
different dbs use different escape chars.  Therefore it cannot be done
generically at the language level.



[2009-11-10 05:17:35] kexianbin at diyism dot com

Rasmus, I insist that the feature request should be reopen, leave it
here until some day somebody may make it realized.



[2009-11-10 05:10:29] kexianbin at diyism dot com

Rasmus,

Why not have a think about adding addslash function to double-quoted
strings?
That maybe the simplest solution for variables replacement in sql query
string.

With the addslash function in double-quoted strings, we could code like
this:
$rs=$pdo-query(select *
   from sem_SearchChangeShow
   where Keyword={#Keyword}
 and BatchNum={#BatchNum}
 and OldChannelID={#ApvChannelID_old}
 and OldCategoryID={#ApvCategoryID_old}
 );
$data=$rs-fetch(PDO::FETCH_ASSOC);

But, without it, we have to code like these:
$sql=$pdo-prepare(select *
   from sem_SearchChangeShow
   where Keyword=:Keyword
 and BatchNum=:BatchNum
 and OldChannelID=:ApvChannelID_old
 and OldCategoryID=:ApvCategoryID_old
 );
$sql-execute(array(':Keyword'=$Keyword,
   ':BatchNum'=$BatchNum,
   ':ApvChannelID_old'=$ApvChannelID_old,
   ':ApvCategoryID_old'=$ApvCategoryID_old
  )
);
$data=$sql-fetch(PDO::FETCH_ASSOC);

Please don't set the feature request to won't fix.



[2009-11-10 04:34:59] ras...@php.net

This is not going to happen.



[2009-11-10 04:23:10] kexianbin at diyism dot com

Update expected version to 5.3.2



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=48290edit=1



#48290 [WFx]: make a patch to the variable parsing module of double quoted strings

2009-11-09 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Wont fix
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

Rasmus,

Similar to this in php.ini file:

//Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off

we could add double_quotes_escape_for_db = mysql into php.ini.


Previous Comments:


[2009-11-10 05:35:33] kexianbin at diyism dot com

OK, maybe there is another solution.



[2009-11-10 05:33:02] ras...@php.net

Stop re-opening this please.  Escaping needs to be db-specific since
different dbs use different escape chars.  Therefore it cannot be done
generically at the language level.



[2009-11-10 05:17:35] kexianbin at diyism dot com

Rasmus, I insist that the feature request should be reopen, leave it
here until some day somebody may make it realized.



[2009-11-10 05:10:29] kexianbin at diyism dot com

Rasmus,

Why not have a think about adding addslash function to double-quoted
strings?
That maybe the simplest solution for variables replacement in sql query
string.

With the addslash function in double-quoted strings, we could code like
this:
$rs=$pdo-query(select *
   from sem_SearchChangeShow
   where Keyword={#Keyword}
 and BatchNum={#BatchNum}
 and OldChannelID={#ApvChannelID_old}
 and OldCategoryID={#ApvCategoryID_old}
 );
$data=$rs-fetch(PDO::FETCH_ASSOC);

But, without it, we have to code like these:
$sql=$pdo-prepare(select *
   from sem_SearchChangeShow
   where Keyword=:Keyword
 and BatchNum=:BatchNum
 and OldChannelID=:ApvChannelID_old
 and OldCategoryID=:ApvCategoryID_old
 );
$sql-execute(array(':Keyword'=$Keyword,
   ':BatchNum'=$BatchNum,
   ':ApvChannelID_old'=$ApvChannelID_old,
   ':ApvCategoryID_old'=$ApvCategoryID_old
  )
);
$data=$sql-fetch(PDO::FETCH_ASSOC);

Please don't set the feature request to won't fix.



[2009-11-10 04:34:59] ras...@php.net

This is not going to happen.



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=48290edit=1



#48290 [WFx]: make a patch to the variable parsing module of double quoted strings

2009-11-09 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Wont fix
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.2
 New Comment:

I still wanna reopen this request very much,

If anybody could realize this that will give PHP a special advantage
over other languages.


Previous Comments:


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

Rasmus,

Similar to this in php.ini file:

//Use Sybase-style magic quotes (escape ' with '' instead of \').
magic_quotes_sybase = Off

we could add double_quotes_escape_for_db = mysql into php.ini.



[2009-11-10 05:35:33] kexianbin at diyism dot com

OK, maybe there is another solution.



[2009-11-10 05:33:02] ras...@php.net

Stop re-opening this please.  Escaping needs to be db-specific since
different dbs use different escape chars.  Therefore it cannot be done
generically at the language level.



[2009-11-10 05:17:35] kexianbin at diyism dot com

Rasmus, I insist that the feature request should be reopen, leave it
here until some day somebody may make it realized.



[2009-11-10 05:10:29] kexianbin at diyism dot com

Rasmus,

Why not have a think about adding addslash function to double-quoted
strings?
That maybe the simplest solution for variables replacement in sql query
string.

With the addslash function in double-quoted strings, we could code like
this:
$rs=$pdo-query(select *
   from sem_SearchChangeShow
   where Keyword={#Keyword}
 and BatchNum={#BatchNum}
 and OldChannelID={#ApvChannelID_old}
 and OldCategoryID={#ApvCategoryID_old}
 );
$data=$rs-fetch(PDO::FETCH_ASSOC);

But, without it, we have to code like these:
$sql=$pdo-prepare(select *
   from sem_SearchChangeShow
   where Keyword=:Keyword
 and BatchNum=:BatchNum
 and OldChannelID=:ApvChannelID_old
 and OldCategoryID=:ApvCategoryID_old
 );
$sql-execute(array(':Keyword'=$Keyword,
   ':BatchNum'=$BatchNum,
   ':ApvChannelID_old'=$ApvChannelID_old,
   ':ApvCategoryID_old'=$ApvCategoryID_old
  )
);
$data=$sql-fetch(PDO::FETCH_ASSOC);

Please don't set the feature request to won't fix.



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=48290edit=1



#49367 [Opn]: Automatic type casting for the variable function name

2009-11-02 Thread kexianbin at diyism dot com
 ID:   49367
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Linux
-PHP Version:  5.3.0
+PHP Version:  5.3.1
 New Comment:

Change expected version to 5.3.1 from 5.3.0


Previous Comments:


[2009-08-26 03:02:21] kexianbin at diyism dot com

In fact, i make the above request for the SoWork PHP Framework:

?
define('this', mt_rand());
class cls_so_work
  {function __call($fun, $pars)
{foreach ($pars as $v)
 {if ($v===this)
 {$v=$this-val;
  break;
 }
 }
 $tmp=eval('return
defined('.$fun.')?constant('.$fun.'):'.$fun.';');
 $this-val=call_user_func_array($tmp, $pars);
 return $this;
}
   function __toString()
{return 'so_work';
}
   function cls_so_work()
{$obj=func_get_args();
 $this-val=isset($obj[0])?$obj[0]:null;
}
  }
function so_work()
 {$obj=func_get_args();
  if (isset($obj[0]))
 {return new cls_so_work($obj[0]);
 }
  else
  {if (!isset($GLOABALS['so_work']))
  {$GLOABALS['so_work']=new cls_so_work();
  }
   else
   {$GLOABALS['so_work']-val=null;
   }
   return $GLOABALS['so_work'];
  }
 }
$o=so_work();

define('echo', 'my_echo');
function my_echo($obj)
 {echo $obj;
  return $obj;
 }

//$o('abcd')-substr(this, 2, 2)-strlen(this)-echo(this);
$o-substr('abcd', 1, 3)-strlen(this)-echo(this);
?

The commented line in the end will raise the error.



[2009-08-26 02:57:13] kexianbin at diyism dot com

Description:

Currently, php 5.3.0 doesn't support automatic type casting for the
variable function name, we indeed need it, it could lead to very cool
applications.

Reproduce code:
---
?
class cls_so_work
  {function __toString()
{return 'so_work';
}
  }
function so_work()
 {echo 'hello';
 }

$o=new cls_so_work;
echo $o.'br';
$o();
?

Expected result:

so_work
hello

Actual result:
--
so_work
Fatal error: Function name must be a string in
E:\WWW\PhpApps\test\test.php on line 18 





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



#49367 [NEW]: Automatic type casting for the variable function name

2009-08-25 Thread kexianbin at diyism dot com
From: kexianbin at diyism dot com
Operating system: Linux
PHP version:  5.3.0
PHP Bug Type: Feature/Change Request
Bug description:  Automatic type casting for the variable function name

Description:

Currently, php 5.3.0 doesn't support automatic type casting for the
variable function name, we indeed need it, it could lead to very cool
applications.

Reproduce code:
---
?
class cls_so_work
  {function __toString()
{return 'so_work';
}
  }
function so_work()
 {echo 'hello';
 }

$o=new cls_so_work;
echo $o.'br';
$o();
?

Expected result:

so_work
hello

Actual result:
--
so_work
Fatal error: Function name must be a string in
E:\WWW\PhpApps\test\test.php on line 18 

-- 
Edit bug report at http://bugs.php.net/?id=49367edit=1
-- 
Try a snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=49367r=trysnapshot52
Try a snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=49367r=trysnapshot53
Try a snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=49367r=trysnapshot60
Fixed in SVN:
http://bugs.php.net/fix.php?id=49367r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=49367r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=49367r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=49367r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=49367r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=49367r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=49367r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=49367r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=49367r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=49367r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=49367r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=49367r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=49367r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=49367r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=49367r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=49367r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=49367r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=49367r=mysqlcfg



#49367 [Com]: Automatic type casting for the variable function name

2009-08-25 Thread kexianbin at diyism dot com
 ID:   49367
 Comment by:   kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Linux
 PHP Version:  5.3.0
 New Comment:

In fact, i make the above request for the SoWork PHP Framework:

?
define('this', mt_rand());
class cls_so_work
  {function __call($fun, $pars)
{foreach ($pars as $v)
 {if ($v===this)
 {$v=$this-val;
  break;
 }
 }
 $tmp=eval('return
defined('.$fun.')?constant('.$fun.'):'.$fun.';');
 $this-val=call_user_func_array($tmp, $pars);
 return $this;
}
   function __toString()
{return 'so_work';
}
   function cls_so_work()
{$obj=func_get_args();
 $this-val=isset($obj[0])?$obj[0]:null;
}
  }
function so_work()
 {$obj=func_get_args();
  if (isset($obj[0]))
 {return new cls_so_work($obj[0]);
 }
  else
  {if (!isset($GLOABALS['so_work']))
  {$GLOABALS['so_work']=new cls_so_work();
  }
   else
   {$GLOABALS['so_work']-val=null;
   }
   return $GLOABALS['so_work'];
  }
 }
$o=so_work();

define('echo', 'my_echo');
function my_echo($obj)
 {echo $obj;
  return $obj;
 }

//$o('abcd')-substr(this, 2, 2)-strlen(this)-echo(this);
$o-substr('abcd', 1, 3)-strlen(this)-echo(this);
?

The commented line in the end will raise the error.


Previous Comments:


[2009-08-26 02:57:13] kexianbin at diyism dot com

Description:

Currently, php 5.3.0 doesn't support automatic type casting for the
variable function name, we indeed need it, it could lead to very cool
applications.

Reproduce code:
---
?
class cls_so_work
  {function __toString()
{return 'so_work';
}
  }
function so_work()
 {echo 'hello';
 }

$o=new cls_so_work;
echo $o.'br';
$o();
?

Expected result:

so_work
hello

Actual result:
--
so_work
Fatal error: Function name must be a string in
E:\WWW\PhpApps\test\test.php on line 18 





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



#48290 [Opn]: provide a function to get caller scope variables

2009-08-10 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.0
 New Comment:

Maybenbsp;currentlynbsp;inbsp;couldnbsp;writenbsp;likenbsp;this:

$sql=eval(safe(
nbsp;nbsp;nbsp;nbsp;nbsp;insertnbsp;intonbsp;z_testnbsp;(name,nbsp;value)nbsp;valuesnbsp;('{$name}',nbsp;'{#value}')
nbsp;nbsp;nbsp;nbsp;nbsp;));
mysql_query($sql);


Previous Comments:


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

Sigh, few people noticed this.



[2009-05-15 06:28:06] yuyun0102 at gmail dot com

²ÝÄàÂí



[2009-05-15 06:08:47] kexianbin at diyism dot com

You will say to use PDO, but these code is so ugly:

$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$v['Keyword'],
':BatchNum'=$v['BatchNum'],
':ApvChannelID_old'=$v['ApvChannelID_old'],
':ApvCategoryID_old'=$v['ApvCategoryID_old']
   )
 );
$tmp=$sql-fetch(PDO::FETCH_ASSOC);



[2009-05-15 05:49:52] kexianbin at diyism dot com

Description:

Provide a function to get variables from caller scope.

I knew ticket 47454, 40339, 34210 are similar,
but this is indeed a useful function that was overlooked.

Reproduce code:
---
Currently:

$name=myname;
$value=lk,jdsk'jlkjdf;
function safe($sql)
 {$sql=strtr($sql, array(''='\', '\\'=''));
  return 'return '.preg_replace(array('/\{#(.*?)\}/'),
array('.addslashes($\1).'), $sql).';';
 }
$sql=insert into z_test (name, value) values ('{$name}',
'{#value}');
mysql_query(eval(safe($sql)));

If we have function get_caller_vars() in caller's scope:
(similar to get_defined_vars() in current scope)

$name=myname;
$value=lk,jdsk'jlkjdf;
function mysql_query_safe($sql)
 {extract(get_caller_vars());
  $sql=strtr($sql, array(''='\', '\\'=''));
  return 'return '.preg_replace(array('/\{#(.*?)\}/'),
array('.addslashes($\1).'), $sql).';';
  $sql=eval($sql);
  mysql_query($sql);
 }
$sql=insert into z_test (name, value) values ('{$name}',
'{#value}');
mysql_query_safe($sql);

Expected result:

We have a function to get variables in caller scope.

Actual result:
--
No such function.





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



#48290 [Opn]: provide a function to get caller scope variables

2009-08-10 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.0
 New Comment:

Maybe currently i could write like this:

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


Previous Comments:


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

Maybenbsp;currentlynbsp;inbsp;couldnbsp;writenbsp;likenbsp;this:

$sql=eval(safe(
nbsp;nbsp;nbsp;nbsp;nbsp;insertnbsp;intonbsp;z_testnbsp;(name,nbsp;value)nbsp;valuesnbsp;('{$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.



[2009-05-15 06:28:06] yuyun0102 at gmail dot com

²ÝÄàÂí



[2009-05-15 06:08:47] kexianbin at diyism dot com

You will say to use PDO, but these code is so ugly:

$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$v['Keyword'],
':BatchNum'=$v['BatchNum'],
':ApvChannelID_old'=$v['ApvChannelID_old'],
':ApvCategoryID_old'=$v['ApvCategoryID_old']
   )
 );
$tmp=$sql-fetch(PDO::FETCH_ASSOC);



[2009-05-15 05:49:52] kexianbin at diyism dot com

Description:

Provide a function to get variables from caller scope.

I knew ticket 47454, 40339, 34210 are similar,
but this is indeed a useful function that was overlooked.

Reproduce code:
---
Currently:

$name=myname;
$value=lk,jdsk'jlkjdf;
function safe($sql)
 {$sql=strtr($sql, array(''='\', '\\'=''));
  return 'return '.preg_replace(array('/\{#(.*?)\}/'),
array('.addslashes($\1).'), $sql).';';
 }
$sql=insert into z_test (name, value) values ('{$name}',
'{#value}');
mysql_query(eval(safe($sql)));

If we have function get_caller_vars() in caller's scope:
(similar to get_defined_vars() in current scope)

$name=myname;
$value=lk,jdsk'jlkjdf;
function mysql_query_safe($sql)
 {extract(get_caller_vars());
  $sql=strtr($sql, array(''='\', '\\'=''));
  return 'return '.preg_replace(array('/\{#(.*?)\}/'),
array('.addslashes($\1).'), $sql).';';
  $sql=eval($sql);
  mysql_query($sql);
 }
$sql=insert into z_test (name, value) values ('{$name}',
'{#value}');
mysql_query_safe($sql);

Expected result:

We have a function to get variables in caller scope.

Actual result:
--
No such function.





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



#48290 [Opn]: provide a function to get caller scope variables

2009-08-10 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
-PHP Version:  5.3.0
+PHP Version:  5.3.1
 New Comment:

Or i could write like this:

$_='addslashes';

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


Previous Comments:


[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

Maybenbsp;currentlynbsp;inbsp;couldnbsp;writenbsp;likenbsp;this:

$sql=eval(safe(
nbsp;nbsp;nbsp;nbsp;nbsp;insertnbsp;intonbsp;z_testnbsp;(name,nbsp;value)nbsp;valuesnbsp;('{$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.



[2009-05-15 06:28:06] yuyun0102 at gmail dot com

²ÝÄàÂí



[2009-05-15 06:08:47] kexianbin at diyism dot com

You will say to use PDO, but these code is so ugly:

$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$v['Keyword'],
':BatchNum'=$v['BatchNum'],
':ApvChannelID_old'=$v['ApvChannelID_old'],
':ApvCategoryID_old'=$v['ApvCategoryID_old']
   )
 );
$tmp=$sql-fetch(PDO::FETCH_ASSOC);



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=48290edit=1



#48290 [Opn]: provide a function to get caller scope variables

2009-08-10 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.1
 New Comment:

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')


Previous Comments:


[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

Maybenbsp;currentlynbsp;inbsp;couldnbsp;writenbsp;likenbsp;this:

$sql=eval(safe(
nbsp;nbsp;nbsp;nbsp;nbsp;insertnbsp;intonbsp;z_testnbsp;(name,nbsp;value)nbsp;valuesnbsp;('{$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.



[2009-05-15 06:28:06] yuyun0102 at gmail dot com

²ÝÄàÂí



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=48290edit=1



#48290 [Opn]: make a patch to the variable parsing module of double quoted strings

2009-08-10 Thread kexianbin at diyism dot com
 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

Maybenbsp;currentlynbsp;inbsp;couldnbsp;writenbsp;likenbsp;this:

$sql=eval(safe(
nbsp;nbsp;nbsp;nbsp;nbsp;insertnbsp;intonbsp;z_testnbsp;(name,nbsp;value)nbsp;valuesnbsp;('{$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=48290edit=1



#48290 [Bgs]: make a patch to the variable parsing module of double quoted strings

2009-08-10 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Bogus
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.1
 New Comment:

Why set this as bogus?

Why don't you realize that the advantage of PHP is right the incredible
convenience for web programmers?!

For example, 'substr' is of the best design in all these languages:
java, sql, javascript, python, ruby, etc,
...substr($aStr,index_start,length(=0)/index_after_end(0))...
that is just the right PHP tradition.

I know PDO and prepared statements is ok,
but those method is really trivial and by no means intuitive.

Why don't you just make a little change to the variable parsing
function of the double quoted strings to save we programmers a very
enormous time wasting?

In fact, we have no way to reduce the code if we adopt PDO and prepared
statements, obviously every variable name apears twice(even apears as a
question mark):
$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$v['Keyword'],
':BatchNum'=$v['BatchNum'],
':ApvChannelID_old'=$v['ApvChannelID_old'],
':ApvCategoryID_old'=$v['ApvCategoryID_old']
   )
 );
$tmp=$sql-fetch(PDO::FETCH_ASSOC);


Previous Comments:


[2009-08-10 13:15:25] j...@php.net

Or PDO.. :)



[2009-08-10 13:14:50] j...@php.net

Will never happen. You should start using MySQLi and prepared
statements.



[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);



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=48290edit=1



#47515 [Opn]: make create_function to execute immediately

2009-08-07 Thread kexianbin at diyism dot com
 ID:   47515
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: windows xp
-PHP Version:  5.3CVS-2009-02-27 (snap)
+PHP Version:  5.3.0
 New Comment:

Any change?


Previous Comments:


[2009-05-15 05:21:49] kexianbin at diyism dot com

Currently in php 5.3.0RC3 2009.5.15:

$fun=function($v){echo $v;};
$fun('hello');

but can not do these:

function($v){echo $v;}('hello');
(function($v){echo $v;})('hello');
($fun=function($v){echo $v;})('hello');



[2009-05-15 05:20:56] kexianbin at diyism dot com

Currently in php 5.3.0RC3 2009.5.15:

$fun=function($v){echo $v;};
$fun('hello');

but can not do these:

function($v){echo $v;}('hello');
(function($v){echo $v;})('hello');
($fun=function($v){echo $v;})('hello');



[2009-02-27 01:49:34] kexianbin at diyism dot com

Description:

I submit a function request:
to make create_function to execute immediately like this:

When could we realize this in php?

create_function('$v', 'nowdoc'
echo $v;
nowdoc
)('hello');

I know i can type thus:
$f=create_function('$v', 'nowdoc'
echo $v;
nowdoc
);
$f('hello');

even thus:
${!${''}=create_function('$v', 'nowdoc'
echo $v;
nowdoc
)}('hello');

but both the 2nd and 3rd are ugly, i need the 1st style.

Expected result:

Show 'hello'

Actual result:
--
Show 'Parse error: parse error'





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



#48290 [Opn]: provide a function to get caller scope variables

2009-08-02 Thread kexianbin at diyism dot com
 ID:   48290
 User updated by:  kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
-PHP Version:  5.3.0RC2
+PHP Version:  5.3.0
 New Comment:

Sigh, few people noticed this.


Previous Comments:


[2009-05-15 06:28:06] yuyun0102 at gmail dot com

²ÝÄàÂí



[2009-05-15 06:08:47] kexianbin at diyism dot com

You will say to use PDO, but these code is so ugly:

$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$v['Keyword'],
':BatchNum'=$v['BatchNum'],
':ApvChannelID_old'=$v['ApvChannelID_old'],
':ApvCategoryID_old'=$v['ApvCategoryID_old']
   )
 );
$tmp=$sql-fetch(PDO::FETCH_ASSOC);



[2009-05-15 05:49:52] kexianbin at diyism dot com

Description:

Provide a function to get variables from caller scope.

I knew ticket 47454, 40339, 34210 are similar,
but this is indeed a useful function that was overlooked.

Reproduce code:
---
Currently:

$name=myname;
$value=lk,jdsk'jlkjdf;
function safe($sql)
 {$sql=strtr($sql, array(''='\', '\\'=''));
  return 'return '.preg_replace(array('/\{#(.*?)\}/'),
array('.addslashes($\1).'), $sql).';';
 }
$sql=insert into z_test (name, value) values ('{$name}',
'{#value}');
mysql_query(eval(safe($sql)));

If we have function get_caller_vars() in caller's scope:
(similar to get_defined_vars() in current scope)

$name=myname;
$value=lk,jdsk'jlkjdf;
function mysql_query_safe($sql)
 {extract(get_caller_vars());
  $sql=strtr($sql, array(''='\', '\\'=''));
  return 'return '.preg_replace(array('/\{#(.*?)\}/'),
array('.addslashes($\1).'), $sql).';';
  $sql=eval($sql);
  mysql_query($sql);
 }
$sql=insert into z_test (name, value) values ('{$name}',
'{#value}');
mysql_query_safe($sql);

Expected result:

We have a function to get variables in caller scope.

Actual result:
--
No such function.





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



#48290 [Com]: provide a function to get caller scope variables

2009-05-15 Thread kexianbin at diyism dot com
 ID:   48290
 Comment by:   kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  5.3.0RC2
 New Comment:

You will say to use PDO, but these code is so ugly:

$sql=$pdo-prepare(select *
from sem_SearchChangeShow
where Keyword=:Keyword
  and BatchNum=:BatchNum
  and OldChannelID=:ApvChannelID_old
  and OldCategoryID=:ApvCategoryID_old
  );
$sql-execute(array(':Keyword'=$v['Keyword'],
':BatchNum'=$v['BatchNum'],
':ApvChannelID_old'=$v['ApvChannelID_old'],
':ApvCategoryID_old'=$v['ApvCategoryID_old']
   )
 );
$tmp=$sql-fetch(PDO::FETCH_ASSOC);


Previous Comments:


[2009-05-15 05:49:52] kexianbin at diyism dot com

Description:

Provide a function to get variables from caller scope.

I knew ticket 47454, 40339, 34210 are similar,
but this is indeed a useful function that was overlooked.

Reproduce code:
---
Currently:

$name=myname;
$value=lk,jdsk'jlkjdf;
function safe($sql)
 {$sql=strtr($sql, array(''='\', '\\'=''));
  return 'return '.preg_replace(array('/\{#(.*?)\}/'),
array('.addslashes($\1).'), $sql).';';
 }
$sql=insert into z_test (name, value) values ('{$name}',
'{#value}');
mysql_query(eval(safe($sql)));

If we have function get_caller_vars() in caller's scope:
(similar to get_defined_vars() in current scope)

$name=myname;
$value=lk,jdsk'jlkjdf;
function mysql_query_safe($sql)
 {extract(get_caller_vars());
  $sql=strtr($sql, array(''='\', '\\'=''));
  return 'return '.preg_replace(array('/\{#(.*?)\}/'),
array('.addslashes($\1).'), $sql).';';
  $sql=eval($sql);
  mysql_query($sql);
 }
$sql=insert into z_test (name, value) values ('{$name}',
'{#value}');
mysql_query_safe($sql);

Expected result:

We have a function to get variables in caller scope.

Actual result:
--
No such function.





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



#47515 [Com]: make create_function to execute immediately

2009-05-14 Thread kexianbin at diyism dot com
 ID:   47515
 Comment by:   kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: windows xp
 PHP Version:  5.3CVS-2009-02-27 (snap)
 New Comment:

Currently in php 5.3.0RC3 2009.5.15:

$fun=function($v){echo $v;};
$fun('hello');

but can not do these:

function($v){echo $v;}('hello');
(function($v){echo $v;})('hello');
($fun=function($v){echo $v;})('hello');


Previous Comments:


[2009-02-27 01:49:34] kexianbin at diyism dot com

Description:

I submit a function request:
to make create_function to execute immediately like this:

When could we realize this in php?

create_function('$v', 'nowdoc'
echo $v;
nowdoc
)('hello');

I know i can type thus:
$f=create_function('$v', 'nowdoc'
echo $v;
nowdoc
);
$f('hello');

even thus:
${!${''}=create_function('$v', 'nowdoc'
echo $v;
nowdoc
)}('hello');

but both the 2nd and 3rd are ugly, i need the 1st style.

Expected result:

Show 'hello'

Actual result:
--
Show 'Parse error: parse error'





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



#47515 [Com]: make create_function to execute immediately

2009-05-14 Thread kexianbin at diyism dot com
 ID:   47515
 Comment by:   kexianbin at diyism dot com
 Reported By:  kexianbin at diyism dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: windows xp
 PHP Version:  5.3CVS-2009-02-27 (snap)
 New Comment:

Currently in php 5.3.0RC3 2009.5.15:

$fun=function($v){echo $v;};
$fun('hello');

but can not do these:

function($v){echo $v;}('hello');
(function($v){echo $v;})('hello');
($fun=function($v){echo $v;})('hello');


Previous Comments:


[2009-05-15 05:20:56] kexianbin at diyism dot com

Currently in php 5.3.0RC3 2009.5.15:

$fun=function($v){echo $v;};
$fun('hello');

but can not do these:

function($v){echo $v;}('hello');
(function($v){echo $v;})('hello');
($fun=function($v){echo $v;})('hello');



[2009-02-27 01:49:34] kexianbin at diyism dot com

Description:

I submit a function request:
to make create_function to execute immediately like this:

When could we realize this in php?

create_function('$v', 'nowdoc'
echo $v;
nowdoc
)('hello');

I know i can type thus:
$f=create_function('$v', 'nowdoc'
echo $v;
nowdoc
);
$f('hello');

even thus:
${!${''}=create_function('$v', 'nowdoc'
echo $v;
nowdoc
)}('hello');

but both the 2nd and 3rd are ugly, i need the 1st style.

Expected result:

Show 'hello'

Actual result:
--
Show 'Parse error: parse error'





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



#48290 [NEW]: provide a function to get caller scope variables

2009-05-14 Thread kexianbin at diyism dot com
From: kexianbin at diyism dot com
Operating system: Irrelevant
PHP version:  5.3.0RC2
PHP Bug Type: Feature/Change Request
Bug description:  provide a function to get caller scope variables

Description:

Provide a function to get variables from caller scope.

I knew ticket 47454, 40339, 34210 are similar,
but this is indeed a useful function that was overlooked.

Reproduce code:
---
Currently:

$name=myname;
$value=lk,jdsk'jlkjdf;
function safe($sql)
 {$sql=strtr($sql, array(''='\', '\\'=''));
  return 'return '.preg_replace(array('/\{#(.*?)\}/'),
array('.addslashes($\1).'), $sql).';';
 }
$sql=insert into z_test (name, value) values ('{$name}', '{#value}');
mysql_query(eval(safe($sql)));

If we have function get_caller_vars() in caller's scope:
(similar to get_defined_vars() in current scope)

$name=myname;
$value=lk,jdsk'jlkjdf;
function mysql_query_safe($sql)
 {extract(get_caller_vars());
  $sql=strtr($sql, array(''='\', '\\'=''));
  return 'return '.preg_replace(array('/\{#(.*?)\}/'),
array('.addslashes($\1).'), $sql).';';
  $sql=eval($sql);
  mysql_query($sql);
 }
$sql=insert into z_test (name, value) values ('{$name}', '{#value}');
mysql_query_safe($sql);

Expected result:

We have a function to get variables in caller scope.

Actual result:
--
No such function.

-- 
Edit bug report at http://bugs.php.net/?id=48290edit=1
-- 
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48290r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48290r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48290r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48290r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=48290r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48290r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=48290r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=48290r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=48290r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=48290r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=48290r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=48290r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=48290r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48290r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=48290r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=48290r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=48290r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=48290r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=48290r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=48290r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=48290r=mysqlcfg



#39010 [Com]: create_function leaks memory

2009-04-03 Thread kexianbin at diyism dot com
 ID:   39010
 Comment by:   kexianbin at diyism dot com
 Reported By:  djgrrr at gmail dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: *
 PHP Version:  5.1.6
 New Comment:

You could write it like this:
isset($fn)?$fn:$fn=create_function('$v', 'echo $v;');


Previous Comments:


[2008-09-03 09:10:57] laysoft at gmail dot com

My reproduction code:

?

ini_set('display_errors',TRUE);
ini_set('memory_limit','2M');
error_reporting(E_ALL);

for ($i=0;$i3;$i++) {
$func=create_function('$m','return($m);');
unset($func);
echo '. ';
}

echo 'h1OK/h1';

?

It breaks with Fatal error: Allowed memory size of 2097152 bytes 
exhausted... error. Is there any way, to solve this problem?



[2006-10-01 15:29:35] djgrrr at gmail dot com

Description:

The PHP version is actually Irrelevant

If you use create_function many times in a script to make lambda
functions, it will use more and more memory.

Now, I know that this is the expected result, but it would be really
good to have a function like free_function or delete_function that could
be used to remove the lambda functions, and free up the memory they
use.

Obviously this function would have to be limited to only lambda
function, and it not be possible to use it on normal functions.

Personally, I think this is VERY essential to the CLI version of PHP as
many CLI PHP programs do not often restart, but keep running, simply
rehashing its config and any modules (using lambda functions)






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



#23022 [Com]: Supported dereferencing array indeces on arbitrary expressions

2009-02-26 Thread kexianbin at diyism dot com
 ID:   23022
 Comment by:   kexianbin at diyism dot com
 Reported By:  mfisc...@php.net
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Any
 PHP Version:  5CVS-2003-04-02 (dev)
 New Comment:

When could we realize this in php?

create_function('$v', 'fun_code'
echo $v;
fun_code
')('hello');


Previous Comments:


[2009-02-09 03:13:11] Anatorian at gmail dot com

I think this feature is very important. It can make me happier in php
developing.



[2009-01-29 01:32:26] jim at akubo dot net

i wish you could use the * operator (like in c++) to derference
references, is there a way todo this in php? instead of writing a new
function like array_val



[2008-11-25 04:27:37] showmethemoney at google dot com

Guys, we really need this feature to make our code beautiful.

Now:
function get2nd(){
$tempArray = explode(',', array('a','b','c'));
return $tempArray[1];
}
Better:
return explode(',', array('a','b','c'))[1];
or:
return array_get(explode(',', array('a','b','c')), '1');

Thanks.



[2008-11-25 03:28:59] kexianbin at diyism dot com

Developer guys, we php programmers indeed need this function 
to direct access element of the function/method returned array.

Sometimes i work around this so:
echo ${!${''}=explode(',','a,b,c')}[1];

maybe it's the shortest hack code to mimic direct access,
but it's ugly, we really need to realize it in the php build-in syntax
supporting.



[2007-02-23 22:15:16] m_rayman at bigfoot dot com

doesn't fix the bug, but a workaround:

function array_val($array, $key) {
return $array[$key];
}

then you can do things like:

var_dump(array_val(array('a', 'b'), 1));



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/23022

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



#23022 [Com]: Supported dereferencing array indeces on arbitrary expressions

2009-02-26 Thread kexianbin at diyism dot com
 ID:   23022
 Comment by:   kexianbin at diyism dot com
 Reported By:  mfisc...@php.net
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Any
 PHP Version:  5CVS-2003-04-02 (dev)
 New Comment:

When could we realize this in php?

create_function('$v', 'fun_code'
echo $v;
fun_code
)('hello');


Previous Comments:


[2009-02-26 08:20:58] kexianbin at diyism dot com

When could we realize this in php?

create_function('$v', 'fun_code'
echo $v;
fun_code
')('hello');



[2009-02-09 03:13:11] Anatorian at gmail dot com

I think this feature is very important. It can make me happier in php
developing.



[2009-01-29 01:32:26] jim at akubo dot net

i wish you could use the * operator (like in c++) to derference
references, is there a way todo this in php? instead of writing a new
function like array_val



[2008-11-25 04:27:37] showmethemoney at google dot com

Guys, we really need this feature to make our code beautiful.

Now:
function get2nd(){
$tempArray = explode(',', array('a','b','c'));
return $tempArray[1];
}
Better:
return explode(',', array('a','b','c'))[1];
or:
return array_get(explode(',', array('a','b','c')), '1');

Thanks.



[2008-11-25 03:28:59] kexianbin at diyism dot com

Developer guys, we php programmers indeed need this function 
to direct access element of the function/method returned array.

Sometimes i work around this so:
echo ${!${''}=explode(',','a,b,c')}[1];

maybe it's the shortest hack code to mimic direct access,
but it's ugly, we really need to realize it in the php build-in syntax
supporting.



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/23022

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



#47515 [NEW]: make create_function to execute immediately

2009-02-26 Thread kexianbin at diyism dot com
From: kexianbin at diyism dot com
Operating system: windows xp
PHP version:  5.3CVS-2009-02-27 (snap)
PHP Bug Type: Feature/Change Request
Bug description:  make create_function to execute immediately

Description:

I submit a function request:
to make create_function to execute immediately like this:

When could we realize this in php?

create_function('$v', 'nowdoc'
echo $v;
nowdoc
)('hello');

I know i can type thus:
$f=create_function('$v', 'nowdoc'
echo $v;
nowdoc
);
$f('hello');

even thus:
${!${''}=create_function('$v', 'nowdoc'
echo $v;
nowdoc
)}('hello');

but both the 2nd and 3rd are ugly, i need the 1st style.

Expected result:

Show 'hello'

Actual result:
--
Show 'Parse error: parse error'

-- 
Edit bug report at http://bugs.php.net/?id=47515edit=1
-- 
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47515r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47515r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47515r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47515r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47515r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47515r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=47515r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=47515r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=47515r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=47515r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=47515r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=47515r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=47515r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=47515r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=47515r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=47515r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=47515r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=47515r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=47515r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=47515r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=47515r=mysqlcfg



#47516 [NEW]: nowdoc can not be embed in heredoc but can be embed in double quote

2009-02-26 Thread kexianbin at diyism dot com
From: kexianbin at diyism dot com
Operating system: windows xp
PHP version:  5.3CVS-2009-02-27 (snap)
PHP Bug Type: Scripting Engine problem
Bug description:  nowdoc can not be embed in heredoc but can be embed in double 
quote

Description:

why nowdoc can not be embed in heredoc but can be embed in double quote?

Why the second paragraph is right(using double quote),
while the commented is not right(using nowdoc)?

?
$s='substr';

/*
$htm=DOC
{$s('ppp'
abcdefg
ppp
,0,3)}
DOC;
*/

$htm=
{$s('ppp'
abcdefg
ppp
,0,3)}
;

echo $htm;
?

Expected result:

Output 'abc'

Actual result:
--
Output:
Parse error: parse error, expecting `'}''

-- 
Edit bug report at http://bugs.php.net/?id=47516edit=1
-- 
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=47516r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=47516r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=47516r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=47516r=fixedcvs
Fixed in CVS and need be documented: 
http://bugs.php.net/fix.php?id=47516r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=47516r=alreadyfixed
Need backtrace:  
http://bugs.php.net/fix.php?id=47516r=needtrace
Need Reproduce Script:   
http://bugs.php.net/fix.php?id=47516r=needscript
Try newer version:   
http://bugs.php.net/fix.php?id=47516r=oldversion
Not developer issue: 
http://bugs.php.net/fix.php?id=47516r=support
Expected behavior:   
http://bugs.php.net/fix.php?id=47516r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=47516r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=47516r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=47516r=globals
PHP 4 support discontinued:  http://bugs.php.net/fix.php?id=47516r=php4
Daylight Savings:http://bugs.php.net/fix.php?id=47516r=dst
IIS Stability:   
http://bugs.php.net/fix.php?id=47516r=isapi
Install GNU Sed: 
http://bugs.php.net/fix.php?id=47516r=gnused
Floating point limitations:  
http://bugs.php.net/fix.php?id=47516r=float
No Zend Extensions:  
http://bugs.php.net/fix.php?id=47516r=nozend
MySQL Configuration Error:   
http://bugs.php.net/fix.php?id=47516r=mysqlcfg



#23022 [Com]: Supported dereferencing array indeces on arbitrary expressions

2008-11-24 Thread kexianbin at diyism dot com
 ID:   23022
 Comment by:   kexianbin at diyism dot com
 Reported By:  [EMAIL PROTECTED]
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Any
 PHP Version:  5CVS-2003-04-02 (dev)
 New Comment:

Developer guys, we php programmers indeed need this function 
to direct access element of the function/method returned array.

Sometimes i work around this so:
echo ${!${''}=explode(',','a,b,c')}[1];

maybe it's the shortest hack code to mimic direct access,
but it's ugly, we really need to realize it in the php build-in syntax
supporting.


Previous Comments:


[2007-02-23 22:15:16] m_rayman at bigfoot dot com

doesn't fix the bug, but a workaround:

function array_val($array, $key) {
return $array[$key];
}

then you can do things like:

var_dump(array_val(array('a', 'b'), 1));



[2003-04-02 10:30:35] [EMAIL PROTECTED]

Supported dereferencing array indeces on arbitrary expressions.

Currently you can only dereference array indeces on variables
directly:

$a = array('a', 'b');
var_dump($a[1]);

but this does not work

var_dump(array('a', 'b')[1]);

neither does this:

function returnArray() {
return array('a', 'b');
}
var_dump(returnArray()[1]);

or this:

$value = ($ns == 'foo' ? $thisArray : $thatArray)[0];




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