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

Fixed cache backends bug #11322 #11323

Merged
merged 1 commit into from
Jan 21, 2016
Merged

Conversation

ifsnow
Copy link
Contributor

@ifsnow ifsnow commented Jan 19, 2016

It's a PR to save number 0 in cache. (issue #11322)

@ifsnow ifsnow changed the title Fixed cache backends bug (#11322) Fixed cache backends bug #11322 Jan 19, 2016
@sergeyklay
Copy link
Contributor

Can you please provide a small test?

@ifsnow
Copy link
Contributor Author

ifsnow commented Jan 20, 2016

@sergeyklay

I think it's just a issue related to checking if variable is null.

if !content {
    // if content is null
} else {
    // if content is not null
}

In this case, if content parameter is 0 or "0", It works as if content is null.
It's not the operation that user wanted. (user wanted to save "0")

apc.zep and memory.zep already use content === null condition to check the parameter.

@sergeyklay
Copy link
Contributor

In any case, you must show that your PR has solved the issue. Now it is impossible to check without accepting your PR. A little test would have shown - issue is solved or not without accepting the PR to the main codebase

@ifsnow ifsnow force-pushed the 2.0.x-fix-issue-11322 branch 2 times, most recently from c05b2df to 9782821 Compare January 21, 2016 05:13
@ifsnow
Copy link
Contributor Author

ifsnow commented Jan 21, 2016

@sergeyklay
I added some codes in testDataFileCache function of CacheTest.php.
It would failed at this test in 2.0.x branch.

@sergeyklay
Copy link
Contributor

Can you please rebase onto 2.0.x

@ifsnow ifsnow force-pushed the 2.0.x-fix-issue-11322 branch from 9782821 to 74efa24 Compare January 21, 2016 14:00
@ifsnow
Copy link
Contributor Author

ifsnow commented Jan 21, 2016

@sergeyklay I have rebased onto 2.0.x

@ifsnow ifsnow force-pushed the 2.0.x-fix-issue-11322 branch from 74efa24 to 1037e14 Compare January 21, 2016 14:09
@sergeyklay
Copy link
Contributor

Fine. How about:

$cache->save('test-zero-data', 0); // int, not string. as described in issue #11322

// or

$cache->save('test-zero-data', false);

can you please also provide these test cases

@@ -9,8 +9,7 @@
- Fixed `Phalcon\Translate\Adapter\Gettext::exists` bug[#11310](https://github.com/phalcon/cphalcon/issues/11310) related to the wrong returned value (always true)
- Fixed `Phalcon\Translate\Adapter\Gettext::setLocale` bug[#11311](https://github.com/phalcon/cphalcon/issues/11311) related to the incorrect setting locale
- Added ability to persistent connection in `Phalcon\Queue\Beanstalk::connect`
- Fixed `Phalcon\Http\Response::redirect` bug[#11324](https://github.com/phalcon/cphalcon/issues/11324). Incorrect initialization local array of status codes

- Fixed `Phalcon\Http\Response::redirect` bug[#11324](https://github.com/phalcon/cphalcon/issues/11324). Incorrect initialization local array of status codes- Fixed cache backends bug[#11322](https://github.com/phalcon/cphalcon/issues/11322) related to saving number 0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put your changes at new line

@ifsnow ifsnow force-pushed the 2.0.x-fix-issue-11322 branch from 1037e14 to 9320aad Compare January 21, 2016 15:05
@ifsnow
Copy link
Contributor Author

ifsnow commented Jan 21, 2016

@sergeyklay added another test cases & changed wrong CHANGELOG.md

sergeyklay added a commit that referenced this pull request Jan 21, 2016
@sergeyklay sergeyklay merged commit 02e0814 into phalcon:2.0.x Jan 21, 2016
@sergeyklay
Copy link
Contributor

Thanks

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

Successfully merging this pull request may close these issues.

2 participants