Jump to content

Recommended Posts

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 ;)

Link to comment
https://forums.phpfreaks.com/topic/171147-cli-in-php-53-doesnt-work-properly/
Share on other sites

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

 

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

~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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.