From:             firepages at firepages dot com dot au
Operating system: win XP
PHP version:      4.3.3
PHP Bug Type:     SQLite related
Bug description:  sqlite_create_function cant call method of $this as function kills 
apache(2)

Description:
------------
when trying to use sqlite_create_function() & passing a class method of
$this apache dies orribly (appreciate it may be an apache issue)

Win XP Pro / php 4.3.3 compiled (MSVC) against apache 2.0.47

eg 
sqlite_create_function($this->db, 'link_keywords', array( $this,'linkers'
) , 1);
/*OR*/
sqlite_create_function($this->db, 'link_keywords', array( &$this,'linkers'
) , 1);

note that calling an external class method or normal function
[array($ext_class,$method)]gives no problem , just methods of $this

not tested on apache 1.* 



Reproduce code:
---------------
class sqlite_help{
        function sqlite_help(){
                $this->db = sqlite_open('e:/phpdev/cp/my_admin.sqldb.eng', 0666,
$sqliteerror);
                sqlite_create_function($this->db, 'link_keywords', array( $this ,
'linkers') , 1);
                return $this->db;
        }
        function get_single( $key ){
                $res = sqlite_query( $this->db,"SELECT link_keywords(var) FROM my_admin
WHERE key = '$key'" );
                $r = sqlite_fetch_array( $res , SQLITE_NUM );
                return $r[0];
        }
        function linkers( $str ){
                $keywords = array('phpmyadmin'=>'<a
href="http://localhost/phpmyadmin/index.php"";>phpMyAdmin</a>');
                foreach($keywords as $k=>$v){$str = str_replace( $k , $v , $str );}
                return nl2br( $str );
        }
}
$yaks=new sqlite_help();
echo $yaks->get_single('general');

Expected result:
----------------
str_replaced data from DB

works if function is external or external class method

Actual result:
--------------
an MS 'Apache has encountered an ....' etc Dialog no apache error log
available , no PHP error logged.

-- 
Edit bug report at http://bugs.php.net/?id=25329&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25329&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25329&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25329&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25329&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25329&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25329&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25329&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25329&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25329&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25329&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25329&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25329&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25329&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25329&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25329&r=gnused

Reply via email to