php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #9857 define("named_constant")
Submitted: 2001-03-20 01:15 UTC Modified: 2001-04-09 03:25 UTC
From: shmengie_2000 at yahoo dot com Assigned:
Status: Closed Package: IIS related
PHP Version: 4.0.1 OS: winNT IIS4
Private report: No CVE-ID: None
 [2001-03-20 01:15 UTC] shmengie_2000 at yahoo dot com
With this code at the top of an include file, the results are unpretictable.

if(!defined("METABASE_MYSQL_INCLUDED"))
{
 define("METABASE_MYSQL_INCLUDED",1);
 ...rest of include file...
}

require_once(); seems to work though.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-03-26 17:46 UTC] shmengie_2000 at yahoo dot com
A define on php4isapi has a tendency to bleed over to the next page load.  refresh and a completely different page have retain a defined constant.

eg:
test1.php
<?
define("anything",1);
echo (defined("anything")?"anything defined":"anything not defined");
?>

test2.php
echo (defined("anything")?"anything defined":"anything not defined");

after pointing browser at test1.php
test 2.php contains "anything defined", instead of "not"
 [2001-03-29 01:34 UTC] shmengie_2000 at yahoo dot com
Taking a shot in the dark, hoping this bug comes to sombody who "knows" attention.

Prior comments are somewhat misleading.  I'm using OCI8, and also Manuel Lemos' Metabase.

Parusing through the source, I've noticed that there are some constants defined for OCI8 (which are documented):
eg:
REGISTER_LONG_CONSTANT("OCI_DEFAULT",OCI_DEFAULT, CONST_CS | CONST_PERSISTENT);

I question this CONST_PERSISTENT value.  Is it possible that the persistence is helping non persistent constants (in the php code) strattle the void between pages?

BTW: what does _zval_dtor in the source mean? Specifically, "dtor"
 [2001-04-06 23:57 UTC] sniper@php.net
Are you using PHP 4.0.1? If so, could you please try 
with the latest release, 4.0.4pl1?

--Jani

 [2001-04-07 17:29 UTC] sniper@php.net
User feedback:
--------------

I'm using the latest snapshot's on win32.

Getting some needed practice with MSVC...

I think the problem is that OCI is walking on TSRM
local storage.  I haven't been able to verify it, but
my gut says it's so.

 [2001-04-09 03:25 UTC] shmengie_2000 at yahoo dot com
Making this change in oci8.c

#ifdef ZTS 
#define PHP_OCI_INIT_MODE OCI_DEFAULT 
/* OCI_DEFAULT was OCI_THREADED on the above line*/
#else
#define PHP_OCI_INIT_MODE OCI_DEFAULT
#endif

Now the defined() does not have a problem.  This makes me reasonably sure that it is OCI8 walking on other memory.  By changing OCI_THREADED to OCI_DEFAULT oci does not use it's own memory sharing features in threaded environments.  

This removes any benifit that may be gained by a threaded environment, but also cause PHP not to crash.  I find the PHP not crashing much more productive.  ;-)

Will have to work on OCI source to take advantage of threaded environments.  Think it will be a major re-write of OCI8.c for this, because other attemts of a quick source fix have been unsuccessful. 

For now, this works.

joebrown
podiatryfl.com
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 00:01:29 2024 UTC