Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent behaviour between servers #34

Open
zeb600 opened this issue Feb 18, 2016 · 3 comments
Open

Inconsistent behaviour between servers #34

zeb600 opened this issue Feb 18, 2016 · 3 comments

Comments

@zeb600
Copy link

zeb600 commented Feb 18, 2016

Hi,

first of all thanks for a great module.

I do have two kind-of-issues - maybe questions - though:
Right now I'm only using it to monitor and track changes to a couple of fields in one model.
On my dev box everything works fine. After pushing to production there's the slight issue of "0" not being written to the audit_field table.

I.e.: On dev box:

old value new value
0 1
1 0

On prod box:

old value new value
1
1

There's literally nothing in where 0 should be. My "ingoreValues" array for that model is empty:

'AuditFieldBehavior' => array(
                'class' => 'audit.components.AuditFieldBehavior',
                'additionalAuditModels' => array(
                    //'Tipp' => 'fk_tipp_user_id',
                ),
                'ignoreFields' => array(
                    'insert' => array('tipp_last_updated, tipp_adm_visit_date'),
                    'update' => array('tipp_last_updated, tipp_adm_visit_date'),
                ),
                'enableAuditField' => true,
                'ignoreValues' => array(),
            ),

Any thoughts?

Also the audit_request_id never changes (always 0), is that expected behaviour?

I'm using the latest stable version (1.1.10) /w yii 1.1.15

@cornernote
Copy link
Owner

For your first issue (0 vs null), are the databases exactly the same? At a guess I would assume that your prod db allows null and the dev box is set to not null for the field in question.

For your second issue (audit_request_id=0), it would seem that for some reason the AuditRequest is not being written. This is very strange. I would recommend debugging the code that starts here, and reporting your findings:
https://github.com/cornernote/yii-audit-module/blob/master/audit/components/AuditErrorHandler.php#L192

@zeb600
Copy link
Author

zeb600 commented Feb 19, 2016

Thanks for your quick reply.

First issue: That's what I thought at first, but the DBs are the same. Both allow NULL.

EDIT AH I found something:

changing

'ignoreValues' => array(),

to

'ignoreValues' => array('ohwelljustignoreme'),

seems to fix it, 0 is now written correctly to the prod DB.
Somehow the empty ignoreValue array didn't overwrite the default

public $ignoreValues = array('0', '0.0', '0.00', '0.000', '0.0000', '0.00000', '0.000000', '0000-00-00', '0000-00-00 00:00:00');

in AuditFieldBehavior.php? Don't really see how that's possible - or could be different depending on box.

Second issue: Will investigate.

@cornernote
Copy link
Owner

Yes, it should be assigning array() to AuditFieldBehavior->ignoreValues when the CActiveRecord attaches the behaviors here:
https://github.com/yiisoft/yii/blob/1.1.17/framework/YiiBase.php#L220

Very strange that this functionality differs on a different operating environment.

Can you list the OS and PHP versions in your dev/prod boxes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants