Bug #80083 [Com]: Optimizer pass 6 removes variables used for ibm_db2 data binding

From: Date: Thu, 17 Sep 2020 14:29:59 +0000
Subject: Bug #80083 [Com]: Optimizer pass 6 removes variables used for ibm_db2 data binding
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-229050@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80083&edit=1

 ID:                 80083
 Comment by:         calvin at cmpct dot info
 Reported by:        calvin at cmpct dot info
 Summary:            Optimizer pass 6 removes variables used for ibm_db2
                     data binding
 Status:             Closed
 Type:               Bug
 Package:            opcache
 Operating System:   IBM i 7.2
 PHP Version:        7.4.10
 Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Thanks. I'll backport it to my 7.4 build soon and see how it goes.


Previous Comments:
------------------------------------------------------------------------
[2020-09-17 08:21:18] nikic@php.net

> I skimmed the source and I think the only symbol table mangling code is in execute called code;
> though perhaps the bind code in ibm_db2 could also signal something to opcache?.

I also just checked the code, and it looks like just handling db2_execute() should be sufficient.
While db2_bind_param() accepts the variable name, it doesn't do anything beyond storing it.

> I also didn't know opcache was willing to accept a workaround - has that happened before?

Nope, but doesn't really cost us anything, as long as it's an isolated occurrence...

I've committed a fix now, but haven't tested it, as I don't have the necessary
environment.

------------------------------------------------------------------------
[2020-09-17 08:14:53] nikic@php.net

Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=a4f806aa79c9d0e497866e86f750e87d9bd874f1
Log: Fixed bug #80083

------------------------------------------------------------------------
[2020-09-15 17:23:38] calvin at cmpct dot info

I skimmed the source and I think the only symbol table mangling code is in execute called code;
though perhaps the bind code in ibm_db2 could also signal something to opcache?. I also didn't
know opcache was willing to accept a workaround - has that happened before?

------------------------------------------------------------------------
[2020-09-15 12:32:14] nikic@php.net

Agree. I think it's okay for us to hardcode these functions as modifying the symtable in
opcache.

Do you know which functions are affected? Is it just db2_execute() that accesses local variables, or
also other functions?

------------------------------------------------------------------------
[2020-09-10 16:53:55] calvin at cmpct dot info

Yeah, I agree this is API is malpractice. (Looking at the db2 binding code and having it manipulate
local/global scope symbol tables when no other modules did so was a bit of a head-scratcher.)
Changing the db2 API would probably result in a breaking change though, and most code on ibm_db2
instead of (PDO_)ODBC is legacy; so I suspect most users running into this will either detune
opcache or migrate to ODBC. (Of course, this is the IBM i perspective. I don't know what LUW
people are doing here; perhaps they consider that extension more important.)

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=80083


--
Edit this bug report at https://bugs.php.net/bug.php?id=80083&edit=1


Thread (8 messages)

« previous php.bugs (#229050) next »