Jump to content

AFTNHombre

Members
  • Posts

    17
  • Joined

  • Last visited

    Never

Everything posted by AFTNHombre

  1. I see. Well... I guess a guru would know what he's talking about. Thanks. I'm pretty sure I used the &$val method somewhere in my code--somewhere that gets heavy usage. It seems awfully lucky that it didn't blow up in my face.
  2. 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.
  3. 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?
  4. I saw that, too. But if you read further, you'll see that that opinion was disproved by induction.
  5. 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.
  6. 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/@?
  7. 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().
  8. 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?
  9. 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?
  10. As a matter of fact, they were being quarantined. I'm going to see what I can do about that.
  11. 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?
  12. 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?
  13. 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.
  14. 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:
  15. Well, sort of solved. It seems that I was working w/a broken connection, but I don't understand how the connection was broken, so now my question is Is it possible to wear out an ssh2 connection?
  16. I have this problem where I make an ssh2 connection in this class, use it several times, and then it breaks, as in, further calls that use that resource fail. What happens is I make several ssh2_scp_recv() calls, then I call: $stream = ssh2_exec(EX_SFTP::$connection, "date --utc -r conf/au.conf '+%Y-%m-%d %H:%M:%S'; echo __COMMAND_FINISHED__"); That succeeds, then $stream is read, and the command is determined to be finished when "__COMMAND_FINISHED__" is parsed. (The only thing done w/$stream is that it is passed to fread() and strlen(). It isn't closed, or anything) Now the next thing I do is call ssh2_scp_send(), which results in an exception whose message is "ssh2_scp_send(): Failure creating remote file". The reason I think the connection somehow wore out is that a boorish solution I tried was to reconnect to the server every time I use EX_SFTP::$connection. So only using fresh connections is an answer, but I can do better than that. Unfortunately, I don't know of any reliable way to test the health of a connection.
  17. When I Google the above string I find a lot of advice about using SFTP, turning on blocking, upgrading libraries and such, however, the code that does this seems to work during some operations and not work during others, so I don't think it's a matter of a buggy library. If I could find out why it cannot create the remote file, that might do a world of good. But I've been through all of /var/log and some log messages acknowledge the ssh session, but don't give any clues as to what goes wrong. I've looked at the user, password, host name and port name in and around the ssh2_connect() call. They are all good. I've also checked the permissions and ownership on the destination directory. They aren't the problem either. I've also tried duplicating the call w/a command-line scp call, and that test passes also. So now find myself staring at this "failure creating remote file" message, wondering what the failure is, and I'm running out of ideas. I'm running RHEL AS release 4.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.