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

[BUG] v1.3.0 ::findFirst() stopped working as a result of a recent commit #2118

Closed
temuri416 opened this Issue Mar 2, 2014 · 53 comments

Comments

Projects
None yet
6 participants
@temuri416
Contributor

temuri416 commented Mar 2, 2014

Hi,

It looks like last month has been rough on Phalcon branch 1.3.0.

My code has suddenly stopped working as a result of commit 7e54b69:

Column 'id' doesn't belong to any of the selected models (2), when preparing: SELECT [App\User\Account].* FROM [App\User\Account] WHERE [id] = ?0 AND [record_status] = ?1 LIMIT 1
$parameters = [
    'bind' => [
        0 => 114,
        1 => 1
    ],
    'conditions' => '[id] = ?0 AND [record_status] = ?1'
];
$model = App\User\Account::findFirst($parameters);

Thanks!

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@dreamsxin

This comment has been minimized.

Show comment
Hide comment
@dreamsxin

dreamsxin Mar 3, 2014

Contributor

This error is because it can't obtain the model's source from the _models list. Check the model class name.

Contributor

dreamsxin commented Mar 3, 2014

This error is because it can't obtain the model's source from the _models list. Check the model class name.

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 3, 2014

Contributor

How do you explain that it is working with the previous commit and stops working after the one I have referenced?

Contributor

temuri416 commented Mar 3, 2014

How do you explain that it is working with the previous commit and stops working after the one I have referenced?

@dreamsxin

This comment has been minimized.

Show comment
Hide comment
@dreamsxin

dreamsxin Mar 3, 2014

Contributor

@sjinks How see?

Contributor

dreamsxin commented Mar 3, 2014

@sjinks How see?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

@temuri416 are you sure about 7e54b69? It is totally unrelated to the database / MVC stuff.

ghost commented Mar 7, 2014

@temuri416 are you sure about 7e54b69? It is totally unrelated to the database / MVC stuff.

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

Yes, I am quite positive. I was surprised myself.

I was compiling from ext/ folder. Can I re-test it some other way?

Contributor

temuri416 commented Mar 7, 2014

Yes, I am quite positive. I was surprised myself.

I was compiling from ext/ folder. Can I re-test it some other way?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

Are you able to reproduce it under CLI?

ghost commented Mar 7, 2014

Are you able to reproduce it under CLI?

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

yea that's a big question. I have a feeling that it is somehow related to Session.

Let me check a few things...

Contributor

temuri416 commented Mar 7, 2014

yea that's a big question. I have a feeling that it is somehow related to Session.

Let me check a few things...

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

yep. CLI is fine, HTTP is crashing each time.

I'm gonna move things a bit now.

Contributor

temuri416 commented Mar 7, 2014

yep. CLI is fine, HTTP is crashing each time.

I'm gonna move things a bit now.

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

Could there be some sort of screw-up in DB metadata being cached in session object?

Contributor

temuri416 commented Mar 7, 2014

Could there be some sort of screw-up in DB metadata being cached in session object?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

Possibly.

ghost commented Mar 7, 2014

Possibly.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

Can this be reproduced with

php -S 127.0.0.1:9000

?

ghost commented Mar 7, 2014

Can this be reproduced with

php -S 127.0.0.1:9000

?

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

it's really difficult, as I need to have a Google OAuth2 user in the session to reach that page. I am going to diagnose it further.

In the meantime, you may recall my problem with sessions being lost when an Exception is caught by IDE debugger.. that issue is back, is there a chance you could look at it?

Contributor

temuri416 commented Mar 7, 2014

it's really difficult, as I need to have a Google OAuth2 user in the session to reach that page. I am going to diagnose it further.

In the meantime, you may recall my problem with sessions being lost when an Exception is caught by IDE debugger.. that issue is back, is there a chance you could look at it?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

You can use smth like

php -S 0.0.0.0:9000

This will make PHP listen all interfaces.

ghost commented Mar 7, 2014

You can use smth like

php -S 0.0.0.0:9000

This will make PHP listen all interfaces.

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

hm, never done that before. let me see.

Contributor

temuri416 commented Mar 7, 2014

hm, never done that before. let me see.

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

php -S 0.0.0.0:9000
[Mon Mar 3 01:37:34 2014] Failed to listen on 0.0.0.0:9000 (reason: Address already in use)

Contributor

temuri416 commented Mar 7, 2014

php -S 0.0.0.0:9000
[Mon Mar 3 01:37:34 2014] Failed to listen on 0.0.0.0:9000 (reason: Address already in use)

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

Isn't php-fpm on 9000?

Contributor

temuri416 commented Mar 7, 2014

Isn't php-fpm on 9000?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

Well, please use any free port then :-)

ghost commented Mar 7, 2014

Well, please use any free port then :-)

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

If you are able to reproduce the bug then please run php under valgrind:

ZEND_DONT_UNLOAD_MODULES=1 USE_ZEND_ALLOC=0 valgrind php -S 0.0.0.0:9001

ghost commented Mar 7, 2014

If you are able to reproduce the bug then please run php under valgrind:

ZEND_DONT_UNLOAD_MODULES=1 USE_ZEND_ALLOC=0 valgrind php -S 0.0.0.0:9001
@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

This is crazy.

I have two very similar models: Member and Account.

This code works fine:

       $param = [
            'bind' => [
                62,
                1
            ],
            'conditions' => '[id] = ?0 AND [record_status] = ?1',
        ];

        $o = Member::findFirst($param);

And this one crashes:

        $param = [
            'bind' => [
                102,
                1
            ],
            'conditions' => '[id] = ?0 AND [record_status] = ?1',
        ];
        $o = Account::findFirst($param);

id column is a primary key and is present in both tables.

WTF?!!

Contributor

temuri416 commented Mar 7, 2014

This is crazy.

I have two very similar models: Member and Account.

This code works fine:

       $param = [
            'bind' => [
                62,
                1
            ],
            'conditions' => '[id] = ?0 AND [record_status] = ?1',
        ];

        $o = Member::findFirst($param);

And this one crashes:

        $param = [
            'bind' => [
                102,
                1
            ],
            'conditions' => '[id] = ?0 AND [record_status] = ?1',
        ];
        $o = Account::findFirst($param);

id column is a primary key and is present in both tables.

WTF?!!

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

.. and I have once again confirmed that 5350f1b is fine and 7e54b69 breaks it. from CLI - no problem. compiling from /ext with:

phpize .clean && phpize && ./configure CFLAGS="-O0 -g3" CC=gcc && make -j75 && sudo make install

Contributor

temuri416 commented Mar 7, 2014

.. and I have once again confirmed that 5350f1b is fine and 7e54b69 breaks it. from CLI - no problem. compiling from /ext with:

phpize .clean && phpize && ./configure CFLAGS="-O0 -g3" CC=gcc && make -j75 && sudo make install

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

Please try running php under valgrind, this will tell us if there are any invalid reads/writes.

ghost commented Mar 7, 2014

Please try running php under valgrind, this will tell us if there are any invalid reads/writes.

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

I am not sure how to set up php -S to replicate nginx site configuration. How do I make URL rewrites and so on work from CLI?

I can set up join.me session if you have time to work on this.

Contributor

temuri416 commented Mar 7, 2014

I am not sure how to set up php -S to replicate nginx site configuration. How do I make URL rewrites and so on work from CLI?

I can set up join.me session if you have time to work on this.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

Just create a file router.php:

<?php

if (isset($_SERVER['PATH_INFO'])) {
        $_GET['_url'] = $_SERVER['PATH_INFO'];
        require 'index.php';
}
else {
        return false;
}
?>

and place it where your index.php resides.

Then launch PHP like this:

php -S 0.0.0.0:9001 router.php

ghost commented Mar 7, 2014

Just create a file router.php:

<?php

if (isset($_SERVER['PATH_INFO'])) {
        $_GET['_url'] = $_SERVER['PATH_INFO'];
        require 'index.php';
}
else {
        return false;
}
?>

and place it where your index.php resides.

Then launch PHP like this:

php -S 0.0.0.0:9001 router.php
@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

alright, I got it set up.

The valgrind output is immense. How do I redirect it to a file?

Contributor

temuri416 commented Mar 7, 2014

alright, I got it set up.

The valgrind output is immense. How do I redirect it to a file?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

ZEND_DONT_UNLOAD_MODULES=1 USE_ZEND_ALLOC=0 valgrind php -S 0.0.0.0:9001 router.php 2>log.txt

ghost commented Mar 7, 2014

ZEND_DONT_UNLOAD_MODULES=1 USE_ZEND_ALLOC=0 valgrind php -S 0.0.0.0:9001 router.php 2>log.txt
@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

80kb. should I paste or email?

Contributor

temuri416 commented Mar 7, 2014

80kb. should I paste or email?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

pastebin is OK

ghost commented Mar 7, 2014

pastebin is OK

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416
Contributor

temuri416 commented Mar 7, 2014

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

You will see a lot of "dbg-php-5.5.so" there.

I have just disabled DBG module, but it did not help it.

I can also send you valgrind with DBG off.

Contributor

temuri416 commented Mar 7, 2014

You will see a lot of "dbg-php-5.5.so" there.

I have just disabled DBG module, but it did not help it.

I can also send you valgrind with DBG off.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

yes, please

ghost commented Mar 7, 2014

yes, please

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

==2059== Memcheck, a memory error detector
==2059== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2059== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2059== Command: php -S 0.0.0.0:9009 index.php
==2059==
[Mon Mar 3 02:24:32 2014] PHP Deprecated: Comments starting with '#' are deprecated in /etc/php/php.ini on line 1966 in Unknown on line 0
==2059== Invalid read of size 1
==2059== at 0x73BC67: zif_strtr (string.c:2828)
==2059== by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2059== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2059== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2059== by 0x80BF60: zend_call_function (zend_execute_API.c:939)
==2059== by 0x70EC53: zif_call_user_func (basic_functions.c:4780)
==2059== by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2059== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2059== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2059== by 0xFA772D0: phalcon_internal_require (require.c:103)
==2059== by 0xFA774E8: phalcon_require (require.c:144)
==2059== by 0xFB86361: zim_Phalcon_Mvc_View_Engine_Php_render (php.c:107)
==2059== Address 0x1078969d is 3 bytes before a block of size 7 alloc'd
==2059== at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2059== by 0x7453FE: php_raw_url_encode (url.c:606)
==2059== by 0x745514: zif_rawurlencode (url.c:645)
==2059== by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2059== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2059== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2059== by 0x80BF60: zend_call_function (zend_execute_API.c:939)
==2059== by 0x70EC53: zif_call_user_func (basic_functions.c:4780)
==2059== by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2059== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2059== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2059== by 0xFA772D0: phalcon_internal_require (require.c:103)
==2059==

Contributor

temuri416 commented Mar 7, 2014

==2059== Memcheck, a memory error detector
==2059== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2059== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2059== Command: php -S 0.0.0.0:9009 index.php
==2059==
[Mon Mar 3 02:24:32 2014] PHP Deprecated: Comments starting with '#' are deprecated in /etc/php/php.ini on line 1966 in Unknown on line 0
==2059== Invalid read of size 1
==2059== at 0x73BC67: zif_strtr (string.c:2828)
==2059== by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2059== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2059== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2059== by 0x80BF60: zend_call_function (zend_execute_API.c:939)
==2059== by 0x70EC53: zif_call_user_func (basic_functions.c:4780)
==2059== by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2059== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2059== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2059== by 0xFA772D0: phalcon_internal_require (require.c:103)
==2059== by 0xFA774E8: phalcon_require (require.c:144)
==2059== by 0xFB86361: zim_Phalcon_Mvc_View_Engine_Php_render (php.c:107)
==2059== Address 0x1078969d is 3 bytes before a block of size 7 alloc'd
==2059== at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2059== by 0x7453FE: php_raw_url_encode (url.c:606)
==2059== by 0x745514: zif_rawurlencode (url.c:645)
==2059== by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2059== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2059== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2059== by 0x80BF60: zend_call_function (zend_execute_API.c:939)
==2059== by 0x70EC53: zif_call_user_func (basic_functions.c:4780)
==2059== by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2059== by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2059== by 0x888817: execute_ex (zend_vm_execute.h:356)
==2059== by 0xFA772D0: phalcon_internal_require (require.c:103)
==2059==

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

With DBG disabled, are you able to reproduce the bug?

ghost commented Mar 7, 2014

With DBG disabled, are you able to reproduce the bug?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

I guess you use strtr() in the view?

ghost commented Mar 7, 2014

I guess you use strtr() in the view?

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor
  1. With DBG off it still crashes;
  2. mmmmmmm. maybe, somewhere. why?
Contributor

temuri416 commented Mar 7, 2014

  1. With DBG off it still crashes;
  2. mmmmmmm. maybe, somewhere. why?
@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 7, 2014

Invalid read of size 1 in zif_strtr().

Does Valgrind show anything when the script crashes (with DBG off)?

ghost commented Mar 7, 2014

Invalid read of size 1 in zif_strtr().

Does Valgrind show anything when the script crashes (with DBG off)?

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 7, 2014

Contributor

If I'm not redirecting error output, what I see is this (DBG off):

public# ZEND_DONT_UNLOAD_MODULES=1 USE_ZEND_ALLOC=0 valgrind php -S 0.0.0.0:9009 index.php
==2115== Memcheck, a memory error detector
==2115== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2115== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2115== Command: php -S 0.0.0.0:9009 index.php
==2115==
[Mon Mar  3 02:40:55 2014] PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php/php.ini on line 1966 in Unknown on line 0
PHP 5.5.1 Development Server started at Mon Mar  3 02:40:56 2014
Listening on http://0.0.0.0:9009
Document root is /var/web/nginx/html/krfs/public
Press Ctrl-C to quit.
==2115== Invalid read of size 1
==2115==    at 0x73BC67: zif_strtr (string.c:2828)
==2115==    by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2115==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2115==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2115==    by 0x80BF60: zend_call_function (zend_execute_API.c:939)
==2115==    by 0x70EC53: zif_call_user_func (basic_functions.c:4780)
==2115==    by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2115==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2115==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2115==    by 0xFA772D0: phalcon_internal_require (require.c:103)
==2115==    by 0xFA774E8: phalcon_require (require.c:144)
==2115==    by 0xFB86361: zim_Phalcon_Mvc_View_Engine_Php_render (php.c:107)
==2115==  Address 0x157f8d4d is 3 bytes before a block of size 7 alloc'd
==2115==    at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2115==    by 0x7453FE: php_raw_url_encode (url.c:606)
==2115==    by 0x745514: zif_rawurlencode (url.c:645)
==2115==    by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2115==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2115==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2115==    by 0x80BF60: zend_call_function (zend_execute_API.c:939)
==2115==    by 0x70EC53: zif_call_user_func (basic_functions.c:4780)
==2115==    by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2115==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2115==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2115==    by 0xFA772D0: phalcon_internal_require (require.c:103)
==2115==
Contributor

temuri416 commented Mar 7, 2014

If I'm not redirecting error output, what I see is this (DBG off):

public# ZEND_DONT_UNLOAD_MODULES=1 USE_ZEND_ALLOC=0 valgrind php -S 0.0.0.0:9009 index.php
==2115== Memcheck, a memory error detector
==2115== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2115== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2115== Command: php -S 0.0.0.0:9009 index.php
==2115==
[Mon Mar  3 02:40:55 2014] PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php/php.ini on line 1966 in Unknown on line 0
PHP 5.5.1 Development Server started at Mon Mar  3 02:40:56 2014
Listening on http://0.0.0.0:9009
Document root is /var/web/nginx/html/krfs/public
Press Ctrl-C to quit.
==2115== Invalid read of size 1
==2115==    at 0x73BC67: zif_strtr (string.c:2828)
==2115==    by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2115==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2115==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2115==    by 0x80BF60: zend_call_function (zend_execute_API.c:939)
==2115==    by 0x70EC53: zif_call_user_func (basic_functions.c:4780)
==2115==    by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2115==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2115==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2115==    by 0xFA772D0: phalcon_internal_require (require.c:103)
==2115==    by 0xFA774E8: phalcon_require (require.c:144)
==2115==    by 0xFB86361: zim_Phalcon_Mvc_View_Engine_Php_render (php.c:107)
==2115==  Address 0x157f8d4d is 3 bytes before a block of size 7 alloc'd
==2115==    at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2115==    by 0x7453FE: php_raw_url_encode (url.c:606)
==2115==    by 0x745514: zif_rawurlencode (url.c:645)
==2115==    by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2115==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2115==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2115==    by 0x80BF60: zend_call_function (zend_execute_API.c:939)
==2115==    by 0x70EC53: zif_call_user_func (basic_functions.c:4780)
==2115==    by 0xFA72213: phalcon_execute_internal (phalcon.c:56)
==2115==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2115==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2115==    by 0xFA772D0: phalcon_internal_require (require.c:103)
==2115==
@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 8, 2014

Contributor

However, in that situation ::findFirst() does not crash.

Contributor

temuri416 commented Mar 8, 2014

However, in that situation ::findFirst() does not crash.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 8, 2014

As far as I understand, it crashes only without valgrind?

ghost commented Mar 8, 2014

As far as I understand, it crashes only without valgrind?

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 8, 2014

Contributor

I'm going to re-test combinations now to give your a precise answer.

However, if we leave model loading alone - is that at 0x73BC67: zif_strtr (string.c:2828) something to worry about?

Contributor

temuri416 commented Mar 8, 2014

I'm going to re-test combinations now to give your a precise answer.

However, if we leave model loading alone - is that at 0x73BC67: zif_strtr (string.c:2828) something to worry about?

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Mar 8, 2014

Invalid reads are usually not dangerous but invalid writes are. zif_strtr aka strtr() is in PHP's core and therefore there is nothing we can do here anyway.

ghost commented Mar 8, 2014

Invalid reads are usually not dangerous but invalid writes are. zif_strtr aka strtr() is in PHP's core and therefore there is nothing we can do here anyway.

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 8, 2014

Contributor
  1. The problem that I originally reported was only occurring in an application protected area, that requires user session.
  2. To run valgrind tests above, I copied the problem model loading code into publicly accessible controller, as I cannot log into my application when using php -S.
  3. DBG module does not affect model loading. The original code fails both when DBG is on or off.
  4. When I first tested with valgrind (on port 9009), I DID NOT have a valid user session - I restarted the browser. Model DID NOT crash.
  5. Model is consistently crashing when accessed from PROTECTED area (i.e. user session exists).

Now, the interesting part.

  1. I went to my fully-functional application at http://myapp.example.com, logged in with Google OAuth2
  2. I confirmed that Model does crash in a protected area.
  3. I opened a new tab and went to http://myapp.example.com:9009 (where php -S is listening). And VOILA! Model crashed right away.
  4. I cleared browser cookies and went to http://myapp.example.com:9009. The model DID NOT crash.

That absolutely proves that the bug has something to do with Session object AND that the commit that I indicated IS indeed the culprit.

Contributor

temuri416 commented Mar 8, 2014

  1. The problem that I originally reported was only occurring in an application protected area, that requires user session.
  2. To run valgrind tests above, I copied the problem model loading code into publicly accessible controller, as I cannot log into my application when using php -S.
  3. DBG module does not affect model loading. The original code fails both when DBG is on or off.
  4. When I first tested with valgrind (on port 9009), I DID NOT have a valid user session - I restarted the browser. Model DID NOT crash.
  5. Model is consistently crashing when accessed from PROTECTED area (i.e. user session exists).

Now, the interesting part.

  1. I went to my fully-functional application at http://myapp.example.com, logged in with Google OAuth2
  2. I confirmed that Model does crash in a protected area.
  3. I opened a new tab and went to http://myapp.example.com:9009 (where php -S is listening). And VOILA! Model crashed right away.
  4. I cleared browser cookies and went to http://myapp.example.com:9009. The model DID NOT crash.

That absolutely proves that the bug has something to do with Session object AND that the commit that I indicated IS indeed the culprit.

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 8, 2014

Contributor

That also means that I cannot give you good valgrind debug data, unless I get php -S going.

I am now going to try your suggestion with router.php.

Contributor

temuri416 commented Mar 8, 2014

That also means that I cannot give you good valgrind debug data, unless I get php -S going.

I am now going to try your suggestion with router.php.

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 8, 2014

Contributor
  1. I've set up router.php, as you have suggested.
  2. I've logged into my site via my default server (port 80)
  3. I've confirmed that model is crashing (I log all exceptions to file on disk)
  4. I opened a new browser tab and went to protected URL on port 9009
  5. Model did crash. However, valgrind did not report any errors:
==2210== Memcheck, a memory error detector
==2210== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2210== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2210== Command: php -S 0.0.0.0:9009 router.php
==2210== 
[Mon Mar  3 03:28:05 2014] PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php/php.ini on line 1966 in Unknown on line 0
==2210== 
==2210== HEAP SUMMARY:
==2210==     in use at exit: 20,247 bytes in 72 blocks
==2210==   total heap usage: 213,136 allocs, 213,064 frees, 35,455,911 bytes allocated
==2210== 
==2210== LEAK SUMMARY:
==2210==    definitely lost: 32 bytes in 1 blocks
==2210==    indirectly lost: 0 bytes in 0 blocks
==2210==      possibly lost: 0 bytes in 0 blocks
==2210==    still reachable: 20,215 bytes in 71 blocks
==2210==         suppressed: 0 bytes in 0 blocks
==2210== Rerun with --leak-check=full to see details of leaked memory
==2210== 
==2210== For counts of detected and suppressed errors, rerun with: -v
==2210== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
Contributor

temuri416 commented Mar 8, 2014

  1. I've set up router.php, as you have suggested.
  2. I've logged into my site via my default server (port 80)
  3. I've confirmed that model is crashing (I log all exceptions to file on disk)
  4. I opened a new browser tab and went to protected URL on port 9009
  5. Model did crash. However, valgrind did not report any errors:
==2210== Memcheck, a memory error detector
==2210== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2210== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2210== Command: php -S 0.0.0.0:9009 router.php
==2210== 
[Mon Mar  3 03:28:05 2014] PHP Deprecated:  Comments starting with '#' are deprecated in /etc/php/php.ini on line 1966 in Unknown on line 0
==2210== 
==2210== HEAP SUMMARY:
==2210==     in use at exit: 20,247 bytes in 72 blocks
==2210==   total heap usage: 213,136 allocs, 213,064 frees, 35,455,911 bytes allocated
==2210== 
==2210== LEAK SUMMARY:
==2210==    definitely lost: 32 bytes in 1 blocks
==2210==    indirectly lost: 0 bytes in 0 blocks
==2210==      possibly lost: 0 bytes in 0 blocks
==2210==    still reachable: 20,215 bytes in 71 blocks
==2210==         suppressed: 0 bytes in 0 blocks
==2210== Rerun with --leak-check=full to see details of leaked memory
==2210== 
==2210== For counts of detected and suppressed errors, rerun with: -v
==2210== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)
@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Mar 8, 2014

Contributor

I have just re-ran valgrind scenario above, this time with DBG on. There's lot more info now, and even some stuff related to Phalcon_Mvc_Model_Query at the very bottom:

==2231== Memcheck, a memory error detector
==2231== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2231== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2231== Command: php -S 0.0.0.0:9009 router.php
==2231== 
==2231== Conditional jump or move depends on uninitialised value(s)
==2231==    at 0x7FFF7D1: getenv (getenv.c:89)
==2231==    by 0x70FAA9: zif_getenv (basic_functions.c:4059)
==2231==    by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231==    by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x8CA719: ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER (zend_vm_execute.h:2738)
==2231==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231==    by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x81B4C8: zend_execute_scripts (zend.c:1316)
==2231==    by 0x8D0231: php_cli_server_dispatch_router.isra.11 (php_cli_server.c:2014)
==2231==    by 0x8D27B0: php_cli_server_recv_event_read_request (php_cli_server.c:2053)
==2231== 
==2231== Conditional jump or move depends on uninitialised value(s)
==2231==    at 0x7FFF7D1: getenv (getenv.c:89)
==2231==    by 0x7C9BAD: php_get_temporary_directory (php_open_temporary_file.c:234)
==2231==    by 0x6C609C: ps_open_files (mod_files.c:269)
==2231==    by 0x6C1C90: php_session_initialize (session.c:448)
==2231==    by 0x6C4B84: php_session_start (session.c:1450)
==2231==    by 0xFA92ABC: phalcon_session_start (session.c:33)
==2231==    by 0xFC7193E: zim_Phalcon_Session_Adapter_start (adapter.c:127)
==2231==    by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x80C0AD: zend_call_function (zend_execute_API.c:959)
==2231==    by 0xFA76E1E: phalcon_call_user_func_array_noex (fcall.c:510)
==2231==    by 0xFC8B278: phalcon_call_user_func_array (fcall.h:656)
==2231==    by 0xFC8DC64: zim_Phalcon_DI_Service_Builder_build (builder.c:408)
==2231== 
==2231== Conditional jump or move depends on uninitialised value(s)
==2231==    at 0x7FFF7D1: getenv (getenv.c:89)
==2231==    by 0x7FF0FE9: setlocale (setlocale.c:225)
==2231==    by 0x4A2B27: seek_to_tz_position (parse_tz.c:269)
==2231==    by 0x4A2E13: timelib_timezone_id_is_valid (parse_tz.c:312)
==2231==    by 0x47E2DC: guess_timezone.part.26 (php_date.c:956)
==2231==    by 0x480102: get_timezone_info (php_date.c:939)
==2231==    by 0x484054: php_date_initialize (php_date.c:2588)
==2231==    by 0x484631: zim_DateTime___construct (php_date.c:2710)
==2231==    by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231==    by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== 
==2231== Conditional jump or move depends on uninitialised value(s)
==2231==    at 0x7FFF7D1: getenv (getenv.c:89)
==2231==    by 0x7FF0FE9: setlocale (setlocale.c:225)
==2231==    by 0x4A2BC4: seek_to_tz_position (parse_tz.c:283)
==2231==    by 0x4A2E13: timelib_timezone_id_is_valid (parse_tz.c:312)
==2231==    by 0x47E2DC: guess_timezone.part.26 (php_date.c:956)
==2231==    by 0x480102: get_timezone_info (php_date.c:939)
==2231==    by 0x484054: php_date_initialize (php_date.c:2588)
==2231==    by 0x484631: zim_DateTime___construct (php_date.c:2710)
==2231==    by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231==    by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== 
==2231== Conditional jump or move depends on uninitialised value(s)
==2231==    at 0x7FFF7D1: getenv (getenv.c:89)
==2231==    by 0x7FF0FE9: setlocale (setlocale.c:225)
==2231==    by 0x4A2B27: seek_to_tz_position (parse_tz.c:269)
==2231==    by 0x4A2E42: timelib_parse_tzfile (parse_tz.c:320)
==2231==    by 0x47D8D2: php_date_parse_tzfile (php_date.c:900)
==2231==    by 0x480119: get_timezone_info (php_date.c:975)
==2231==    by 0x484054: php_date_initialize (php_date.c:2588)
==2231==    by 0x484631: zim_DateTime___construct (php_date.c:2710)
==2231==    by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231==    by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== 
==2231== Conditional jump or move depends on uninitialised value(s)
==2231==    at 0x7FFF7D1: getenv (getenv.c:89)
==2231==    by 0x7FF0FE9: setlocale (setlocale.c:225)
==2231==    by 0x4A2BC4: seek_to_tz_position (parse_tz.c:283)
==2231==    by 0x4A2E42: timelib_parse_tzfile (parse_tz.c:320)
==2231==    by 0x47D8D2: php_date_parse_tzfile (php_date.c:900)
==2231==    by 0x480119: get_timezone_info (php_date.c:975)
==2231==    by 0x484054: php_date_initialize (php_date.c:2588)
==2231==    by 0x484631: zim_DateTime___construct (php_date.c:2710)
==2231==    by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231==    by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== 
==2231== Invalid read of size 4
==2231==    at 0x405D03E: dbg_send_log (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x40547CE: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x83492D: zend_throw_exception_internal (zend_exceptions.c:116)
==2231==    by 0xFA8FEDF: phalcon_throw_exception_zval (exception.c:56)
==2231==    by 0xFBC465E: zim_Phalcon_Mvc_Model_Query__getQualified (query.c:524)
==2231==    by 0xFA950D4: phalcon_alt_call_method (fcall.c:801)
==2231==    by 0xFA95919: phalcon_alt_call_user_method (fcall.c:929)
==2231==    by 0xFA76638: phalcon_call_method_vparams (fcall.c:336)
==2231==    by 0xFA767AC: phalcon_call_method_params (fcall.c:375)
==2231==    by 0xFBC66F0: zim_Phalcon_Mvc_Model_Query__getExpression (query.c:813)
==2231==    by 0xFA950D4: phalcon_alt_call_method (fcall.c:801)
==2231==    by 0xFA95919: phalcon_alt_call_user_method (fcall.c:929)
==2231==  Address 0x14b785ec is 76 bytes inside a block of size 78 alloc'd
==2231==    at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2231==    by 0x7F48C0: _estrndup (zend_alloc.c:2650)
==2231==    by 0x8257A5: zend_update_property_string (zend_API.c:3774)
==2231==    by 0x832737: zend_default_exception_new_ex (zend_exceptions.c:163)
==2231==    by 0x8327BA: zend_default_exception_new (zend_exceptions.c:173)
==2231==    by 0x81D3B1: _object_and_properties_init (zend_API.c:1200)
==2231==    by 0xFA8FE80: phalcon_throw_exception_zval (exception.c:53)
==2231==    by 0xFBC465E: zim_Phalcon_Mvc_Model_Query__getQualified (query.c:524)
==2231==    by 0xFA950D4: phalcon_alt_call_method (fcall.c:801)
==2231==    by 0xFA95919: phalcon_alt_call_user_method (fcall.c:929)
==2231==    by 0xFA76638: phalcon_call_method_vparams (fcall.c:336)
==2231==    by 0xFA767AC: phalcon_call_method_params (fcall.c:375)
==2231== 
Contributor

temuri416 commented Mar 8, 2014

I have just re-ran valgrind scenario above, this time with DBG on. There's lot more info now, and even some stuff related to Phalcon_Mvc_Model_Query at the very bottom:

==2231== Memcheck, a memory error detector
==2231== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2231== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2231== Command: php -S 0.0.0.0:9009 router.php
==2231== 
==2231== Conditional jump or move depends on uninitialised value(s)
==2231==    at 0x7FFF7D1: getenv (getenv.c:89)
==2231==    by 0x70FAA9: zif_getenv (basic_functions.c:4059)
==2231==    by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231==    by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x8CA719: ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER (zend_vm_execute.h:2738)
==2231==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231==    by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x81B4C8: zend_execute_scripts (zend.c:1316)
==2231==    by 0x8D0231: php_cli_server_dispatch_router.isra.11 (php_cli_server.c:2014)
==2231==    by 0x8D27B0: php_cli_server_recv_event_read_request (php_cli_server.c:2053)
==2231== 
==2231== Conditional jump or move depends on uninitialised value(s)
==2231==    at 0x7FFF7D1: getenv (getenv.c:89)
==2231==    by 0x7C9BAD: php_get_temporary_directory (php_open_temporary_file.c:234)
==2231==    by 0x6C609C: ps_open_files (mod_files.c:269)
==2231==    by 0x6C1C90: php_session_initialize (session.c:448)
==2231==    by 0x6C4B84: php_session_start (session.c:1450)
==2231==    by 0xFA92ABC: phalcon_session_start (session.c:33)
==2231==    by 0xFC7193E: zim_Phalcon_Session_Adapter_start (adapter.c:127)
==2231==    by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x80C0AD: zend_call_function (zend_execute_API.c:959)
==2231==    by 0xFA76E1E: phalcon_call_user_func_array_noex (fcall.c:510)
==2231==    by 0xFC8B278: phalcon_call_user_func_array (fcall.h:656)
==2231==    by 0xFC8DC64: zim_Phalcon_DI_Service_Builder_build (builder.c:408)
==2231== 
==2231== Conditional jump or move depends on uninitialised value(s)
==2231==    at 0x7FFF7D1: getenv (getenv.c:89)
==2231==    by 0x7FF0FE9: setlocale (setlocale.c:225)
==2231==    by 0x4A2B27: seek_to_tz_position (parse_tz.c:269)
==2231==    by 0x4A2E13: timelib_timezone_id_is_valid (parse_tz.c:312)
==2231==    by 0x47E2DC: guess_timezone.part.26 (php_date.c:956)
==2231==    by 0x480102: get_timezone_info (php_date.c:939)
==2231==    by 0x484054: php_date_initialize (php_date.c:2588)
==2231==    by 0x484631: zim_DateTime___construct (php_date.c:2710)
==2231==    by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231==    by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== 
==2231== Conditional jump or move depends on uninitialised value(s)
==2231==    at 0x7FFF7D1: getenv (getenv.c:89)
==2231==    by 0x7FF0FE9: setlocale (setlocale.c:225)
==2231==    by 0x4A2BC4: seek_to_tz_position (parse_tz.c:283)
==2231==    by 0x4A2E13: timelib_timezone_id_is_valid (parse_tz.c:312)
==2231==    by 0x47E2DC: guess_timezone.part.26 (php_date.c:956)
==2231==    by 0x480102: get_timezone_info (php_date.c:939)
==2231==    by 0x484054: php_date_initialize (php_date.c:2588)
==2231==    by 0x484631: zim_DateTime___construct (php_date.c:2710)
==2231==    by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231==    by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== 
==2231== Conditional jump or move depends on uninitialised value(s)
==2231==    at 0x7FFF7D1: getenv (getenv.c:89)
==2231==    by 0x7FF0FE9: setlocale (setlocale.c:225)
==2231==    by 0x4A2B27: seek_to_tz_position (parse_tz.c:269)
==2231==    by 0x4A2E42: timelib_parse_tzfile (parse_tz.c:320)
==2231==    by 0x47D8D2: php_date_parse_tzfile (php_date.c:900)
==2231==    by 0x480119: get_timezone_info (php_date.c:975)
==2231==    by 0x484054: php_date_initialize (php_date.c:2588)
==2231==    by 0x484631: zim_DateTime___construct (php_date.c:2710)
==2231==    by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231==    by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== 
==2231== Conditional jump or move depends on uninitialised value(s)
==2231==    at 0x7FFF7D1: getenv (getenv.c:89)
==2231==    by 0x7FF0FE9: setlocale (setlocale.c:225)
==2231==    by 0x4A2BC4: seek_to_tz_position (parse_tz.c:283)
==2231==    by 0x4A2E42: timelib_parse_tzfile (parse_tz.c:320)
==2231==    by 0x47D8D2: php_date_parse_tzfile (php_date.c:900)
==2231==    by 0x480119: get_timezone_info (php_date.c:975)
==2231==    by 0x484054: php_date_initialize (php_date.c:2588)
==2231==    by 0x484631: zim_DateTime___construct (php_date.c:2710)
==2231==    by 0x4051EFB: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x8C877A: zend_do_fcall_common_helper_SPEC (zend_vm_execute.h:545)
==2231==    by 0x888817: execute_ex (zend_vm_execute.h:356)
==2231==    by 0x4055052: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231== 
==2231== Invalid read of size 4
==2231==    at 0x405D03E: dbg_send_log (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x40547CE: ??? (in /var/web/php/lib/php/extensions/no-debug-non-zts-20121212/dbg-php-5.5.so)
==2231==    by 0x83492D: zend_throw_exception_internal (zend_exceptions.c:116)
==2231==    by 0xFA8FEDF: phalcon_throw_exception_zval (exception.c:56)
==2231==    by 0xFBC465E: zim_Phalcon_Mvc_Model_Query__getQualified (query.c:524)
==2231==    by 0xFA950D4: phalcon_alt_call_method (fcall.c:801)
==2231==    by 0xFA95919: phalcon_alt_call_user_method (fcall.c:929)
==2231==    by 0xFA76638: phalcon_call_method_vparams (fcall.c:336)
==2231==    by 0xFA767AC: phalcon_call_method_params (fcall.c:375)
==2231==    by 0xFBC66F0: zim_Phalcon_Mvc_Model_Query__getExpression (query.c:813)
==2231==    by 0xFA950D4: phalcon_alt_call_method (fcall.c:801)
==2231==    by 0xFA95919: phalcon_alt_call_user_method (fcall.c:929)
==2231==  Address 0x14b785ec is 76 bytes inside a block of size 78 alloc'd
==2231==    at 0x4C2CD7B: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==2231==    by 0x7F48C0: _estrndup (zend_alloc.c:2650)
==2231==    by 0x8257A5: zend_update_property_string (zend_API.c:3774)
==2231==    by 0x832737: zend_default_exception_new_ex (zend_exceptions.c:163)
==2231==    by 0x8327BA: zend_default_exception_new (zend_exceptions.c:173)
==2231==    by 0x81D3B1: _object_and_properties_init (zend_API.c:1200)
==2231==    by 0xFA8FE80: phalcon_throw_exception_zval (exception.c:53)
==2231==    by 0xFBC465E: zim_Phalcon_Mvc_Model_Query__getQualified (query.c:524)
==2231==    by 0xFA950D4: phalcon_alt_call_method (fcall.c:801)
==2231==    by 0xFA95919: phalcon_alt_call_user_method (fcall.c:929)
==2231==    by 0xFA76638: phalcon_call_method_vparams (fcall.c:336)
==2231==    by 0xFA767AC: phalcon_call_method_params (fcall.c:375)
==2231== 

@niden niden added Unassigned and removed Unassigned labels Apr 3, 2014

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 May 6, 2014

Contributor

@phalcon

There's clearly a bug somewhere in Phalcon\Session\Bag that affects Models.

The case is complicated, I don't have a code to reproduce it. It needs to be looked at in the scope of my application. I'll be happy to roll out a Rackspace cloud instance and give root access to whoever finds time to work on this.

Thanks!

Contributor

temuri416 commented May 6, 2014

@phalcon

There's clearly a bug somewhere in Phalcon\Session\Bag that affects Models.

The case is complicated, I don't have a code to reproduce it. It needs to be looked at in the scope of my application. I'll be happy to roll out a Rackspace cloud instance and give root access to whoever finds time to work on this.

Thanks!

@rkyoku

This comment has been minimized.

Show comment
Hide comment
@rkyoku

rkyoku Aug 26, 2014

Hi,

I also have the crash, but not on every computer, and not if I run the script with CLI.

A simple line like that will crash:
$oList = \MyApp\Model\ListModel::findFirst(28);

But as outlined by @temuri416 , it does not crash when in CLI.

Any input on that bug? I am using Phalcon 1.3.2 with PHP 5.5. Also, I don't have/use sessions right now. This is a simple code.

If I may, I consider that this bug is blocking, not medium, as long as I can't use my DB.

Thank you in advance,

rkyoku commented Aug 26, 2014

Hi,

I also have the crash, but not on every computer, and not if I run the script with CLI.

A simple line like that will crash:
$oList = \MyApp\Model\ListModel::findFirst(28);

But as outlined by @temuri416 , it does not crash when in CLI.

Any input on that bug? I am using Phalcon 1.3.2 with PHP 5.5. Also, I don't have/use sessions right now. This is a simple code.

If I may, I consider that this bug is blocking, not medium, as long as I can't use my DB.

Thank you in advance,

@Green-Cat

This comment has been minimized.

Show comment
Hide comment
@Green-Cat

Green-Cat Apr 16, 2015

Contributor

@RenaudParis @temuri416 Could you try it under 2.0?

Contributor

Green-Cat commented Apr 16, 2015

@RenaudParis @temuri416 Could you try it under 2.0?

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Apr 16, 2015

Contributor

@Green-Cat Why?

Contributor

temuri416 commented Apr 16, 2015

@Green-Cat Why?

@Green-Cat

This comment has been minimized.

Show comment
Hide comment
@Green-Cat

Green-Cat Apr 16, 2015

Contributor

@temuri416 Both components were rewritten while keeping the same external api.
So your code should work out of the box (with minor modifications at most (it is stricter in regards to datatypes)) and the issue may have been resolved.

Contributor

Green-Cat commented Apr 16, 2015

@temuri416 Both components were rewritten while keeping the same external api.
So your code should work out of the box (with minor modifications at most (it is stricter in regards to datatypes)) and the issue may have been resolved.

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Apr 16, 2015

Contributor

That's good. But I'm not switching to Phalcon 2.0 just yet. I'll test when I get there.

Contributor

temuri416 commented Apr 16, 2015

That's good. But I'm not switching to Phalcon 2.0 just yet. I'll test when I get there.

@andresgutierrez

This comment has been minimized.

Show comment
Hide comment
@andresgutierrez

andresgutierrez Aug 28, 2015

Member

Could you please check if this still happen in 2.0.x?

Member

andresgutierrez commented Aug 28, 2015

Could you please check if this still happen in 2.0.x?

@temuri416

This comment has been minimized.

Show comment
Hide comment
@temuri416

temuri416 Aug 28, 2015

Contributor

2.0.x seems to work fine.

Contributor

temuri416 commented Aug 28, 2015

2.0.x seems to work fine.

@andresgutierrez

This comment has been minimized.

Show comment
Hide comment
@andresgutierrez
Member

andresgutierrez commented Aug 28, 2015

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment