In this function, just after the block if ( $versionCheck), we can see the code:
=> Definitely, after this block, $version has to be checked, because it may be false.
The function should then return null or false, or whaterver in this specific case.
Because if $version is false and the script continues, the next command is just crashing:
How can $version be null at this step you may wonder ?
Well I have the case on specific conditions:
Due to a webservice crashs, many workflows were filling a fifo, and were launched on some old versionID.
I've been using in this workflow the createNewVersion() with checkVersion set to true
=> as a result, imagine an object with the version 2 and after some other versions ( 3, 4, 5, 6, 7 for example), the workflow was creating several versions all from version 2, but as checkVersion was set to true, at a moment, the version 2 was just deleted
And then, the code $version = $this->version( $copyFromVersion ); sends false
causing afterwards the eZContentObject::createNewVersion() to crash...