31
rossb
Re: Really stupid php / sql problem
  • 2019/12/11 13:55

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


Further info:

Appears to be sql errors; despite the fact that queries execute OK from command line.
Previously (code above), ALL sql queries returned no results and, did not appear in transaction log.
And, yes, phpmyadmin reports db as "clean"

Really simple testcase (dump the class):
I researched this and error is commonly caused by:
sql: max_allowed_packet (I use 16M, nowhere near hitting this limit)
sql: wait_timeout, interactive_timeout (I use 28800, nowhere near hitting this limit)
running outa memory:
free -h
total used free shared buffers cached
Mem: 1.9G 1.8G 140M 60K 45M 495M
-/+ buffers/cache: 1.3G 681M
Swap: 3.9G 115M 3.8G

$member_handler xoops_getHandler('member');
file_put_contents(OLEDRION_GATEWAY_LOG_PATH"users_ids: " print_r($user_ids,true) . "n"FILE_APPEND LOCK_EX);
memberHandlerXoopsMemberHandler Object
(
    [
groupHandler:protected] => XoopsGroupHandler Object
        
(
            [
table] => xoops_groups
            
[db] => XoopsMySQLDatabaseProxy Object
                
(
                    [
conn] => mysqli Object
                        
(
                            [
affected_rows] => -1
                            
[client_info] => mysqlnd 5.0.11-dev 20120503 $Id76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
                            [
client_version] => 50011
                            
[connect_errno] => 0
                            
[connect_error] => 
                            [
errno] => 2006
                            
[error] => MySQL server has gone away
                            
[error_list] => Array
                                (
                                    [
0] => Array
                                        (
                                            [
errno] => 2006
                                            
[sqlstate] => HY000
                                            
[error] => MySQL server has gone away
                                        
)

                                    [
1] => Array
                                        (
                                            [
errno] => 2006
                                            
[sqlstate] => HY000
                                            
[error] => MySQL server has gone away
                                        
)

                                )

                            [
field_count] => 0
                            
[host_info] => Localhost via UNIX socket
                            
[info] => Rows matched1  Changed1  Warnings0
                            
[insert_id] => 0
                            
[server_info] => 5.5.60-log
                            
[server_version] => 50560
                            
[stat] => 
                            [
sqlstate] => HY000
                            
[protocol_version] => 10
                            
[thread_id] => 2346
                            
[warning_count] => 0
                        
)

                    [
prefix] => xoops
                    
[logger] => XoopsLogger Object
                        
(
                            [
queries] => Array
                                (
                                    [
0] => Array
                                        (
                                            [
sql] => SET SQL_BIG_SELECTS 1
                                            
[error] => 
                                            [
errno] => 
                                            [
query_time] => 0.00029397010803223
                                        
)

                                    [
1] => Array
                                        (
                                            [
sql] => SELECT FROM xoops_config WHERE (conf_modid '0' AND conf_catid '1'ORDER BY conf_order ASC
                                            
[error] => 
                                            [
errno] => 
                                            [
query_time] => 0.0035851001739502
                                        
)

                                    [
2] => Array
                                        (
                                            [
sql] => SELECT sess_datasess_ip FROM xoops_session WHERE sess_id '3l1hmfs01p6f82lu11uk0tmgk1'
                                            
[error] => 
                                            [
errno] => 
                                            [
query_time] => 0.00056004524230957
                                        
)

                                )

                            [
blocks] => Array
                                (
                                )

                            [
extra] => Array
                                (
                                )

                            [
logstart] => Array
                                (
                                    [
XOOPS] => 1576070405.709
                                    
[XOOPS Boot] => 1576070405.709
                                
)

                            [
logend] => Array
                                (
                                    [
query_time] => 1576070405.7597
                                
)

                            [
errors] => Array
                                (
                                )

                            [
deprecated] => Array
                                (
                                )

                            [
usePopup] => 
                            [
activated] => 
                            [
renderingEnabled] => 1
                        
)

                    [
allowWebChanges] => 1
                
)

        )

    [
userHandler:protected] => XoopsUserHandler Object
        
(
            [
handler] => 
            [
handlers] => Array
                (
                    [
read] => 
                    [
stats] => 
                    [
joint] => 
                    [
write] => 
                    [
sync] => 
                )

            [
table] => xoops_users
            
[keyName] => uid
            
[className] => XoopsUser
            
[identifierName] => uname
            
[field_link] => 
            [
field_object] => 
            [
db] => XoopsMySQLDatabaseProxy Object
                
(
                    [
conn] => mysqli Object
                        
(
                            [
affected_rows] => -1
                            
[client_info] => mysqlnd 5.0.11-dev 20120503 $Id76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
                            [
client_version] => 50011
                            
[connect_errno] => 0
                            
[connect_error] => 
                            [
errno] => 2006
                            
[error] => MySQL server has gone away
                            
[error_list] => Array
                                (
                                    [
0] => Array
                                        (
                                            [
errno] => 2006
                                            
[sqlstate] => HY000
                                            
[error] => MySQL server has gone away
                                        
)

                                    [
1] => Array
                                        (
                                            [
errno] => 2006
                                            
[sqlstate] => HY000
                                            
[error] => MySQL server has gone away
                                        
)

                                    [
2] => Array
                                        (
                                            [
errno] => 2006
                                            
[sqlstate] => HY000
                                            
[error] => MySQL server has gone away
                                        
)

                                )

                            [
field_count] => 0
                            
[host_info] => Localhost via UNIX socket
                            
[info] => Rows matched1  Changed1  Warnings0
                            
[insert_id] => 0
                            
[server_info] => 5.5.60-log
                            
[server_version] => 50560
                            
[stat] => 
                            [
sqlstate] => HY000
                            
[protocol_version] => 10
                            
[thread_id] => 2346
                            
[warning_count] => 0
                        
)

                    [
prefix] => xoops
                    
[logger] => XoopsLogger Object
                        
(
                            [
queries] => Array
                                (
                                    [
0] => Array
                                        (
                                            [
sql] => SET SQL_BIG_SELECTS 1
                                            
[error] => 
                                            [
errno] => 
                                            [
query_time] => 0.00029397010803223
                                        
)

                                    [
1] => Array
                                        (
                                            [
sql] => SELECT FROM xoops_config WHERE (conf_modid '0' AND conf_catid '1'ORDER BY conf_order ASC
                                            
[error] => 
                                            [
errno] => 
                                            [
query_time] => 0.0035851001739502
                                        
)

                                    [
2] => Array
                                        (
                                            [
sql] => SELECT sess_datasess_ip FROM xoops_session WHERE sess_id '3l1hmfs01p6f82lu11uk0tmgk1'
                                            
[error] => 
                                            [
errno] => 
                                            [
query_time] => 0.00056004524230957
                                        
)

                                )

                            [
blocks] => Array
                                (
                                )

                            [
extra] => Array
                                (
                                )

                            [
logstart] => Array
                                (
                                    [
XOOPS] => 1576070405.709
                                    
[XOOPS Boot] => 1576070405.709
                                
)

                            [
logend] => Array
                                (
                                    [
query_time] => 1576070405.7597
                                
)

                            [
errors] => Array
                                (
                                )

                            [
deprecated] => Array
                                (
                                )

                            [
usePopup] => 
                            [
activated] => 
                            [
renderingEnabled] => 1
                        
)

                    [
allowWebChanges] => 1
                
)

        )

    [
membershipHandler:protected] => XoopsMembershipHandler Object
        
(
            [
table] => xoops_groups_users_link
            
[db] => XoopsMySQLDatabaseProxy Object
                
(
                    [
conn] => mysqli Object
                        
(
                            [
affected_rows] => -1
                            
[client_info] => mysqlnd 5.0.11-dev 20120503 $Id76b08b24596e12d4553bd41fc93cccd5bac2fe7a $
                            [
client_version] => 50011
                            
[connect_errno] => 0
                            
[connect_error] => 
                            [
errno] => 2006
                            
[error] => MySQL server has gone away
                            
[error_list] => Array
                                (
                                    [
0] => Array
                                        (
                                            [
errno] => 2006
                                            
[sqlstate] => HY000
                                            
[error] => MySQL server has gone away
                                        
)

                                    [
1] => Array
                                        (
                                            [
errno] => 2006
                                            
[sqlstate] => HY000
                                            
[error] => MySQL server has gone away
                                        
)

                                    [
2] => Array
                                        (
                                            [
errno] => 2006
                                            
[sqlstate] => HY000
                                            
[error] => MySQL server has gone away
                                        
)

                                    [
3] => Array
                                        (
                                            [
errno] => 2006
                                            
[sqlstate] => HY000
                                            
[error] => MySQL server has gone away
                                        
)

                                )

                            [
field_count] => 0
                            
[host_info] => Localhost via UNIX socket
                            
[info] => Rows matched1  Changed1  Warnings0
                            
[insert_id] => 0
                            
[server_info] => 5.5.60-log
                            
[server_version] => 50560
                            
[stat] => 
                            [
sqlstate] => HY000
                            
[protocol_version] => 10
                            
[thread_id] => 2346
                            
[warning_count] => 0
                        
)

                    [
prefix] => xoops
                    
[logger] => XoopsLogger Object
                        
(
                            [
queries] => Array
                                (
                                    [
0] => Array
                                        (
                                            [
sql] => SET SQL_BIG_SELECTS 1
                                            
[error] => 
                                            [
errno] => 
                                            [
query_time] => 0.00029397010803223
                                        
)

                                    [
1] => Array
                                        (
                                            [
sql] => SELECT FROM xoops_config WHERE (conf_modid '0' AND conf_catid '1'ORDER BY conf_order ASC
                                            
[error] => 
                                            [
errno] => 
                                            [
query_time] => 0.0035851001739502
                                        
)

                                    [
2] => Array
                                        (
                                            [
sql] => SELECT sess_datasess_ip FROM xoops_session WHERE sess_id '3l1hmfs01p6f82lu11uk0tmgk1'
                                            
[error] => 
                                            [
errno] => 
                                            [
query_time] => 0.00056004524230957
                                        
)

                                )

                            [
blocks] => Array
                                (
                                )

                            [
extra] => Array
                                (
                                )

                            [
logstart] => Array
                                (
                                    [
XOOPS] => 1576070405.709
                                    
[XOOPS Boot] => 1576070405.709
                                
)

                            [
logend] => Array
                                (
                                    [
query_time] => 1576070405.7597
                                
)

                            [
errors] => Array
                                (
                                )

                            [
deprecated] => Array
                                (
                                )

                            [
usePopup] => 
                            [
activated] => 
                            [
renderingEnabled] => 1
                        
)

                    [
allowWebChanges] => 1
                
)

        )

    [
membersWorkingList:protected] => Array
        (
        )

)


What I don't get is why simply instantiating $member_handler = xoops_getHandler('member'); results in errors.

I also have issues with new members being unable to register - keeps returning to basic registration page.

I have spent way too much time on this and am considering giving up on oledrion and finding a non-xoops e-commerce solution.

Anyone care to assist debugging? May involve sshing in.

Regards;
Bill



32
rossb
Really stupid php / sql problem
  • 2019/12/9 14:14

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


Xoops 2.5.9

attempting to fix oledrions bug: "Oledrion\Utility::getEmailsFromGroup" is returning empty

The emails are for the vendor to be notified of sale.

// grp_sold is config var == 1 (Administrator group)
$db XoopsDatabaseFactory::getDatabaseConnection();
$grp_sold_user_ids = []; // Array of user ID's to send emails to
$sql 'SELECT uid FROM ' $db->prefix('groups_users_link') . ' WHERE groupid=' . (int)$grp_sold;
$result_sql $db->query($sql);
if (
$result_sql) {
    while (
$myrow $db->fetchArray($result_sql)) {
        
$grp_sold_user_ids[] = $myrow['uid'];
    }
}
file_put_contents(OLEDRION_GATEWAY_LOG_PATH"implode: " implode(','$grp_sold_user_ids) . "n"FILE_APPEND LOCK_EX);
$sql 'SELECT email FROM ' $db->prefix('users') . ' WHERE uid IN (' implode(','$grp_sold_user_ids) . ')';
$admin_emails = []; 
$result_sql $db->query($sql);
if (
$result_sql) {
    while (
$myrow $db->fetchArray($result_sql)) {
        
$admin_emails[] = $myrow['email'];
    }
}


What I am seeing:
$grp_sold_user_ids tests as array, print_r($grp_sold_user_ids); evaluates to 1
implode(',', $grp_sold_user_ids); // returns null should be 1
implode(',', array(1,2,3); //returns 1,2,3 - OK
implode(',', array(1); //returns 1 - OK

Anyone?
Thanks, Bill



33
rossb
Re: oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/9 13:32

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


figured out you're really busy - not rocket science.

when you do get around to oledrion, hopefully only tasks remaining:
- code review my RC2 changes - will send U patches
- theming needs serious work

...B



34
rossb
Re: oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/7 16:56

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


Found a workaround. May be xoops-2.5.9 bug

/class/mail/phpmailer/class.phpmailer.php, alter function (comment stuff):

public function postSend()
    {
        try {
            
// Choose the mailer and send through it
            
switch ($this->Mailer) {
                case 
'sendmail':
                case 
'qmail':
                    return 
$this->sendmailSend($this->MIMEHeader$this->MIMEBody);
                case 
'smtp':
                    return 
$this->smtpSend($this->MIMEHeader$this->MIMEBody);
                case 
'mail':
                    return 
$this->mailSend($this->MIMEHeader$this->MIMEBody);
                default:
                    
//$sendMethod = $this->Mailer.'Send';
                    //if (method_exists($this, $sendMethod)) {
                    //    return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody);
                    //}
                    //file_put_contents(OLEDRION_GATEWAY_LOG_PATH, "!" , FILE_APPEND | LOCK_EX);
                    
return $this->mailSend($this->MIMEHeader$this->MIMEBody);
            }
        } catch (
phpmailerException $exc) {
            
$this->setError($exc->getMessage());
            
$this->edebug($exc->getMessage());
            if (
$this->exceptions) {
                throw 
$exc;
            }
        }
        return 
false;
    }



since
$this->$sendMethod($this->MIMEHeader$this->MIMEBody);

does not return, causes exception with no error text.

...B



35
rossb
Re: oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/6 20:35

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


thanks anyway. Need to finish cleanup and testing added features first. Once I get it to point where email is only issue, will consider publishing.

That doesn't mean, If a collaborator volunteers, that I am not prepared to immediately collaborate.
Oledrion is also in need of theming, by someone more competent than I.

...B



36
rossb
Re: oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/5 17:24

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


Hi Zyspec;

THANKs for your interest

I am using oledrion-2.35_RC1
latest, for xoops-2.5.10 :https://github.com/XoopsModules25x/oledrion
https://github.com/XoopsModules25x/oledrion
have hacked xoops_version.php for 2.5.9: "$modversion['min_xoops'] = '2.5.9';"
...since I see no 2.5.9 incompatibilities

Am attempting to fix / update oledrion for the community. CMS without working e-commerce module? Sad state of affairs.

If you want to go beyond code inspection, I will have to update you, since there are class naming and other errors in RC1.

re: * In the code on Github. It looks to me like the call to the Utility::sendEmailFromTpl() method has been commented out (line 688) in the checkout routine (./checkout.php). I assume you've uncommented that code to see if it works?

no, that code has been moved to modules/oledrion/class/Gateways/Paypal/PaypalGateway.php to send confirmation emails AFTER Paypal verify (made ZERO sense to confirm an order before paid for), part or changes mamba and I made for RC1. Since then (in addition to email issues), Paypal session dynamics have changed, breaking things.

Meanwhile, I am going deeper down rabbit hole, with debug statements to establish what's failing. Ignorance re low level email algorithms IS my problem.

Regards;
Bill



37
rossb
oledrion: phpmailer postSend() not returning - stuck in try loop
  • 2019/12/4 14:51

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


Hi;
xoops 2.5.9, sme-server 9.2

I am attempting to update oledrion e-commerce to latest Paypal API and added functionality. Been stuck on sending purchase notification emails for over a week.

All other site emails working properly: registration, contact us...
email config (all blank except):
From user: xoops
Delivery Method: PHP Mail()
Path to sendmail: /usr/sbin/sendmail

class/mail/phpmailer/class.phpmailer.php::postSend() stuck in infinite retry loop
modified (for debug info) code:
...
public function postSend()
    {
        try {
            
// Choose the mailer and send through it
            //file_put_contents(OLEDRION_GATEWAY_LOG_PATH, "postsend1, method: " . $this->Mailer . "n", FILE_APPEND | LOCK_EX);
            
file_put_contents(OLEDRION_GATEWAY_LOG_PATH"." FILE_APPEND LOCK_EX);
            switch (
$this->Mailer) {
                case 
'sendmail':
                case 
'qmail':
                    return 
$this->sendmailSend($this->MIMEHeader$this->MIMEBody);
                case 
'smtp':
                    return 
$this->smtpSend($this->MIMEHeader$this->MIMEBody);
                case 
'mail':
                    return 
$this->mailSend($this->MIMEHeader$this->MIMEBody);
                default:
                    
$sendMethod $this->Mailer.'Send';
                    if (
method_exists($this$sendMethod)) {
                        return 
$this->$sendMethod($this->MIMEHeader$this->MIMEBody);
                    }

                    return 
$this->mailSend($this->MIMEHeader$this->MIMEBody);
            }
        } catch (
phpmailerException $exc) {
            
file_put_contents(OLEDRION_GATEWAY_LOG_PATH"postsend2, error: " $exc->getMessage() . "n"FILE_APPEND LOCK_EX);
            
$this->setError($exc->getMessage());
            
$this->edebug($exc->getMessage());
            if (
$this->exceptions) {
                throw 
$exc;
            }
        }
        return 
false;
    }

```
What I am seeing:
- Many "." in logfile, one per try attempt
- No catch exception (no entry in logfile)
- My mail send function never returns
- No record of "retry" email attempts in system logs
- No errors reported

My best "guess" as to what is happening is the email contents are template generated and not to mail's liking.

example email template input:
msg: Array
(
    [
COMMANDE] => 6     SecureOffice              Donate        1          $10.00


Total 
$10.00

    
[NUM_COMMANDE] => 252
    
[NOM] => Ross
    
[PRENOM] =>
    [
ADRESSE] =>
    [
CP] => noe1l0
    
[VILLE] => Oakland
    
[PAYS] => United States
    
[TELEPHONE] =>
    [
EMAIL] => ****private
    [
URL_BILL] => https://www.ayz.org/modules/oledrion/invoice.php?id=252&pass=****private
    
[IP] => 192.168.1.27
    
[FACTURE] => Yes
    
[TRANSACTION_ID] => 72K6104879318750E
)


This is way beyond my skill set. Failed try lacking exception. Need help.

Thanks;
Bill



38
rossb
Re: Login not working except from user.php
  • 2019/10/15 16:46

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


Damn; xoops_session corrupt; repaired. All good now:)



39
rossb
Re: Login not working except from user.php
  • 2019/10/14 20:47

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


Thanks geekwright;

You have already gone above and beyond. To see the failure, you will have to be a real user.

Already using jGrowl redirect. As you state: likely my theme interfering.
will try Google Chrome's developer tools
bottom line: got some learning to do, to debug this.
for now, will just replace login control with a link to login, since I am focused on updating content, major release, new features will keep me busy for at least a week.

Regards;
Bill



40
rossb
Re: Login not working except from user.php
  • 2019/10/13 18:49

  • rossb

  • Just popping in

  • Posts: 77

  • Since: 2006/8/28


Thanks @geekwright

There must be something else. Still nada response. Already have debug on (no errs). Is there some instrumentation or debugging I can add to get to the root of this? Can you try the code, your site?

Regards;
Bill

Current (exactly as suggested):

<{if !$xoops_isuser}>
        <
form method="post" action="<{xoAppUrl /user.php}>">
        <
input type="hidden" name="op" value="login"/>
            <{
$smarty.const._LOGIN}>&nbsp;
            <
input name="uname" type="text" />&nbsp;&nbsp;<input name="pass" type="password"/>
            <
input type="hidden" name="xoops_redirect" value="<{$smarty.server.REQUEST_URI}>" />

            <{if 
$lang_siteclosemsg}>
                <
input type="hidden" name="xoops_login" value="1" />
            <{/if}>
            <
button type="submit"><img src="/SecureOffice_Images/icons/home.png" height="75%" alt="<{$smarty.const._LOGIN}>" /$
            <{if !
$lang_siteclosemsg}>
                &
nbsp;+&nbsp;<a href="<{xoAppUrl /register.php}>" class="register" title="<{$smarty.const._REGISTER}>"><{$smar$
            <{/if}>
        </
form>
    <{else}>




TopTop
« 1 2 3 (4) 5 6 7 »



Login

Who's Online

181 user(s) are online (110 user(s) are browsing Support Forums)


Members: 0


Guests: 181


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits