php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26777 Extension shouldn't check whether a parameter should be NULL
Submitted: 2004-01-03 09:35 UTC Modified: 2004-02-15 13:28 UTC
From: al at forest dot akadem dot ru Assigned: abies
Status: Not a bug Package: InterBase related
PHP Version: 4CVS, 5CVS OS: *
Private report: No CVE-ID:
 [2004-01-03 09:35 UTC] al at forest dot akadem dot ru
Description:
------------
Having Windows 2000 SP4, 
PHP 4.3.4, php_interbase latest checked from CVS (Revision 1.91.2.26). Firebird SS 1.0.3

Having a table in db (dialect 3):

CREATE TABLE T_TEST (
    F1  TIMESTAMP NOT NULL,
    F2  INTEGER
);

and a trigger associated with it:

CREATE TRIGGER T_TEST_BI0 FOR T_TEST
ACTIVE BEFORE INSERT POSITION 0
AS
begin
  if (new.f1 IS null) then
    new.f1 = current_timestamp;
end

This mean that no record will be inserted with F1 set to NULL. Having code reproduced below I get a message:
Warning: ibase_query(): Parameter 90206904 must have a value in c:\g2\htdocs\ibase_not_null.php on line 7

The problem seems to lie around lines 1199-1202 in interbase.c

Reproduce code:
---------------
<?php
$G2db = ibase_connect( '/path/to/db', 
		       'user', 'passw', 
		       'WIN1251', 0, 3, 'role');
$G2tr = ibase_trans(IBASE_NOWAIT, $G2db);

$qry = ibase_query($G2tr, 'insert into t_test (f1, f2) values (?, ?)', NULL, '33');

ibase_commit($G2tr);
ibase_close($G2db);
?>

Expected result:
----------------
PHP shouldn't complain at all.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-06 18:26 UTC] sniper@php.net
Assigned to Ard who touched this part the last time.

 [2004-01-07 04:41 UTC] abies@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.
 [2004-02-15 13:28 UTC] abies@php.net
Reverted in CVS HEAD:

The client API requires every non-null field to have a value, even if a trigger can provide a value as well. [The NULL flag of a NOT NULL field is not even tested by the client lib, causing PHP to crash if you try to insert null into it]

Please note that this restriction is imposed by the client API, not by PHP.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sat Apr 19 22:02:16 2014 UTC