A regularity theorem for w-minimizers of integral functionals