php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16291 pg_last_notice causes SegFault
Submitted: 2002-03-26 12:37 UTC Modified: 2002-04-05 01:47 UTC
From: cecot at dirbg dot com Assigned: yohgaki (profile)
Status: Closed Package: PostgreSQL related
PHP Version: 4.1.2 OS: linux MDK 8.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cecot at dirbg dot com
New email:
PHP Version: OS:

 

 [2002-03-26 12:37 UTC] cecot at dirbg dot com
pg_last_notice() causes segmentation falts when the postgresql generates notices. I mean when there are no messages from the DB server (RAISE NOTICE ....), pg_last_notice does not generate errors, but when the DB server generates notices they are sent to the apache log file (which I find strange), and with them SegFault for the apache child.

I used php-4.1.2 the bug is presented, I get the CVS from 25 March and the problem still exists.

P.S. if it is necessary I may try to generate backtrace, but the last time I tried I didn't succeeded :(

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-26 12:55 UTC] sander@php.net
We can't do much without a backtrace. Can you try to get one? See http://bugs.php.net/bugs-generating-backtrace.php for instructions.
 [2002-03-26 14:16 UTC] cecot at dirbg dot com
I got again the latest CVS and compiled it with

./configure --prefix=/etc/httpd \
        --with-apxs=/usr/sbin/apxs \
        --with-config-file-path=/etc/php4/apache \
        --enable-debug=yes \
        --with-exec-dir=/usr/bin \
        --with-system-regex \
        --with-mysql=/usr/local/mysql \
        --with-pgsql=/usr/local/pgsql \
        --with-gd=/usr \
        --with-freetype-dir=/usr\
        --with-zlib \
        --with-ldap \
        --with-imap \
        --enable-track-vars \
        --enable-magic-quotes

and then there was NO segfault, but in the browser appeared (the differences is of course --enable-debug=yes)

BROWSER START
______________________________________________________________________________________________________________________
<br />
<b>Warning</b>:  String is not zero-terminated (ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ?&#204;&#143;*) (source: ./zend_execute.c:449) in <b>/var/www/crm.dir.bg/project.planner.update.php</b> on line <b>38</b><br />
<br />
<b>Warning</b>:  String is not zero-terminated (ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ?&#204;&#143;*) (source: ./zend_execute.c:449) in <b>/var/www/crm.dir.bg/project.planner.update.php</b> on line <b>38</b><br />
<br />
<b>Warning</b>:  String is not zero-terminated (ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ?&#204;&#143;*@&#193;) (source: ./zend_execute.c:449) in <b>/var/www/crm.dir.bg/project.planner.update.php</b> on line <b>38</b><br />
<br />
<b>Warning</b>:  Cannot add header information - headers already sent by (output started at /var/www/crm.dir.bg/project.planner.update.php:38) in <b>/var/www/crm.dir.bg/project.planner.update.php</b> on line <b>48</b><br />
<br />
<b>Warning</b>:  String is not zero-terminated (ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ?&#204;&#143;*) (source: zend_execute_API.c:274) in <b>Unknown</b> on line <b>0</b><br />
___________________________________________________________________________________________________________________
BROWSER END

and in the error_log
ERROR_LOG START
___________________________________________________________________________________________________________________

[Tue Mar 26 21:22:52 2002] [error] NOTICE:  Too Many Resources Assigned to project TEST, needed 10, assigned 44.

[Tue Mar 26 21:22:52 2002] [error] NOTICE:  Too Many Resources Assigned to project TEST, needed 10, assigned 44.

/var/www/crm.dir.bg/project.planner.update.php(38) : Warning - String is not zero-terminated (ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ?&#204;&#143;*) (source: ./zend_execute.c:449)
[Tue Mar 26 21:22:52 2002]  Script:  '/var/www/crm.dir.bg/project.planner.update.php'
---------------------------------------
./zend_execute.c(449) : Block 0x08193FD0 status:
zend_variables.c(44) : Actual location (location was relayed)
Beginning:  	Overrun (magic=0x402585E8, expected=0x7312F8DC)
      End:	Unknown
---------------------------------------
[Tue Mar 26 21:22:52 2002] [error] NOTICE:  Too Many Resources Assigned to project TEST, needed 10, assigned 44.

[Tue Mar 26 21:22:52 2002] [error] NOTICE:  Too Many Resources Assigned to project TEST, needed 10, assigned 44.

[Tue Mar 26 21:22:52 2002]  Script:  '/var/www/crm.dir.bg/project.planner.update.php'
---------------------------------------
pgsql.c(237) : Block 0x08194148 status:
Beginning:  	Overrun (magic=0x40258568, expected=0x7312F8DC)
      End:	Unknown
---------------------------------------
/var/www/crm.dir.bg/project.planner.update.php(38) : Warning - String is not zero-terminated (ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ?&#204;&#143;*) (source: ./zend_execute.c:449)
[Tue Mar 26 21:22:52 2002]  Script:  '/var/www/crm.dir.bg/project.planner.update.php'
---------------------------------------
./zend_execute.c(449) : Block 0x08194148 status:
zend_variables.c(44) : Actual location (location was relayed)
Beginning:  	Overrun (magic=0x402586F8, expected=0x7312F8DC)
      End:	Unknown
---------------------------------------
[Tue Mar 26 21:22:52 2002] [error] NOTICE:  Too Many Resources Assigned to project TEST, needed 10, assigned 44.

[Tue Mar 26 21:22:52 2002]  Script:  '/var/www/crm.dir.bg/project.planner.update.php'
---------------------------------------
pgsql.c(237) : Block 0x08194148 status:
Beginning:  	Overrun (magic=0x40258568, expected=0x7312F8DC)
      End:	Unknown
---------------------------------------
[Tue Mar 26 21:22:52 2002] [error] NOTICE:  Too Many Resources Assigned to project TEST, needed 10, assigned 44.

[Tue Mar 26 21:22:52 2002]  Script:  '/var/www/crm.dir.bg/project.planner.update.php'
---------------------------------------
zend_execute_API.c(274) : Block 0x08194148 status:
zend_variables.c(44) : Actual location (location was relayed)
Beginning:  	Overrun (magic=0x402586F8, expected=0x7312F8DC)
      End:	Unknown
---------------------------------------
/var/www/crm.dir.bg/project.planner.update.php(38) : Warning - String is not zero-terminated (ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ?&#204;&#143;*@&#193;) (source: ./zend_execute.c:449)
[Tue Mar 26 21:22:52 2002]  Script:  '/var/www/crm.dir.bg/project.planner.update.php'
---------------------------------------
./zend_execute.c(449) : Block 0x08194148 status:
zend_variables.c(44) : Actual location (location was relayed)
Beginning:  	Overrun (magic=0x402586F8, expected=0x7312F8DC)
      End:	Unknown
---------------------------------------
[Tue Mar 26 21:22:52 2002] [error] NOTICE:  Too Many Resources Assigned to project TEST, needed 10, assigned 44.

[Tue Mar 26 21:22:52 2002] [error] NOTICE:  Too Many Resources Assigned to project TEST, needed 10, assigned 44.

[Tue Mar 26 21:22:52 2002]  Script:  '/var/www/crm.dir.bg/project.planner.update.php'
---------------------------------------
pgsql.c(237) : Block 0x08193EC8 status:
Beginning:  	Overrun (magic=0x40258568, expected=0x7312F8DC)
      End:	Unknown
---------------------------------------
/var/www/crm.dir.bg/project.planner.update.php(48) : Warning - Cannot add header information - headers already sent by (output started at /var/www/crm.dir.bg/project.planner.update.php:38)
[Tue Mar 26 21:22:52 2002]  Script:  '/var/www/crm.dir.bg/project.planner.update.php'
---------------------------------------
pgsql.c(380) : Block 0x08193EC8 status:
Beginning:  	Overrun (magic=0x40258760, expected=0x7312F8DC)
      End:	Unknown
---------------------------------------
Unknown(0) : Warning - String is not zero-terminated (ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ?&#204;&#143;*) (source: zend_execute_API.c:274)
[Tue Mar 26 21:22:52 2002]  Script:  '/var/www/crm.dir.bg/project.planner.update.php'
---------------------------------------
zend_execute_API.c(274) : Block 0x08193EC8 status:
zend_variables.c(44) : Actual location (location was relayed)
Beginning:  	Overrun (magic=0x40258760, expected=0x7312F8DC)
      End:	Unknown
---------------------------------------
___________________________________________________________________________________________________________________
ERROR_LOG END



I hope it is clear, if there is something else I can do please tell me!

P.S. the view in the browser (probably in the error_log) is somehow different on different cases, but I suspect it's from the query and the number of notices from the postgresql server. The lines that are [error] NOTICE: are actually the messages from the postgre.
 [2002-03-26 15:36 UTC] sniper@php.net
reclassified
 [2002-03-26 19:28 UTC] yohgaki@php.net
Is your backend(PostgreSQL Server) and libpq matches? 
(i.e. Do you use libpq version that comes with your PostgreSQL Server?)

If version does not match, use the same versoin.

If you still have problem, please send backtrace. I'll fix it.
 [2002-03-27 05:48 UTC] cecot at dirbg dot com
I use PostgreSQL 7.2 wich I've installed in /usr/local/pgsql (on clear, first I did was rm -r -f /usr/local/pgsql, and also there is no postgre packages from the distribution installed) there are no other postgresql files on my disk, also I've compiled with it --with-pgsql=/usr/local/pgsql, so I suppose I don't use different versions.
If there is a more precise way of discovering this kind of error please tell me (in phpinfo() i didn't find such info).
And as I said when I compile PHP with debug support (--enable-debug=yes) it does not generate SegFaullts only this messages which I posted before, so couldn't make a backtrace.
_______________________________________________
by the way here is the part of the code that is important for the error:

if ($oid == 0) {
	@pg_query($db_conn, "UPDATE resource SET project = NULL, resource = NULL WHERE \"user\" = '$user' AND date = '$date' AND num = '$num'");
}else{
	@pg_query($db_conn, "UPDATE resource SET project = pr.project, resource = pr.resource FROM project_resource as pr WHERE pr.oid = '$oid' AND \"user\" = '$user' AND date = '$date' AND num = '$num'");
}
$tmpn = pg_last_notice($db_conn);


every update actually updates only one row (since user,date,num is primary key), on which a trigger generate this notice
 [2002-03-28 21:41 UTC] yohgaki@php.net
Ok. I'll have look.
 [2002-04-05 01:47 UTC] yohgaki@php.net
This bug has been fixed in CVS.

Thanks for reporting.
Fix will be available in 4.2.0, also.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 08:01:29 2024 UTC