Cezar708 Posted August 20, 2009 Share Posted August 20, 2009 Hi I am a newcomer here I have done an upgrade from PHP 5.1 to PHP 5.3 lately. In general everythinks works well except CLI command. Example: I have wrote a code. // adodb5 connection (version 5.0.9a), // I've tried with older adodb libraries with the same results require($ADODBPATH); $conn = NewADOConnection('postgres'); $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $conn->Connect($PGHOSTNAME, $PGUSER, $PGPASSWORD, $PGBASE); echo "1. before StartTrans\n"; $conn->StartTrans(); echo "2. after StartTrans and before GetAll\n"; $table = $conn->GetAll("SELECT id_user, username, firstname, lastname FROM users;"); echo "3. after GetAll and before CompleteTrans\n"; $conn->CompleteTrans(); echo "4. The end\n"; The expecting command line output is: 1. before StartTrans 2. after StartTrans and before GetAll 3. after GetAll and before CompleteTrans 4. The end The problem is... my output is: 1. before StartTrans No message, no warnings, no exceptions... nothing is appears that can help me find the answer... Script call the function StartTrans() and unexpectedly exits without any message. What am I doing wrong? I have downloaded adodb library from this link: adodb509a.tgz and of course I do no modifications. Any help will be very welcome. Regards Cezar708 PS: I tried write this post without language mistakes Quote Link to comment https://forums.phpfreaks.com/topic/171147-cli-in-php-53-doesnt-work-properly/ Share on other sites More sharing options...
Daniel0 Posted August 20, 2009 Share Posted August 20, 2009 Do you have error reporting on? Quote Link to comment https://forums.phpfreaks.com/topic/171147-cli-in-php-53-doesnt-work-properly/#findComment-902551 Share on other sites More sharing options...
Cezar708 Posted August 20, 2009 Author Share Posted August 20, 2009 Yes, error_reporting = E_ALL display_errors = On for example when I run the code: echo $a; $x = 123/0; throw new Exception(); the output is: PHP Notice: Undefined variable: a in /home/cezary/test.php on line 2 PHP Warning: Division by zero in /home/cezary/test.php on line 3 PHP Fatal error: Uncaught exception 'Exception' in /home/cezary/test.php:4 Stack trace: #0 {main} thrown in /home/cezary/test.php on line 4 its means that error reporting works fine. But no error appears when I run code from my first post. Regards Cezar708 Quote Link to comment https://forums.phpfreaks.com/topic/171147-cli-in-php-53-doesnt-work-properly/#findComment-902568 Share on other sites More sharing options...
Cezar708 Posted August 21, 2009 Author Share Posted August 21, 2009 NOTE: I checked out this code with php 5.2.9. There is no problem with this php version... ... unfortunately i needed at least 5.3 version... maybe have you got any suggestion? Quote Link to comment https://forums.phpfreaks.com/topic/171147-cli-in-php-53-doesnt-work-properly/#findComment-903124 Share on other sites More sharing options...
trq Posted August 21, 2009 Share Posted August 21, 2009 I would suggest it is likely a problem with that third party code rather than php, maybe its suppressing errors internally or something. Quote Link to comment https://forums.phpfreaks.com/topic/171147-cli-in-php-53-doesnt-work-properly/#findComment-903125 Share on other sites More sharing options...
Cezar708 Posted August 21, 2009 Author Share Posted August 21, 2009 Thank you for your post. ... but script works with php 5.1 and php 5.2.9... I did nothing between uninstalling 5.2.9 and installing 5.3.0. Is it possible that php 5.3.0 is incompatible with other software? How can I check which one is it? My operating system is CentOS 5 and I have installed only necessary applications for web developing (like: Apache2, subversion 1.5, postgres 7.3) Regards Cezary708 Quote Link to comment https://forums.phpfreaks.com/topic/171147-cli-in-php-53-doesnt-work-properly/#findComment-903154 Share on other sites More sharing options...
Daniel0 Posted August 21, 2009 Share Posted August 21, 2009 Yes, it is. See: http://www.php.net/manual/en/migration53.php As thorpe said, the library is probably messing with the error reporting, hence the reason why you aren't seeing any errors but it fails regardless. Quote Link to comment https://forums.phpfreaks.com/topic/171147-cli-in-php-53-doesnt-work-properly/#findComment-903157 Share on other sites More sharing options...
Cezar708 Posted August 21, 2009 Author Share Posted August 21, 2009 ~Daniel0 I have read this docs just before upgrade. I tried to locate a place where the script exits. And result of my investigation is: I modified the Adodb method StartTrans() (file adodb.inc.php line: ~866): function StartTrans($errfn = 'ADODB_TransMonitor') { echo "\t1.1 #1\n"; //my modification if ($this->transOff > 0) { $this->transOff += 1; return true; } echo "\t1.2 #1\n"; //my modification $this->_oldRaiseFn = $this->raiseErrorFn; $this->raiseErrorFn = $errfn; $this->_transOK = true; echo "\t1.3 #1\n"; //my modification if ($this->debug && $this->transCnt > 0) ADOConnection::outp("Bad Transaction: StartTrans called within BeginTrans"); echo "\t1.4 #1\n"; //my modification $ok = $this->BeginTrans(); echo "\t1.5 #1\n"; //my modification $this->transOff = 1; return $ok; } so my script output is: bash-3.1$ php test.php 1. before StartTrans 1.1 #1 1.2 #1 1.3 #1 1.4 #1 next I modified the BeginTrans() method: (file adodb.inc.php line: ~2147): function BeginTrans() { echo "\t1.4.1 #1\n"; //my modification if ($this->debug) ADOConnection::outp("BeginTrans: Transactions not supported for this driver"); echo "\t1.4.2 #1\n"; //my modification return false; } I also modified __call() function (line ~2837): function __call($func, $params) { echo "\t\t > in call function \n"; return call_user_func_array(array($this->rs, $func), $params); } and the result is the same: bash-3.1$ php test.php 1. before StartTrans 1.1 #1 1.2 #1 1.3 #1 1.4 #1 Why function BeginTrans() isn't called? Unfortunately I don't know why Maybe some compilation problem, for example maybe 5.3 does not accept syntax "function funName()". Maybe 5.3 prefer "public function funcName()" syntax... Deprecated features described in http://pl.php.net/manual/en/migration53.deprecated.php are avoided in adodb.inc.php (in my opinion)... OK, I don't give up I will try to find the solution. If you have any concept what is wrong write here, please. Regards Cezar708 Quote Link to comment https://forums.phpfreaks.com/topic/171147-cli-in-php-53-doesnt-work-properly/#findComment-903217 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.