kendarorg / PhpNuget

Php nuget manager supporting complex queries on txt files or MySQL
http://www.kendar.org/?p=/dotnet/phpnuget
Other
23 stars 15 forks source link

Errors when uploading packages #73

Open bkraul opened 5 years ago

bkraul commented 5 years ago

I am getting an Got error 'PHP message: PHP Warning: implode(): Invalid arguments passed in /app/src/inc/api_nuget.php on line 128\nPHP message: PHP Warning: implode(): Invalid arguments passed in /app/src/inc/api_nuget.php on line 128\n' when trying to upload packages. As a result the push operation fails.

This started happening after the last set of changes (092f2c1) where this was introduced:

if(is_string($e->ReleaseNotes)) {
    $t = str_replace("\${NUSPEC.RELEASENOTES}", htmlspecialchars($e->ReleaseNotes), $t);
}else{
    $t = str_replace("\${NUSPEC.RELEASENOTES}", htmlspecialchars(implode(" ",$e->ReleaseNotes)), $t);
}

Other subsequent errors are:

Got error 'PHP message: PHP Notice:  Undefined index: sizeBytes in /app/src/inc/commons/uploadutils.php on line 55\nPHP message: PHP Notice:  Trying to get property of non-object in /app/src/inc/nugetreader.php on line 192\n'

However, this one is possible just a result of the original failure.

bkraul commented 5 years ago

Hmmm...I reverted the line in api_nuget.php to what it was before the commit, but the second error is still happening, and the push operation is still failing. Neither uploadutils.php nor nugetreader.php seem to have recently changed. Any ideas?

kendarorg commented 5 years ago

Mmmh can you give me the nuspec file of the package you are trying to upload?

bkraul commented 5 years ago
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd">
  <metadata>
    <id>EPG.CommonLibrary</id>
    <version>1.1.21.7096</version>
    <title></title>
    <authors>EPG Internal Development</authors>
    <owners>EPG Internal Development</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <description>Common code library for EPG applications.</description>
    <copyright>Copyright ©  2016 EPG Insurance, Inc.</copyright>
  </metadata>
</package>

The packages were uploading fine up to the last couple of commits.

kendarorg commented 5 years ago

I think this could result from the absence of the field on the nuspec, i think that a call to if(is_array( on the else could do the work ... this was generated by another guy having an array for the release notes (i always like the clarity and precision of the nuspec specifications :P )

bkraul commented 5 years ago

hmmm...let me try adding the field and see if it works.

bkraul commented 5 years ago

So, adding the field <releaseNotes/> did remove the original releaseNotes error, but it still fails with the second error.

bkraul commented 5 years ago

This is the command I am using:

.\nuget.exe push .\packages\*.symbols.nupkg [mykey] -source http://my.nugetserver.com/upload
kendarorg commented 5 years ago

http://sandbox.onlinephpfunctions.com/ with htmlspecialchars(implode(" ",null)); it explode! I think i'll add an if(null!=$e->ReleaseNotes){ ...all the update of the field }

bkraul commented 5 years ago

Sounds good, but as I said, I don't think that is the main problem. Because even after putting in the release notes field, the push operation still fails with:

Got error 'PHP message: PHP Notice:  Undefined index: sizeBytes in /app/src/inc/commons/uploadutils.php on line 55\nPHP message: PHP Notice:  Trying to get property of non-object in /app/src/inc/nugetreader.php on line 192\n'
bkraul commented 5 years ago

I can tell that the problem started with the wave of commits after (42cd592). (the ones with #71 Resolved chocolatey special api with Packages), because I just checked out that one commit and pushing works perfectly. So, not sure what's going on there, there are like 5 commits regarding the special API).

bkraul commented 5 years ago

I can confirm commit 5f86b49 is what is breaking the push uploads. I am not sure which specific one of the changes in the commit does, but all the commits before that one work fine.

bkraul commented 5 years ago

@kendarorg Quick question. I notice that this commit introduces an IsLatestVersion field to the database. Am I missing a schema upgrade, and could this be the problem (I have mySQL backend)? And if so, how do I apply it to my existing installation?

UPDATE: Nevermind, the field exists in my nugetdb_pkg table.

kendarorg commented 5 years ago

Added package \nuget_exes\NoRelease.1.0.0 to test

bkraul commented 5 years ago

This is still not resolved. Still getting the error:

Got error 'PHP message: PHP Notice:  Undefined index: sizeBytes in /app/src/inc/commons/uploadutils.php on line 56
PHP message: PHP Notice:  Trying to get property of non-object in /app/src/inc/nugetreader.php on line 192
kendarorg commented 5 years ago

I recognized now that you are treating Symbols packages!!

bkraul commented 5 years ago

The size is 199KB. The max is 50MB. And yes, I do both (with symbols and without symbols). As mentioned, this worked fine until after commit 5f86b49 .

kendarorg commented 5 years ago

Tried to reduce the variations... (sorry for the dumb questions, but i am really trying to understand this thing)

kendarorg commented 5 years ago

if u can give it a try!

bkraul commented 5 years ago

I did. Command returns:

C:\Users\bkraul\source\repos\WinForms\EPG.CommonLibrary\EPG.CommonLibrary\.nuget>.\nuget.exe push .\packages\*.symbols.nupkg [key] -source http://nuget.epginsurance.com/upload
Pushing EPG.CommonLibrary.1.1.21.7096.symbols.nupkg to 'http://nuget.epginsurance.com/upload'...
  PUT http://nuget.epginsurance.com/upload/
  InternalServerError http://nuget.epginsurance.com/upload/ 4778ms
  PUT http://nuget.epginsurance.com/upload/
  InternalServerError http://nuget.epginsurance.com/upload/ 1708ms
  PUT http://nuget.epginsurance.com/upload/
  InternalServerError http://nuget.epginsurance.com/upload/ 1413ms
Response status code does not indicate success: 500 (Missing Id and/or Version).
C:\Users\bkraul\source\repos\WinForms\EPG.CommonLibrary\EPG.CommonLibrary\.nuget>

PHP returns:

AH01071: Got error 'PHP message: PHP Notice:  Trying to get property of non-object in /app/src/inc/nugetreader.php on line 196
adrift42 commented 4 years ago

I was having a similar error with this, then upgraded to phpnuget 4.1.0.0 with php7.4.3:

[Mon Mar 30 15:23:44.967523 2020] [php7:error] [pid xxxx] [client xx.xx.xx.xx:61630] PHP Fatal error: Uncaught Error: Call to undefined function zip_open() in /srv/www/choco.domain/src/inc/commons/zipmanager.php:42\nStack trace:\n#0 /srv/www/choco.domain/src/inc/nugetreader.php(126): ZipManager->GenerateInfos()\n#1 /srv/www/choco.domain/src/uploadnupkg.php(67): NugetManager->LoadNuspecFromFile('/srv/www/choco....')\n#2 {main}\n thrown in /srv/www/choco.domain/src/inc/commons/zipmanager.php on line 42, referer: http://choco.domain/

mostlydev commented 4 years ago

@adrift42 You just need to install php-zip package, and php-curl while you're at it -- and php-mysql if you're using that.

But uploads are still broken.