Weird problem using load() on a BLOB
I've got a weird bug when trying to load BLOBs via PHP. Here is the code:<P>
<TT>
<?<BR>
// Environment Variables so PHP can find Oracle<BR>
putenv("TWO_TASK=gonk"); // Name of Oracle Server<BR>
putenv("ORACLE_SID=ora10"); // Name of Oracle Instance<BR>
putenv("ORACLE_HOME=/local/apps/oracle/InstantClient");<BR>
putenv("DYLD_LIBRARY_PATH=/local/apps/oracle/InstantClient");<P>
// Oracle username, password and connection string<BR>
define("ORA_CON_UN", "test"); // Oracle Username<BR>
define("ORA_CON_PW", "blahblah"); // Oracle Password<BR>
define("ORA_CON_DB", "ora10"); // Oracle Instance<P>
// Connect to Oracle<BR>
$conn = OCILogon(ORA_CON_UN, ORA_CON_PW, ORA_CON_DB);<P>
// SQL Query to execute<BR>
$query = "SELECT TESTNUM, TESTCHAR, TESTBLOB ";<BR>
$query .= "FROM TESTING WHERE TESTNUM = 1";<BR>
$stmt = OCIParse ($conn, $query);<BR>
OCIExecute($stmt);<BR>
OCIFetchInto($stmt, &$arr, OCI_RETURN_LOBS);<P>
$BlobNum = OCIResult($stmt,1);<BR>
$BlobChar = OCIResult($stmt,2);<BR>
$RawBlobBlob = OCIResult($stmt,3);<BR>
$BlobBlob = $RawBlobBlob->load();<P>
print ("BlobNum:".$BlobNum."\n");<BR>
print ("BlobChar:".$BlobChar."\n");<BR>
print ("RawBlobBlob:".$RawBlobBlob."\n");<BR>
print ("BlobBlob:".$BlobBlob."\n");<BR>
print("***\n");<BR>
?><P>
</TT>
Basically, the program works fine under PHP 4.0.5 on a TRU64 box (yes, the BLOB is displayed as a mess of strange characters, but that's cool - if I include a "header("Content-Type: image/jpeg");" line and only output the BLOB by itself the jpeg image stored in the BLOB is displayed properly). However, when it comes to running exactly the same program under PHP 4.4.1 on a OS X box, the program does not display the BLOB. The program is definitely loading the BLOB, as I can get the program to display how big (in bytes) the data in the BLOB is, but the OCI function load() is returning nothing when it should be displaying the data I have in the BLOB.
<P>
Anyone got any ideas on what could be causing this behaviour ? It's been driving me nuts for nearly a week!
<P>
Cheers,<BR>
Rocky