php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31725 sqlite/zend engine 2 weird problems
Submitted: 2005-01-27 17:00 UTC Modified: 2005-06-09 20:33 UTC
Votes:1
Avg. Score:4.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: nlopess@php.net Assigned: wez (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2005-03-21 OS: *
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: nlopess@php.net
New email:
PHP Version: OS:

 

 [2005-01-27 17:00 UTC] nlopess@php.net
Description:
------------
I've found a couple of sqlite weird problems (php 5.1).
verified with both linux and windows.

Reproduce code:
---------------
<?
$error = '';
$idx = new SQLiteDatabase('ini_changelog.sqlite', 0666, $error);

$tags = array_map('rtrim', array_merge(file('version4.tags'), file('version5.tags')));

print_r($tags);
?>

prints a warning (and array empty). removing the $error declaration outputs a notice, but works.


---------------
#2
<?
$error = '';

$idx = new SQLiteDatabase('ini_changelog.sqlite', 0666, $error);

$tags = array_map('rtrim', array_merge(file('version4.tags'), file('version5.tags')));

print_r($tags);

$sql = 'CREATE TABLE changelog (
  name VARCHAR(200) PRIMARY KEY,';

foreach($tags as $tag) {
    $sql .= " $tag TINYINT,";
}

$idx->query($sql);

Actual result:
--------------
1st example:
Warning: array_map(): The first argument, '~??o', should be either NULL or a valid callback in /transfer/test.php on line 6

(notice the garbidge in the name of the function)

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

2nd example:

Program received signal SIGSEGV, Segmentation fault.
0x403bb848 in pthread_mutex_lock () from /lib/libpthread.so.0
(gdb) bt
#0  0x403bb848 in pthread_mutex_lock () from /lib/libpthread.so.0
#1  0x40462925 in free () from /lib/libc.so.6
#2  0x081d4222 in shutdown_memory_manager (silent=0, full_shutdown=0)
    at /cvs/php-src/Zend/zend_alloc.c:582
#3  0x081b3a01 in php_request_shutdown (dummy=0x0)
    at /cvs/php-src/main/main.c:1225
#4  0x0824b1af in main (argc=2, argv=0xbffff9b4)
    at /cvs/php-src/sapi/cli/php_cli.c:1047

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-31 01:31 UTC] jed@php.net
$sql = 'CREATE TABLE changelog (
  name VARCHAR(200) PRIMARY KEY,';
foreach($tags as $tag) $sql .= " $tag TINYINT,";
$idx->query($sql);

You're going to end up with a query like

CREATE TABLE changelog (name VARCHAR(200) PRIMARY KEY, tag1 TINYINT, tag2 TINYINT

Just pointing this out, might want to ) the end before querying? I just saw this in passing.
 [2005-03-21 11:12 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-03-21 16:20 UTC] nlopess@php.net
Yep, both my examples still fail. And sqlite is leaking somewhere.
 [2005-04-21 17:27 UTC] sniper@php.net
And the configure line you're using is..?
(please, by now you should know how-to-report..)

 [2005-04-21 20:21 UTC] nlopess@php.net
It segfaults in both windows (using the 'official' binaries) and linux.
The program that I've used that is segfaulting is in CVS: http://cvs.php.net/phpdoc/scripts/iniupdate/
 [2005-04-22 04:46 UTC] wez@php.net
backtrace and/or valgrind output please.
 [2005-04-26 20:02 UTC] nlopess@php.net
Well, I've already posted 2 examples with backtraces above.

I've run the ini-update.php script (available in the above URL) and I got this:
#0  0x4046dd67 in mallopt () from /lib/libc.so.6
#1  0x4046db5e in mallopt () from /lib/libc.so.6
#2  0x4046c908 in free () from /lib/libc.so.6
#3  0x081ea0e7 in shutdown_memory_manager (silent=0, full_shutdown=0)
    at /cvs/php-src/Zend/zend_alloc.c:511
#4  0x081c9821 in php_request_shutdown (dummy=0x0)
    at /cvs/php-src/main/main.c:1228
#5  0x082633df in main (argc=2, argv=0xbffff944)
    at /cvs/php-src/sapi/cli/php_cli.c:1057
 [2005-04-26 20:26 UTC] wez@php.net
valgrind...
 [2005-04-26 23:12 UTC] nlopess@php.net
Sorry, valgrind took a while to finish.
The output: http://mega.ist.utl.pt/~ncpl/valgrind-php.txt
 [2005-06-07 17:42 UTC] dmitry@php.net
Probably this bug should be fixed in CVS HEAD and PHP_5_0 with the following patch:

http://cvs.php.net/diff.php/php-src/ext/sqlite/sqlite.c?r1=1.146.2.6&r2=1.146.2.7&ty=u
 [2005-06-07 18:12 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-06-09 20:33 UTC] nlopess@php.net
I've tried the scripts pasted above and a couple of combinations and all the problems seem to be fixed.
Now I'm getting a mem leak in the sqlite lib itself.

Thanks,
Nuno
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun May 25 09:01:27 2025 UTC