php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9681 can't use interbase functions in user defined sessions
Submitted: 2001-03-11 08:36 UTC Modified: 2001-06-14 23:37 UTC
From: olivier at lx dot student dot wau dot nl Assigned:
Status: Closed Package: Session related
PHP Version: 4.0.4pl1 OS: Linux 2.2.17 i686 unknown
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: olivier at lx dot student dot wau dot nl
New email:
PHP Version: OS:

 

 [2001-03-11 08:36 UTC] olivier at lx dot student dot wau dot nl
I wrote my own session handlers, for use with interbase. Logging is done to a file that is truncated by the open function, and then a line appended by each other session function.

When I start with the example session handler from the manual, everything works ok. Then I start adding interbase functions. Session reading works. BUT, when I add interbase functions to writing, that function is not called anymore (it doesn't write it's entry in the logfile anymore). The same for adding ibase_commit() or ibase_close() to the close function, it doesn't write it's log entry anymore.

I tested the queries, and they _do_ work.

A working write function:
function ibs_write($key, $val) {
	global $ibs_local_key, $ibs_db_id;
	$fd = fopen('/home/pkedu/olivier/nwuser/log.out', 'a');
	$dbkey = addslashes($key.$ibs_local_key);
	$val = addslashes($val);
	$now = time();
	$query = "update user_info set session_data='$val' where user_id = (select user_id from user_session where session_key='$dbkey')";
//	$ret = ibase_query($ibs_db_id, $query);
	fputs($fd, $query."\n");
	fclose($fd);
}

This is the same function where it doesn't work anymore, only thje comment is removed, and now the query is not written to the logfile anymore:

function ibs_write($key, $val) {
	global $ibs_local_key, $ibs_db_id;
	$fd = fopen('/home/pkedu/olivier/nwuser/log.out', 'a');
	$dbkey = addslashes($key.$ibs_local_key);
	$val = addslashes($val);
	$now = time();
	$query = "update user_info set session_data='$val' where user_id = (select user_id from user_session where session_key='$dbkey')";
	$ret = ibase_query($ibs_db_id, $query);
	fputs($fd, $query."\n");
	fclose($fd);
}

The system does not have any other problems with interbase or sessions, I tried normal and persistant database connections, PHP does not crash (no reports in the apache error_log). Apache is Apache/1.3.9 from Debian Potato. Please contact me for any missing information.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-12 07:44 UTC] olivier at lx dot student dot wau dot nl
On a different machine, the same code generates as segfault. PHP is a freshly compiled ( with --enable-debug) 4.0.4pl1, Apache is 1.3.9 from Debian Potato. The backtrace is:

#0  0x40392fbb in _res_resultcodes () from /usr/lib/apache/1.3/libdav.so
#1  0x4031974c in yy_state_buf () from /usr/lib/apache/1.3/libphp4.so
#2  0x40228a87 in execute (op_array=0x80fbc40) at ./zend_execute.c:2283
#3  0x4022f5c5 in convert_to_double (op=0x80b76d0) at zend_operators.c:317
#4  0x4022ef57 in zend_string_to_double (number=0x80b76d0 "?\003", length=0)
    at zend_operators.c:75
#5  0x40277c10 in php_array_walk (target_hash=0x80ff784, userdata=0x2)
    at array.c:1013
#6  0x40278247 in _valid_var_name (varname=0x4032ab30 "\204\235\n\b\005")
    at array.c:1149
#7  0x4027470a in ps_files_cleanup_dir (dirname=0x4031974c "\f\030\022", 
    maxlifetime=0) at mod_files.c:176
#8  0x40277169 in php_if_end (ht=1076991820, return_value=0x0, this_ptr=0x0, 
    return_value_used=0) at array.c:750
#9  0x402771ac in php_if_prev (ht=1, return_value=0x6, this_ptr=0x0, 
    return_value_used=1076086069) at array.c:762
#10 0x4023c573 in zend_hash_find (ht=0x80b9dd0, 
    arKey=0x402f44a4 "zend_hash.c", nKeyLength=687, pData=0x4023ee01)
    at zend_hash.c:852
#11 0x4023ee77 in zend_if_strncmp (ht=1077076512, return_value=0x4023c528, 
    this_ptr=0x809e3ec, return_value_used=1076074916)
    at zend_builtin_functions.c:261
#12 0x402399f5 in zend_load_extension (path=0x4031974c "\f\030\022")
    at zend_extensions.c:46
#13 0x4025090c in cfg_get_entry (name=0x0, name_length=0) at php_ini.c:253
#14 0x4024d7d7 in php_request_startup () at main.c:636
#15 0x8051bdc in ap_run_cleanup ()
#16 0x8050c54 in ap_clear_pool ()
#17 0x8050cb4 in ap_destroy_pool ()
#18 0x8050c40 in ap_clear_pool ()
#19 0x805c13f in ap_child_terminate ()
#20 0x805c66c in ap_child_terminate ()
#21 0x805c789 in ap_child_terminate ()
#22 0x805cc3b in ap_child_terminate ()
#23 0x805d2ed in main ()
#24 0x400c0a42 in __libc_start_main () from /lib/libc.so.6
 [2001-06-14 23:37 UTC] sniper@php.net
This should be fixed in PHP 4.0.6 RC3.
http://www.php.net/~andi/php-4.0.6RC3.tar.gz

If above link doesn't work, try with RC4.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat May 10 23:01:29 2025 UTC