Hello Leon.
I'm sorry I took this long to answer. I am trying to implement this on my free time and the last couple of weeks have been a nightmare.
Your advice was spot on, I went to the config of the external character set and changed from the Oracle way to the PHP way and things got better, the recordset showed the fields.
Then I added your DEBUG lines and with the change in the setting I started to see the username ok.
But, with this changes, the error still happens. Still says the email is null.
For some reason it does not enter the clause "if (!$rs->EOF) {"
I share the debug from running by command line:
DEBUG-A: $username == "syncuser01"
DEBUG-B: $extusername == "syncuser01"
--------------------------------
SELECT * FROM m_user_info_field
[array (
)]
--------------------------------
Query took: 0.0029289722442627 seconds.
--------------------------------
DEBUG-3: Select Columns == FIRSTNAME AS F0, LASTNAME AS F1, EMAIL AS F2, INSTITUTION AS F3, PROFILE_FIELD_ENTIDADE AS F4, USERNAME AS F5
DEBUG-4: Sql Query = SELECT FIRSTNAME AS F0, LASTNAME AS F1, EMAIL AS F2, INSTITUTION AS F3, PROFILE_FIELD_ENTIDADE AS F4, USERNAME AS F5
FROM M_CREATE_USER
WHERE USERNAME = 'syncuser01'
DEBUG-5: RecordSet == F0,F1,F2,F3,F4,F5^M
Sync,User01,syncuser01@gmail.com,IFB,IFB,syncuser01^M
--------------------------------
SELECT id,username,auth FROM m_user WHERE username = :o_username AND mnethostid = :o_mnethostid AND auth <> :o_auth
[array (
'o_username' => 'syncuser01',
'o_mnethostid' => '1',
'o_auth' => 'db',
)]
--------------------------------
Query took: 0.0021331310272217 seconds.
--------------------------------
DEBUG-2: Calling user_create_user() with $user->email == (not set)
--------------------------------
INSERT INTO m_user (username,confirmed,auth,mnethostid,lang,calendartype,maildisplay,mailformat,maildigest,autosubscribe,trackforums,timecreated,timemodified) VALUES (:username,:confirmed,:auth,:mnethostid,:lang,:calendartype,:maildisplay,:mailformat,:maildigest,:autosubscribe,:trackforums,:timecreated,:timemodified) RETURNING id INTO :oracle_id
[array (
'username' => 'syncuser01',
'confirmed' => 1,
'auth' => 'db',
'mnethostid' => '1',
'lang' => 'pt',
'calendartype' => 'gregorian',
'maildisplay' => '0',
'mailformat' => '1',
'maildigest' => '0',
'autosubscribe' => '0',
'trackforums' => '0',
'timecreated' => 1639999471,
'timemodified' => 1639999471,
)]
--------------------------------
Erro ao criar o utilizador syncuser01 (Ocorreu um erro ao guardar na base de dados (ORA-01400: cannot insert NULL into ("WB_MOODLE_PRE"."M_USER"."EMAIL")
INSERT INTO m_user (username,confirmed,auth,mnethostid,lang,calendartype,maildisplay,mailformat,maildigest,autosubscribe,trackforums,timecreated,timemodified) VALUES (:username,:confirmed,:auth,:mnethostid,:lang,:calendartype,:maildisplay,:mailformat,:maildigest,:autosubscribe,:trackforums,:timecreated,:timemodified) RETURNING id INTO :oracle_id
[array (
'username' => 'syncuser01',
'confirmed' => 1,
'auth' => 'db',
'mnethostid' => '1',
'lang' => 'pt',
'calendartype' => 'gregorian',
'maildisplay' => '0',
'mailformat' => '1',
'maildigest' => '0',
'autosubscribe' => '0',
'trackforums' => '0',
'timecreated' => 1639999471,
'timemodified' => 1639999471,
)])).
We now can see correct data in the recordset but it does not enter the if clause...
Again, many thanks.