I have a couple of php files in magento lib that I need to rewrite in order to change the functionality. I searched about this but all the solutions I found did not work. Does anyone know how to properly rewrite these files?
You can copy the file from
app/code/local, for example,
app/code/local/Varien/Object.php. The Magento autoloader looks for class files in these directories (in that order):
Unfortunately there is no cleaner way, like with class rewrites to do so (see also: https://stackoverflow.com/questions/14860858/magento-rewrite-lib-file/14861227#14861227)
For Magento2 you can replace any classes using preferences in
di.xml. Read more: http://devdocs.magento.com/guides/v2.1/extension-dev-guide/build/di-xml-file.html