PhpNuget icon indicating copy to clipboard operation
PhpNuget copied to clipboard

Errors when uploading packages

Open bkraul opened this issue 6 years ago • 21 comments

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 avatar Jun 05 '19 15:06 bkraul

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?

bkraul avatar Jun 05 '19 15:06 bkraul

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

kendarorg avatar Jun 05 '19 15:06 kendarorg

<?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.

bkraul avatar Jun 05 '19 15:06 bkraul

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 )

kendarorg avatar Jun 05 '19 16:06 kendarorg

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

bkraul avatar Jun 05 '19 16:06 bkraul

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

bkraul avatar Jun 05 '19 16:06 bkraul

This is the command I am using:

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

bkraul avatar Jun 05 '19 16:06 bkraul

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 }

kendarorg avatar Jun 05 '19 16:06 kendarorg

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 avatar Jun 05 '19 17:06 bkraul

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 avatar Jun 05 '19 19:06 bkraul

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 avatar Jun 05 '19 19:06 bkraul

@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.

bkraul avatar Jun 05 '19 19:06 bkraul

Added package \nuget_exes\NoRelease.1.0.0 to test

kendarorg avatar Jun 06 '19 10:06 kendarorg

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

bkraul avatar Jun 09 '19 13:06 bkraul

I recognized now that you are treating Symbols packages!!

kendarorg avatar Jun 10 '19 06:06 kendarorg

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 .

bkraul avatar Jun 10 '19 12:06 bkraul

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

kendarorg avatar Jun 10 '19 13:06 kendarorg

if u can give it a try!

kendarorg avatar Jun 10 '19 13:06 kendarorg

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

bkraul avatar Jun 10 '19 19:06 bkraul

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/

adrift42 avatar Mar 30 '20 02:03 adrift42

@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.

mostlydev avatar Jul 01 '20 17:07 mostlydev