
AFTNHombre
Members-
Posts
17 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Male
-
Location
Ottawa, Canada
AFTNHombre's Achievements

Newbie (1/5)
0
Reputation
-
I'm not sure what you're saying. My best guess is that what's available from &$val will only be good as long as the current usage of &$val is in scope. Even though it's handing off references to array elements that persist? Would that mean something like function foo(&$ret) { $it = &$this->member; $ret = $it; } wouldn't work either? I'm lost in your second answer, too. I want the array element to be 'something_else' at that point. But more importantly, I want 'something_else' to be used in my next OCI call. That "..." was an abstraction representing an execution and the assignment with 'something_else' was about giving the bind variables something new for the next call.
-
I'm trying to use oci_bind_by_name() to bind elements of an array, but I'm confused by a few things. For a start: http://ca2.php.net/manual/en/function.oci-bind-by-name.php (see example #3) says that foreach ($ba as $key => $val) { oci_bind_by_name($stid, $key, $val); } won't work. Fair enough, because $val is always the same variable so nothing will be bound when the loop is done, so foreach ($ba as $key => $val) { oci_bind_by_name($stid, $key, $ba[$key]); } is necessary. But what's wrong with foreach ($ba as $key => &$val) { oci_bind_by_name($stid, $key, $val); } ? I would expect it to work just as well w/a slight performance increase. Another thing I'd like to know is how effective the binding is when array elements are reassigned. If I have something like $ba[':column_name'] = 'something'; oci_bind_by_name($stid, ':column_name', $ba[':column_name']); ... $ba[':column_name'] = 'something_else'; will this give me what I expect? Is $ba[':column_name'] guaranteed to still point to the same memory?
-
How to properly find what's wrong w/@oci_connect()
AFTNHombre replied to AFTNHombre's topic in PHP Coding Help
I saw that, too. But if you read further, you'll see that that opinion was disproved by induction. -
How to properly find what's wrong w/@oci_connect()
AFTNHombre replied to AFTNHombre's topic in PHP Coding Help
Isn't that what I'm trying to do? The most helpful information should be gotten from oci_error(), but since that's failing, it's hard to know what else to do. -
How to properly find what's wrong w/@oci_connect()
AFTNHombre replied to AFTNHombre's topic in PHP Coding Help
Errors, eh? I only count one. Ok, here's the concrete code: $this->ocn = @oci_connect($_conn_uid,$_conn_pwd,$conn_server_host); if (!$this->ocn) { Log::TraceOracleError(oci_error()); The way the code is setup right now the set_error_handler function throws an exception, if error_reporting() != 0. So changing that wouldn't work, we but could fairly easily catch the exception. But what's wrong w/@? -
I have code that fails and goes like this: $dbc = @oci_connect($This, $that, $theother); if (!dbc) { $arr = oci_error(); assert($arr); } That's just an abstraction. In fact, $arr comes up as false in this case. I don't think it should be because of the @, so why then could oci_error() return false when @oci_connect() just returned false? In the real code, there are no oci_ calls between @oci_connect() and oci_error().
-
Calls to undefined function NOT throwing errors
AFTNHombre replied to AFTNHombre's topic in PHP Coding Help
So you're saying there are a ton of reasons why calling a function that's not defined in scope might not fail and the error handler absorbing it is only one? What are some others? -
I have this code that has $this->BeginTransaction(); all over it. These are in classes where no such function is defined, and they don't have parents either. It's driving my crazy trying to figure out why they are there, why there's not so much as a warning being given and what, if anything, is being called. Now I do have a set_error_handler("amfErrorHandler"); and in amfErrorHandler I have if( error_reporting() != 0 && ($amfphpErrorLevel | $level) == $amfphpErrorLevel ) { throw new VerboseException($string, $level, $file, $line); } I don't remember what $amfphpErrorLevel is, except that it should only be ignoring things like E_STRICT. Also, no exception is being thrown. So what do I do w/this code?
-
Isn't accessing a static variable from a non-static function bad?
AFTNHombre replied to AFTNHombre's topic in PHP Coding Help
As a matter of fact, they were being quarantined. I'm going to see what I can do about that. -
Isn't accessing a static variable from a non-static function bad?
AFTNHombre replied to AFTNHombre's topic in PHP Coding Help
Actually, there are many instances of this class, so I'd say the bad syntax is in the static keyword. So I guess I'll remove those. In fact, I'm surprised that every time a member is set, it doesn't clobber all the other instances' members. Also, is there something wrong w/the reply notification? I haven't gotten any and I'm expecting several. My account is GMail. Are they blocking phpfreaks? -
I thought I was a beginner PHPer but now I'm not even sure I'm that. I have this class here which starts with: private static $FormatType = ""; but then further down: public function SetFormatType($NewFormatTypeId) { $this->FormatType = $NewFormatTypeId; } public function GetFormatType() { return $this->FormatType; } Do you suppose that the original developer just had a singleton or something, then latter on he found that he was making more instances and PHP tolerates this behavior? Or am I missing something?
-
Trying to understand bools and string representations
AFTNHombre replied to AFTNHombre's topic in PHP Coding Help
Ah, well now we have another layer of complication. $group_map != NULL ? 'TRUE' : 'FALSE' yields different results from $group_map !== NULL ? 'TRUE' : 'FALSE' var_export() indicates that $group_map is an empty array. I'm tracing down a bug here, and shortly after my debug code there's an if statement that tests the results of the non-identical inequality, so now I have to wonder if the original developers were aware that $group_map != NULL would trigger FALSE for an empty array. -
I have this inequality which should produce a boolean but it appears to produce a nothing. I'm expecting a result that is either TRUE or FALSE but it appears to be an empty string or something. At least, that's what it appears to do when I try to get its string representation: $not_null = ($group_map != NULL); Log::Trace("group map is not null: '$not_null'"); $group_map is an array, FWIW. I was trying to find out what it was, because the code was behaving unpredictably. I thought that when I just tested it for NULL I should get something I could understand, but even that went weird on me. What is $not_null if not a boolean? Oh, and the trace message comes out as: